Title: [87973] branches/safari-534-branch/Source/WebKit2

Diff

Modified: branches/safari-534-branch/Source/WebKit2/ChangeLog (87972 => 87973)


--- branches/safari-534-branch/Source/WebKit2/ChangeLog	2011-06-03 00:44:59 UTC (rev 87972)
+++ branches/safari-534-branch/Source/WebKit2/ChangeLog	2011-06-03 00:46:03 UTC (rev 87973)
@@ -1,3 +1,59 @@
+2011-06-02  Lucas Forschler  <[email protected]>
+
+    Merged 87755.
+
+    2011-05-31  Dan Bernstein  <[email protected]>
+
+        Reviewed by Simon Fraser.
+
+        <rdar://problem/9523192> REGRESSION (5.0.5-ToT, WebKit2): Flash to white when navigating between pages on wsj.com, other sites (when navigating away from composited page)
+        https://bugs.webkit.org/show_bug.cgi?id=61808
+
+        WebKit1 has a mechanism to prevent the stale bits from the outgoing page from being erased
+        until the incoming page has layout. Adapt this in WebKit2 to prevent the composited layer tree
+        of the outgoing page from being torn down or updated until the incoming page has layout.
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::dispatchDidFirstLayout): Unfreeze the layer tree state.
+        (WebKit::WebFrameLoaderClient::frameLoadCompleted): Ditto.
+        (WebKit::WebFrameLoaderClient::provisionalLoadStarted): Freeze the layer tree state.
+
+        * WebProcess/WebPage/DrawingArea.h:
+        (WebKit::DrawingArea::setLayerTreeStateIsFrozen): Added.
+
+        * WebProcess/WebPage/DrawingAreaImpl.cpp:
+        (WebKit::DrawingAreaImpl::DrawingAreaImpl): Initialize new member variables.
+        (WebKit::DrawingAreaImpl::setLayerTreeStateIsFrozen): Added. When freezing, sets the flag and
+        disables layer flush scheduling and exiting accelerated compositing mode. When unfreezing,
+        clears the flag and exits compositing mode if needed.
+        (WebKit::DrawingAreaImpl::setRootCompositingLayer): Reset m_wantsToExitAcceleratedCompositingMode.
+        (WebKit::DrawingAreaImpl::enterAcceleratedCompositingMode): Ditto.
+        (WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode): Ditto.
+        (WebKit::DrawingAreaImpl::exitAcceleratedCompositingModeSoon): If the layer tree state is frozen,
+        bail out but set m_wantsToExitAcceleratedCompositingMode.
+
+        * WebProcess/WebPage/DrawingAreaImpl.h:
+        * WebProcess/WebPage/LayerTreeHost.h:
+
+        * WebProcess/WebPage/ca/LayerTreeHostCA.cpp:
+        (WebKit::LayerTreeHostCA::LayerTreeHostCA): Initialize m_layerFlushSchedulingEnabled.
+
+        * WebProcess/WebPage/ca/LayerTreeHostCA.h:
+        * WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.h:
+
+        * WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm:
+        (WebKit::LayerTreeHostCAMac::scheduleLayerFlush): Bail out if scheduling is not enabled.
+        (WebKit::LayerTreeHostCAMac::setLayerFlushSchedulingEnabled): Added. Sets the flag. If disabling
+        flushing, cancels the pending flush.
+        (WebKit::LayerTreeHostCAMac::flushPendingLayerChangesRunLoopObserverCallback): Added an assertion.
+
+        * WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp:
+        (WebKit::LayerTreeHostCAWin::scheduleLayerFlush): Bail out if scheduling is not enabled.
+        (WebKit::LayerTreeHostCAWin::setLayerFlushSchedulingEnabled): Added. Sets the flag. If disabling
+        flushing, cancels the pending flush.
+
+        * WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h:
+
 2011-05-29  Mark Rowe  <[email protected]>
 
         Merge r87654.

Modified: branches/safari-534-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (87972 => 87973)


--- branches/safari-534-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2011-06-03 00:44:59 UTC (rev 87972)
+++ branches/safari-534-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2011-06-03 00:46:03 UTC (rev 87973)
@@ -535,6 +535,9 @@
 
     // Notify the UIProcess.
     webPage->send(Messages::WebPageProxy::DidFirstLayoutForFrame(m_frame->frameID(), InjectedBundleUserMessageEncoder(userData.get())));
+
+    if (m_frame == m_frame->page()->mainFrame())
+        webPage->drawingArea()->setLayerTreeStateIsFrozen(false);
 }
 
 void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout()
@@ -1020,7 +1023,12 @@
 
 void WebFrameLoaderClient::frameLoadCompleted()
 {
-    notImplemented();
+    WebPage* webPage = m_frame->page();
+    if (!webPage)
+        return;
+
+    if (m_frame == m_frame->page()->mainFrame())
+        webPage->drawingArea()->setLayerTreeStateIsFrozen(false);
 }
 
 void WebFrameLoaderClient::saveViewStateToItem(HistoryItem*)
@@ -1042,7 +1050,12 @@
 
 void WebFrameLoaderClient::provisionalLoadStarted()
 {
-    notImplemented();
+    WebPage* webPage = m_frame->page();
+    if (!webPage)
+        return;
+
+    if (m_frame == m_frame->page()->mainFrame())
+        webPage->drawingArea()->setLayerTreeStateIsFrozen(true);
 }
 
 void WebFrameLoaderClient::didFinishLoad()

Modified: branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (87972 => 87973)


--- branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2011-06-03 00:44:59 UTC (rev 87972)
+++ branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/DrawingArea.h	2011-06-03 00:46:03 UTC (rev 87973)
@@ -61,6 +61,7 @@
     // FIXME: These should be pure virtual.
     virtual void pageBackgroundTransparencyChanged() { }
     virtual void forceRepaint() { }
+    virtual void setLayerTreeStateIsFrozen(bool) { }
 
     virtual void didInstallPageOverlay() { }
     virtual void didUninstallPageOverlay() { }

Modified: branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp (87972 => 87973)


--- branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp	2011-06-03 00:44:59 UTC (rev 87972)
+++ branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp	2011-06-03 00:46:03 UTC (rev 87973)
@@ -60,6 +60,8 @@
     , m_shouldSendDidUpdateBackingStoreState(false)
     , m_isWaitingForDidUpdate(false)
     , m_compositingAccordingToProxyMessages(false)
+    , m_layerTreeStateIsFrozen(false)
+    , m_wantsToExitAcceleratedCompositingMode(false)
     , m_isPaintingSuspended(!parameters.isVisible)
     , m_alwaysUseCompositing(false)
     , m_lastDisplayTime(0)
@@ -149,6 +151,22 @@
     m_scrollOffset += scrollOffset;
 }
 
+void DrawingAreaImpl::setLayerTreeStateIsFrozen(bool isFrozen)
+{
+    if (m_layerTreeStateIsFrozen == isFrozen)
+        return;
+
+    m_layerTreeStateIsFrozen = isFrozen;
+
+    if (m_layerTreeHost)
+        m_layerTreeHost->setLayerFlushSchedulingEnabled(!isFrozen);
+
+    if (isFrozen)
+        m_exitCompositingTimer.stop();
+    else if (m_wantsToExitAcceleratedCompositingMode)
+        exitAcceleratedCompositingModeSoon();
+}
+
 void DrawingAreaImpl::forceRepaint()
 {
     setNeedsDisplay(m_webPage->bounds());
@@ -247,6 +265,7 @@
             // We're already in accelerated compositing mode, but the root compositing layer changed.
 
             m_exitCompositingTimer.stop();
+            m_wantsToExitAcceleratedCompositingMode = false;
 
             // If we haven't sent the EnterAcceleratedCompositingMode message, make sure that the
             // layer tree host calls us back after the next layer flush so we can send it then.
@@ -404,6 +423,7 @@
 void DrawingAreaImpl::enterAcceleratedCompositingMode(GraphicsLayer* graphicsLayer)
 {
     m_exitCompositingTimer.stop();
+    m_wantsToExitAcceleratedCompositingMode = false;
 
     ASSERT(!m_layerTreeHost);
 
@@ -429,7 +449,10 @@
     if (m_alwaysUseCompositing)
         return;
 
+    ASSERT(!m_layerTreeStateIsFrozen);
+
     m_exitCompositingTimer.stop();
+    m_wantsToExitAcceleratedCompositingMode = false;
 
     ASSERT(m_layerTreeHost);
 
@@ -476,6 +499,11 @@
 
 void DrawingAreaImpl::exitAcceleratedCompositingModeSoon()
 {
+    if (m_layerTreeStateIsFrozen) {
+        m_wantsToExitAcceleratedCompositingMode = true;
+        return;
+    }
+
     if (exitAcceleratedCompositingModePending())
         return;
 

Modified: branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h (87972 => 87973)


--- branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h	2011-06-03 00:44:59 UTC (rev 87972)
+++ branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h	2011-06-03 00:46:03 UTC (rev 87973)
@@ -49,6 +49,7 @@
     // DrawingArea
     virtual void setNeedsDisplay(const WebCore::IntRect&);
     virtual void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
+    virtual void setLayerTreeStateIsFrozen(bool);
     virtual void forceRepaint();
 
     virtual void didInstallPageOverlay();
@@ -98,6 +99,14 @@
     // True between sending the 'enter compositing' messages, and the 'exit compositing' message.
     bool m_compositingAccordingToProxyMessages;
 
+    // When true, we maintain the layer tree in its current state by not leaving accelerated compositing mode
+    // and not scheduling layer flushes.
+    bool m_layerTreeStateIsFrozen;
+
+    // True when we were asked to exit accelerated compositing mode but couldn't because layer tree
+    // state was frozen.
+    bool m_wantsToExitAcceleratedCompositingMode;
+
     // Whether painting is suspended. We'll still keep track of the dirty region but we 
     // won't paint until painting has resumed again.
     bool m_isPaintingSuspended;

Modified: branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h (87972 => 87973)


--- branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h	2011-06-03 00:44:59 UTC (rev 87972)
+++ branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h	2011-06-03 00:46:03 UTC (rev 87973)
@@ -50,6 +50,7 @@
 
     virtual const LayerTreeContext& layerTreeContext() = 0;
     virtual void scheduleLayerFlush() = 0;
+    virtual void setLayerFlushSchedulingEnabled(bool) = 0;
     virtual void setShouldNotifyAfterNextScheduledLayerFlush(bool) = 0;
     virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) = 0;
     virtual void invalidate() = 0;

Modified: branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp (87972 => 87973)


--- branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp	2011-06-03 00:44:59 UTC (rev 87972)
+++ branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.cpp	2011-06-03 00:46:03 UTC (rev 87973)
@@ -42,6 +42,7 @@
 
 LayerTreeHostCA::LayerTreeHostCA(WebPage* webPage)
     : LayerTreeHost(webPage)
+    , m_layerFlushSchedulingEnabled(true)
     , m_isValid(true)
     , m_notifyAfterScheduledLayerFlush(false)
 {

Modified: branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h (87972 => 87973)


--- branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h	2011-06-03 00:44:59 UTC (rev 87972)
+++ branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/LayerTreeHostCA.h	2011-06-03 00:46:03 UTC (rev 87973)
@@ -54,6 +54,8 @@
     // LayerTreeHostCA
     virtual void didPerformScheduledLayerFlush();
 
+    bool m_layerFlushSchedulingEnabled;
+
 private:
     // LayerTreeHost.
     virtual const LayerTreeContext& layerTreeContext();

Modified: branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.h (87972 => 87973)


--- branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.h	2011-06-03 00:44:59 UTC (rev 87972)
+++ branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.h	2011-06-03 00:46:03 UTC (rev 87973)
@@ -43,6 +43,7 @@
 
     // LayerTreeHost.
     virtual void scheduleLayerFlush();
+    virtual void setLayerFlushSchedulingEnabled(bool);
     virtual void invalidate();
     virtual void sizeDidChange(const WebCore::IntSize& newSize);
     virtual void forceRepaint();

Modified: branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm (87972 => 87973)


--- branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm	2011-06-03 00:44:59 UTC (rev 87972)
+++ branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/mac/LayerTreeHostCAMac.mm	2011-06-03 00:46:03 UTC (rev 87973)
@@ -69,6 +69,9 @@
 
 void LayerTreeHostCAMac::scheduleLayerFlush()
 {
+    if (!m_layerFlushSchedulingEnabled)
+        return;
+
     CFRunLoopRef currentRunLoop = CFRunLoopGetCurrent();
     
     // Make sure we wake up the loop or the observer could be delayed until some other source fires.
@@ -85,6 +88,23 @@
     CFRunLoopAddObserver(currentRunLoop, m_flushPendingLayerChangesRunLoopObserver.get(), kCFRunLoopCommonModes);
 }
 
+void LayerTreeHostCAMac::setLayerFlushSchedulingEnabled(bool layerFlushingEnabled)
+{
+    if (m_layerFlushSchedulingEnabled == layerFlushingEnabled)
+        return;
+
+    m_layerFlushSchedulingEnabled = layerFlushingEnabled;
+
+    if (m_layerFlushSchedulingEnabled)
+        return;
+
+    if (!m_flushPendingLayerChangesRunLoopObserver)
+        return;
+
+    CFRunLoopObserverInvalidate(m_flushPendingLayerChangesRunLoopObserver.get());
+    m_flushPendingLayerChangesRunLoopObserver = nullptr;
+}
+
 void LayerTreeHostCAMac::invalidate()
 {
     if (m_flushPendingLayerChangesRunLoopObserver) {
@@ -128,9 +148,13 @@
 
 void LayerTreeHostCAMac::flushPendingLayerChangesRunLoopObserverCallback(CFRunLoopObserverRef, CFRunLoopActivity, void* context)
 {
+    LayerTreeHostCAMac* layerTreeHost = static_cast<LayerTreeHostCAMac*>(context);
+
+    ASSERT(layerTreeHost->m_layerFlushSchedulingEnabled);
+
     // This gets called outside of the normal event loop so wrap in an autorelease pool
     NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-    static_cast<LayerTreeHostCAMac*>(context)->performScheduledLayerFlush();
+    layerTreeHost->performScheduledLayerFlush();
     [pool drain];
 }
 

Modified: branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp (87972 => 87973)


--- branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp	2011-06-03 00:44:59 UTC (rev 87972)
+++ branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.cpp	2011-06-03 00:46:03 UTC (rev 87973)
@@ -136,9 +136,25 @@
 
 void LayerTreeHostCAWin::scheduleLayerFlush()
 {
+    if (!m_layerFlushSchedulingEnabled)
+        return;
+
     LayerChangesFlusher::shared().flushPendingLayerChangesSoon(this);
 }
 
+void LayerTreeHostCAWin::setLayerFlushSchedulingEnabled(bool layerFlushingEnabled)
+{
+    if (m_layerFlushSchedulingEnabled == layerFlushingEnabled)
+        return;
+
+    m_layerFlushSchedulingEnabled = layerFlushingEnabled;
+
+    if (m_layerFlushSchedulingEnabled)
+        return;
+
+    LayerChangesFlusher::shared().cancelPendingFlush(thus);
+}
+
 bool LayerTreeHostCAWin::participatesInDisplay()
 {
     return true;

Modified: branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h (87972 => 87973)


--- branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h	2011-06-03 00:44:59 UTC (rev 87972)
+++ branches/safari-534-branch/Source/WebKit2/WebProcess/WebPage/ca/win/LayerTreeHostCAWin.h	2011-06-03 00:46:03 UTC (rev 87973)
@@ -57,6 +57,7 @@
     virtual void forceRepaint();
     virtual void sizeDidChange(const WebCore::IntSize& newSize);
     virtual void scheduleLayerFlush();
+    virtual void setLayerFlushSchedulingEnabled(bool);
     virtual bool participatesInDisplay();
     virtual bool needsDisplay();
     virtual double timeUntilNextDisplay();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to