Title: [143558] trunk/Source/WebKit2
- Revision
- 143558
- Author
- [email protected]
- Date
- 2013-02-20 19:51:40 -0800 (Wed, 20 Feb 2013)
Log Message
Provide WKView SPI to defer telling the WebPageProxy and WebProcess about changes in the hosting window
https://bugs.webkit.org/show_bug.cgi?id=110415
<rdar://problem/13095405>
Reviewed by Simon Fraser.
* UIProcess/API/mac/WKView.mm: Add _viewInWindowChangesDeferredCount and _viewInWindowChangeWasDeferred to WKViewData.
(-[WKView viewDidMoveToWindow]): If we're deferring window changes, don't include the ViewIsInWindow flag
when sending viewStateDidChange. Instead, save the fact that we want to do that later aside.
(-[WKView beginDeferringViewInWindowChanges]):
(-[WKView endDeferringViewInWindowChanges]): Straightforward begin/end pair. When we exit the last pair and
have a pending window change, let the WebPageProxy know. WebPageProxy will do the check to ensure that
the in-window state has actually changed.
(-[WKView isDeferringViewInWindowChanges]):
* UIProcess/API/mac/WKViewPrivate.h:
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (143557 => 143558)
--- trunk/Source/WebKit2/ChangeLog 2013-02-21 03:50:51 UTC (rev 143557)
+++ trunk/Source/WebKit2/ChangeLog 2013-02-21 03:51:40 UTC (rev 143558)
@@ -1,3 +1,21 @@
+2013-02-20 Tim Horton <[email protected]>
+
+ Provide WKView SPI to defer telling the WebPageProxy and WebProcess about changes in the hosting window
+ https://bugs.webkit.org/show_bug.cgi?id=110415
+ <rdar://problem/13095405>
+
+ Reviewed by Simon Fraser.
+
+ * UIProcess/API/mac/WKView.mm: Add _viewInWindowChangesDeferredCount and _viewInWindowChangeWasDeferred to WKViewData.
+ (-[WKView viewDidMoveToWindow]): If we're deferring window changes, don't include the ViewIsInWindow flag
+ when sending viewStateDidChange. Instead, save the fact that we want to do that later aside.
+ (-[WKView beginDeferringViewInWindowChanges]):
+ (-[WKView endDeferringViewInWindowChanges]): Straightforward begin/end pair. When we exit the last pair and
+ have a pending window change, let the WebPageProxy know. WebPageProxy will do the check to ensure that
+ the in-window state has actually changed.
+ (-[WKView isDeferringViewInWindowChanges]):
+ * UIProcess/API/mac/WKViewPrivate.h:
+
2013-02-20 Kiran Muppala <[email protected]>
Disable window occlusion notifications for App Store on Mac.
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (143557 => 143558)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2013-02-21 03:50:51 UTC (rev 143557)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm 2013-02-21 03:51:40 UTC (rev 143558)
@@ -208,7 +208,10 @@
NSRect _windowBottomCornerIntersectionRect;
unsigned _frameSizeUpdatesDisabledCount;
+ unsigned _viewInWindowChangesDeferredCount;
+ BOOL _viewInWindowChangeWasDeferred;
+
// Whether the containing window of the WKView has a valid backing store.
// The window server invalidates the backing store whenever the window is resized or minimized.
// We use this flag to determine when we need to paint the background (white or clear)
@@ -1898,7 +1901,13 @@
_data->_windowHasValidBackingStore = NO;
[self _updateWindowVisibility];
_data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive);
- _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible | WebPageProxy::ViewIsInWindow);
+
+ if ([self isDeferringViewInWindowChanges]) {
+ _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
+ _data->_viewInWindowChangeWasDeferred = YES;
+ } else
+ _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible | WebPageProxy::ViewIsInWindow);
+
[self _updateWindowAndViewFrames];
if (!_data->_flagsChangedEventMonitor) {
@@ -1912,8 +1921,13 @@
} else {
[self _updateWindowVisibility];
_data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible);
- _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive | WebPageProxy::ViewIsInWindow);
+ if ([self isDeferringViewInWindowChanges]) {
+ _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive);
+ _data->_viewInWindowChangeWasDeferred = YES;
+ } else
+ _data->_page->viewStateDidChange(WebPageProxy::ViewWindowIsActive | WebPageProxy::ViewIsInWindow);
+
[NSEvent removeMonitor:_data->_flagsChangedEventMonitor];
_data->_flagsChangedEventMonitor = nil;
@@ -3282,6 +3296,31 @@
return nil;
}
+- (void)beginDeferringViewInWindowChanges
+{
+ _data->_viewInWindowChangesDeferredCount++;
+}
+
+- (void)endDeferringViewInWindowChanges
+{
+ if (!_data->_viewInWindowChangesDeferredCount) {
+ NSLog(@"endDeferringViewInWindowChanges was called without a matching beginDeferringViewInWindowChanges!");
+ return;
+ }
+
+ --_data->_viewInWindowChangesDeferredCount;
+
+ if (!_data->_viewInWindowChangesDeferredCount && _data->_viewInWindowChangeWasDeferred) {
+ _data->_page->viewStateDidChange(WebPageProxy::ViewIsInWindow);
+ _data->_viewInWindowChangeWasDeferred = NO;
+ }
+}
+
+- (BOOL)isDeferringViewInWindowChanges
+{
+ return _data->_viewInWindowChangesDeferredCount;
+}
+
@end
@implementation WKResponderChainSink
Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h (143557 => 143558)
--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h 2013-02-21 03:50:51 UTC (rev 143557)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h 2013-02-21 03:51:40 UTC (rev 143558)
@@ -55,4 +55,8 @@
- (NSView*)fullScreenPlaceholderView;
+- (void)beginDeferringViewInWindowChanges;
+- (void)endDeferringViewInWindowChanges;
+- (BOOL)isDeferringViewInWindowChanges;
+
@end
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes