Fix paint-related milestones to not fire when the layer tree is frozen
authorsimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 May 2013 04:34:35 +0000 (04:34 +0000)
committersimon.fraser@apple.com <simon.fraser@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 May 2013 04:34:35 +0000 (04:34 +0000)
https://bugs.webkit.org/show_bug.cgi?id=117012

Source/WebCore:

Reviewed by Tim Horton.

In the previous code, it was possible to paint some layer and schedule
the m_paintRelatedMilestonesTimer, but then the layer tree was put into
a frozen state because the page redirected. However, the paint-related
milestones timer would still fire. This caused woes with header/footer
banners.

Fix by not firing paint-related milestones if the layer tree is frozen,
which we know via a new ChromeClient callback. When unfrozen, we'll
paint again, and fire the timer later.

* page/ChromeClient.h:
(WebCore::ChromeClient::layerTreeStateIsFrozen):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::paintRelatedMilestonesTimerFired):

Source/WebKit2:

Reviewed by Tim Horton.

Implement ChromeClient::layerTreeStateIsFrozen() to return
the frozen state of the drawing area.

* WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::layerTreeStateIsFrozen):
* WebProcess/WebCoreSupport/WebChromeClient.h:
(WebChromeClient):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@150948 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/page/ChromeClient.h
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.h

index fbb47bd..df56890 100644 (file)
@@ -1,3 +1,25 @@
+2013-05-29  Simon Fraser  <simon.fraser@apple.com>
+
+        Fix paint-related milestones to not fire when the layer tree is frozen
+        https://bugs.webkit.org/show_bug.cgi?id=117012
+
+        Reviewed by Tim Horton.
+
+        In the previous code, it was possible to paint some layer and schedule
+        the m_paintRelatedMilestonesTimer, but then the layer tree was put into
+        a frozen state because the page redirected. However, the paint-related
+        milestones timer would still fire. This caused woes with header/footer
+        banners.
+        
+        Fix by not firing paint-related milestones if the layer tree is frozen,
+        which we know via a new ChromeClient callback. When unfrozen, we'll
+        paint again, and fire the timer later.
+
+        * page/ChromeClient.h:
+        (WebCore::ChromeClient::layerTreeStateIsFrozen):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::paintRelatedMilestonesTimerFired):
+
 2013-05-29  Ryosuke Niwa  <rniwa@webkit.org>
 
         Store form control list with RefPtr
index 28f4371..a8bf177 100644 (file)
@@ -271,6 +271,9 @@ public:
 
     // Returns a bitfield indicating conditions that can trigger the compositor.
     virtual CompositingTriggerFlags allowedCompositingTriggers() const { return static_cast<CompositingTriggerFlags>(AllTriggers); }
+    
+    // Returns true if layer tree updates are disabled.
+    virtual bool layerTreeStateIsFrozen() const { return false; }
 #endif
 
 #if PLATFORM(WIN) && USE(AVFOUNDATION)
index 41d1a3b..5dc937e 100644 (file)
@@ -3252,8 +3252,19 @@ void RenderLayerCompositor::layerFlushTimerFired(Timer<RenderLayerCompositor>*)
 void RenderLayerCompositor::paintRelatedMilestonesTimerFired(Timer<RenderLayerCompositor>*)
 {
     FrameView* frameView = m_renderView ? m_renderView->frameView() : 0;
-    if (frameView)
-        frameView->firePaintRelatedMilestones();
+    if (!frameView)
+        return;
+
+    Frame* frame = frameView->frame();
+    Page* page = frame ? frame->page() : 0;
+    if (!page)
+        return;
+
+    // If the layer tree is frozen, we'll paint when it's unfrozen and schedule the timer again.
+    if (page->chrome().client()->layerTreeStateIsFrozen())
+        return;
+
+    frameView->firePaintRelatedMilestones();
 }
 
 } // namespace WebCore
index ad6521e..9de0616 100644 (file)
@@ -1,3 +1,18 @@
+2013-05-29  Simon Fraser  <simon.fraser@apple.com>
+
+        Fix paint-related milestones to not fire when the layer tree is frozen
+        https://bugs.webkit.org/show_bug.cgi?id=117012
+
+        Reviewed by Tim Horton.
+        
+        Implement ChromeClient::layerTreeStateIsFrozen() to return
+        the frozen state of the drawing area.
+
+        * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+        (WebKit::WebChromeClient::layerTreeStateIsFrozen):
+        * WebProcess/WebCoreSupport/WebChromeClient.h:
+        (WebChromeClient):
+
 2013-05-29  Anders Carlsson  <andersca@apple.com>
 
         WebKit should expose HSTS APIs to determine whether a host is in the HSTS cache and to reset HSTS policies
index 873dbcc..ef55930 100644 (file)
@@ -781,6 +781,14 @@ void WebChromeClient::scheduleCompositingLayerFlush()
         m_page->drawingArea()->scheduleCompositingLayerFlush();
 }
 
+
+bool WebChromeClient::layerTreeStateIsFrozen() const
+{
+    if (m_page->drawingArea())
+        return m_page->drawingArea()->layerTreeStateIsFrozen();
+
+    return false;
+}
 #endif
 
 #if ENABLE(TOUCH_EVENTS)
index 4ef29b5..4f28bb3 100644 (file)
@@ -194,6 +194,8 @@ private:
             CanvasTrigger |
             AnimationTrigger);
     }
+
+    virtual bool layerTreeStateIsFrozen() const OVERRIDE;
 #endif
 
 #if ENABLE(TOUCH_EVENTS)