Title: [153459] branches/safari-537-branch/Source/WebKit2

Diff

Modified: branches/safari-537-branch/Source/WebKit2/ChangeLog (153458 => 153459)


--- branches/safari-537-branch/Source/WebKit2/ChangeLog	2013-07-30 04:45:06 UTC (rev 153458)
+++ branches/safari-537-branch/Source/WebKit2/ChangeLog	2013-07-30 04:51:50 UTC (rev 153459)
@@ -1,5 +1,52 @@
 2013-07-29  Lucas Forschler  <[email protected]>
 
+        Merge r153458
+
+    2013-07-29  Tim Horton  <[email protected]>
+
+            [wk2] Flush the WebProcess’ implicit transaction when using endDeferringViewInWindowChangesSync
+            https://bugs.webkit.org/show_bug.cgi?id=119225
+            <rdar://problem/14568841>
+
+            Reviewed by Simon Fraser.
+
+            Tell CoreAnimation to flush the implicit transaction before replying
+            when using endDeferringViewInWindowChangesSync, as that method's contract
+            is that the WebProcess is totally ready to be in-window when it returns.
+
+            * UIProcess/API/mac/WKView.mm:
+            (-[WKView endDeferringViewInWindowChanges]):
+            Adopt viewInWindowStateDidChange.
+
+            (-[WKView endDeferringViewInWindowChangesSync]):
+            Adopt viewInWindowStateDidChange, asking it to send a reply only if we're going to wait for one.
+
+            * UIProcess/WebPageProxy.cpp:
+            (WebKit::WebPageProxy::viewInWindowStateDidChange):
+            (WebKit::WebPageProxy::viewStateDidChange):
+            Pull viewInWindowStateDidChange out of viewStateDidChange.
+            Request a reply from SetIsInWindow if we're told to.
+
+            * UIProcess/WebPageProxy.h: Add WantsReplyOrNot and viewInWindowStateDidChange.
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::didUpdateInWindowStateTimerFired):
+            Don't build this version on Mac, we'll have a WebPageMac version.
+
+            (WebKit::WebPage::setIsInWindow):
+            Only start the timer to send the didUpdateInWindowState reply if we're asked to.
+
+            * WebProcess/WebPage/WebPage.h:
+            * WebProcess/WebPage/WebPage.messages.in:
+            Add an argument to the SetIsInWindow message for whether the WebProcess
+            should inform the UIProcess when SetIsInWindow completes or not.
+
+            * WebProcess/WebPage/mac/WebPageMac.mm:
+            (WebKit::WebPage::didUpdateInWindowStateTimerFired):
+            Tell CA to flush the implicit transaction before telling the UIProcess that
+            we're finished moving in-window.
+
+2013-07-29  Lucas Forschler  <[email protected]>
+
         Merge r153449
 
     2013-07-29  Tim Horton  <[email protected]>

Modified: branches/safari-537-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm (153458 => 153459)


--- branches/safari-537-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm	2013-07-30 04:45:06 UTC (rev 153458)
+++ branches/safari-537-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm	2013-07-30 04:51:50 UTC (rev 153459)
@@ -3387,7 +3387,7 @@
     _data->_shouldDeferViewInWindowChanges = NO;
 
     if (_data->_viewInWindowChangeWasDeferred) {
-        _data->_page->viewStateDidChange(WebPageProxy::ViewIsInWindow);
+        _data->_page->viewInWindowStateDidChange();
         _data->_viewInWindowChangeWasDeferred = NO;
     }
 }
@@ -3402,8 +3402,13 @@
     PageClient* pageClient = _data->_pageClient.get();
     bool hasPendingViewInWindowChange = _data->_viewInWindowChangeWasDeferred && _data->_page->isInWindow() != pageClient->isViewInWindow();
 
-    [self endDeferringViewInWindowChanges];
+    _data->_shouldDeferViewInWindowChanges = NO;
 
+    if (_data->_viewInWindowChangeWasDeferred) {
+        _data->_page->viewInWindowStateDidChange(hasPendingViewInWindowChange ? WebPageProxy::WantsReplyOrNot::DoesWantReply : WebPageProxy::WantsReplyOrNot::DoesNotWantReply);
+        _data->_viewInWindowChangeWasDeferred = NO;
+    }
+
     if (hasPendingViewInWindowChange)
         _data->_page->waitForDidUpdateInWindowState();
 }

Modified: branches/safari-537-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp (153458 => 153459)


--- branches/safari-537-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-07-30 04:45:06 UTC (rev 153458)
+++ branches/safari-537-branch/Source/WebKit2/UIProcess/WebPageProxy.cpp	2013-07-30 04:51:50 UTC (rev 153459)
@@ -1035,6 +1035,26 @@
     m_pageClient->scrollView(scrollRect, scrollOffset);
 }
 
+void WebPageProxy::viewInWindowStateDidChange(WantsReplyOrNot wantsReply)
+{
+    if (!isValid())
+        return;
+
+    bool isInWindow = m_pageClient->isViewInWindow();
+    if (m_isInWindow != isInWindow) {
+        m_isInWindow = isInWindow;
+        m_process->send(Messages::WebPage::SetIsInWindow(isInWindow, wantsReply == WantsReplyOrNot::DoesWantReply), m_pageID);
+    }
+
+    if (isInWindow) {
+        LayerHostingMode layerHostingMode = m_pageClient->viewLayerHostingMode();
+        if (m_layerHostingMode != layerHostingMode) {
+            m_layerHostingMode = layerHostingMode;
+            m_drawingArea->layerHostingModeDidChange();
+        }
+    }
+}
+
 void WebPageProxy::viewStateDidChange(ViewStateFlags flags)
 {
     if (!isValid())
@@ -1067,22 +1087,9 @@
         }
     }
 
