Sometimes, we want to move a WKView around in the hierarchy. Right now, if you remove a WKView and readd it elsewhere, you're likely to see a flash of white due to the asynchronous nature of the messages to the WebProcess (when a WebProcess is moved out-of-window, the TileCache unparents its tiles, among other things). We should provide a way to say "hang on a second, I might re-add you to the same window in a bit". I want to do this by simply providing a begin/end pair on WKView that - if you're inside a pair - we don't send WebPageProxy a viewStateDidChange with the ViewIsInWindow flag until you leave the last pair. <rdar://problem/13095405>
Created attachment 189425 [details] patch
Comment on attachment 189425 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=189425&action=review Let's try some new names. > Source/WebKit2/UIProcess/API/mac/WKView.mm:211 > + unsigned _windowChangesDeferredCount; viewInWindowDeferredCount? > Source/WebKit2/UIProcess/API/mac/WKView.mm:1907 > + if ([self windowChangesDeferred]) { > + _data->_page->viewStateDidChange(WebPageProxy::ViewIsVisible); > + _data->_windowChangeWasDeferred = YES; The naming makes this confusing. It's easy to think that -windowChangesDeferred would return data->_windowChangeWasDeferred. > Source/WebKit2/UIProcess/API/mac/WKViewPrivate.h:60 > +- (BOOL)windowChangesDeferred; How about: -beginDeferringViewInWindowChanges -endDeferringViewInWindowChanges -shouldDeferViewInWindowChanges
Created attachment 189444 [details] new names
Comment on attachment 189444 [details] new names View in context: https://bugs.webkit.org/attachment.cgi?id=189444&action=review > Source/WebKit2/UIProcess/API/mac/WKView.mm:213 > + BOOL _windowChangeWasDeferred; Want to rename this to 'viewInWindowChangeWasDeferred'? > Source/WebKit2/UIProcess/API/mac/WKView.mm:3306 > + if (!(--_data->_viewInWindowChangesDeferredCount) && _data->_windowChangeWasDeferred) { Would be clearer to just hoist the --_data->_viewInWindowChangesDeferredCount outside the condition.
http://trac.webkit.org/changeset/143558