Title: [132299] trunk/Source/WebCore
Revision
132299
Author
simon.fra...@apple.com
Date
2012-10-23 21:15:07 -0700 (Tue, 23 Oct 2012)

Log Message

Flush pending GraphicsLayer changes when reattaching compositing layers if necessary
https://bugs.webkit.org/show_bug.cgi?id=100187
<rdar://problem/12546770>

Reviewed by Dan Bernstein.

Fix a regression from r131940. That revision changed RenderLayerCompositor::flushPendingLayerChanges()
to bail if the root layer is unattached, which indicates that we're in the page cache, or in a
background tab. However, that dropped the layer flush on the floor, so that any subsequent changes
to GraphicsLayerCAs would just pile up and never get flushed. This was most evident on pages
that require frequent flushing, such as those running animated GIFs.

Fix by setting a flag in flushPendingLayerChanges() if we're unattached. Consult the flag
when re-attaching the root layer, and if it's set, flush the GraphicsLayers.

Not testable because we can't test detaching and re-adding web views in DRT/WTR.

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::RenderLayerCompositor): Initialize m_shouldFlushOnReattach to false.
(WebCore::RenderLayerCompositor::flushPendingLayerChanges): If the root layer attachment
is RootLayerUnattached, set the m_shouldFlushOnReattach flag before returning.
(WebCore::RenderLayerCompositor::attachRootLayer): If m_shouldFlushOnReattach, flush the layers,
saying that we're the flush root.
* rendering/RenderLayerCompositor.h:
(RenderLayerCompositor): Add m_shouldFlushOnReattach flag.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (132298 => 132299)


--- trunk/Source/WebCore/ChangeLog	2012-10-24 04:12:26 UTC (rev 132298)
+++ trunk/Source/WebCore/ChangeLog	2012-10-24 04:15:07 UTC (rev 132299)
@@ -1,3 +1,31 @@
+2012-10-23  Simon Fraser  <simon.fra...@apple.com>
+
+        Flush pending GraphicsLayer changes when reattaching compositing layers if necessary
+        https://bugs.webkit.org/show_bug.cgi?id=100187
+        <rdar://problem/12546770>
+
+        Reviewed by Dan Bernstein.
+
+        Fix a regression from r131940. That revision changed RenderLayerCompositor::flushPendingLayerChanges()
+        to bail if the root layer is unattached, which indicates that we're in the page cache, or in a
+        background tab. However, that dropped the layer flush on the floor, so that any subsequent changes
+        to GraphicsLayerCAs would just pile up and never get flushed. This was most evident on pages
+        that require frequent flushing, such as those running animated GIFs.
+        
+        Fix by setting a flag in flushPendingLayerChanges() if we're unattached. Consult the flag
+        when re-attaching the root layer, and if it's set, flush the GraphicsLayers.
+        
+        Not testable because we can't test detaching and re-adding web views in DRT/WTR.
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::RenderLayerCompositor): Initialize m_shouldFlushOnReattach to false.
+        (WebCore::RenderLayerCompositor::flushPendingLayerChanges): If the root layer attachment
+        is RootLayerUnattached, set the m_shouldFlushOnReattach flag before returning.
+        (WebCore::RenderLayerCompositor::attachRootLayer): If m_shouldFlushOnReattach, flush the layers,
+        saying that we're the flush root.
+        * rendering/RenderLayerCompositor.h:
+        (RenderLayerCompositor): Add m_shouldFlushOnReattach flag.
+
 2012-10-23  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r132276.

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (132298 => 132299)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-10-24 04:12:26 UTC (rev 132298)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2012-10-24 04:15:07 UTC (rev 132299)
@@ -186,6 +186,7 @@
     , m_compositing(false)
     , m_compositingLayersNeedRebuild(false)
     , m_flushingLayers(false)
+    , m_shouldFlushOnReattach(false)
     , m_forceCompositingMode(false)
     , m_rootLayerAttachment(RootLayerUnattached)
 #if !LOG_DISABLED
@@ -283,8 +284,10 @@
     if (!isFlushRoot && rootLayerAttachment() == RootLayerAttachedViaEnclosingFrame)
         return;
     
-    if (rootLayerAttachment() == RootLayerUnattached)
+    if (rootLayerAttachment() == RootLayerUnattached) {
+        m_shouldFlushOnReattach = true;
         return;
+    }
 
     AnimationUpdateBlock animationUpdateBlock(m_renderView->frameView()->frame()->animation());
 
@@ -2332,6 +2335,11 @@
 
     m_rootLayerAttachment = attachment;
     rootLayerAttachmentChanged();
+    
+    if (m_shouldFlushOnReattach) {
+        flushPendingLayerChanges(true);
+        m_shouldFlushOnReattach = false;
+    }
 }
 
 void RenderLayerCompositor::detachRootLayer()

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (132298 => 132299)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2012-10-24 04:12:26 UTC (rev 132298)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2012-10-24 04:15:07 UTC (rev 132299)
@@ -346,6 +346,7 @@
     bool m_compositing;
     bool m_compositingLayersNeedRebuild;
     bool m_flushingLayers;
+    bool m_shouldFlushOnReattach;
     bool m_forceCompositingMode;
 
     RootLayerAttachment m_rootLayerAttachment;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to