-    if (flags & ViewIsInWindow) {
-        bool isInWindow = m_pageClient->isViewInWindow();
-        if (m_isInWindow != isInWindow) {
-            m_isInWindow = isInWindow;
-            m_process->send(Messages::WebPage::SetIsInWindow(isInWindow), m_pageID);
-        }
+    if (flags & ViewIsInWindow)
+        viewInWindowStateDidChange();
 
-        if (isInWindow) {
-            LayerHostingMode layerHostingMode = m_pageClient->viewLayerHostingMode();
-            if (m_layerHostingMode != layerHostingMode) {
-                m_layerHostingMode = layerHostingMode;
-                m_drawingArea->layerHostingModeDidChange();
-            }
-        }
-    }
-
 #if ENABLE(PAGE_VISIBILITY_API)
     PageVisibilityState visibilityState = PageVisibilityStateHidden;
 

Modified: branches/safari-537-branch/Source/WebKit2/UIProcess/WebPageProxy.h (153458 => 153459)


--- branches/safari-537-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2013-07-30 04:45:06 UTC (rev 153458)
+++ branches/safari-537-branch/Source/WebKit2/UIProcess/WebPageProxy.h	2013-07-30 04:51:50 UTC (rev 153459)
@@ -343,6 +343,8 @@
     };
     typedef unsigned ViewStateFlags;
     void viewStateDidChange(ViewStateFlags flags);
+    enum class WantsReplyOrNot { DoesNotWantReply, DoesWantReply };
+    void viewInWindowStateDidChange(WantsReplyOrNot = WantsReplyOrNot::DoesNotWantReply);
     bool isInWindow() const { return m_isInWindow; }
     void waitForDidUpdateInWindowState();
 

Modified: branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (153458 => 153459)


--- branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-07-30 04:45:06 UTC (rev 153458)
+++ branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-07-30 04:51:50 UTC (rev 153459)
@@ -2128,10 +2128,12 @@
         m_page->setCanStartMedia(true);
 }
 
+#if !PLATFORM(MAC)
 void WebPage::didUpdateInWindowStateTimerFired()
 {
     send(Messages::WebPageProxy::DidUpdateInWindowState());
 }
+#endif
 
 inline bool WebPage::canHandleUserEvents() const
 {
@@ -2142,7 +2144,7 @@
     return true;
 }
 
-void WebPage::setIsInWindow(bool isInWindow)
+void WebPage::setIsInWindow(bool isInWindow, bool wantsDidUpdateViewInWindowState)
 {
     bool pageWasInWindow = m_page->isInWindow();
     
@@ -2167,7 +2169,9 @@
     }
 
     m_page->setIsInWindow(isInWindow);
-    m_sendDidUpdateInWindowStateTimer.startOneShot(0);
+
+    if (wantsDidUpdateViewInWindowState)
+        m_sendDidUpdateInWindowStateTimer.startOneShot(0);
 }
 
 void WebPage::didReceivePolicyDecision(uint64_t frameID, uint64_t listenerID, uint32_t policyAction, uint64_t downloadID)

Modified: branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h (153458 => 153459)


--- branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h	2013-07-30 04:45:06 UTC (rev 153458)
+++ branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h	2013-07-30 04:51:50 UTC (rev 153459)
@@ -714,7 +714,7 @@
     void setFocused(bool);
     void setInitialFocus(bool forward, bool isKeyboardEventValid, const WebKeyboardEvent&);
     void setWindowResizerSize(const WebCore::IntSize&);
-    void setIsInWindow(bool);
+    void setIsInWindow(bool isInWindow, bool wantsDidUpdateViewInWindowState = false);
     void validateCommand(const String&, uint64_t);
     void executeEditCommand(const String&);
 

Modified: branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (153458 => 153459)


--- branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2013-07-30 04:45:06 UTC (rev 153458)
+++ branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in	2013-07-30 04:51:50 UTC (rev 153459)
@@ -24,7 +24,7 @@
     SetActive(bool active)
     SetFocused(bool focused)
     SetInitialFocus(bool forward, bool isKeyboardEventValid, WebKit::WebKeyboardEvent event)
-    SetIsInWindow(bool isInWindow)
+    SetIsInWindow(bool isInWindow, bool wantsDidUpdateViewInWindowState)
 
     SetDrawsBackground(bool drawsBackground)
     SetDrawsTransparentBackground(bool drawsTransparentBackground)

Modified: branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (153458 => 153459)


--- branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2013-07-30 04:45:06 UTC (rev 153458)
+++ branches/safari-537-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2013-07-30 04:51:50 UTC (rev 153459)
@@ -980,4 +980,10 @@
     }
 }
 
+void WebPage::didUpdateInWindowStateTimerFired()
+{
+    [CATransaction flush];
+    send(Messages::WebPageProxy::DidUpdateInWindowState());
+}
+
 } // namespace WebKit
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to