Title: [141221] trunk/Source/WebCore
Revision
141221
Author
simon.fra...@apple.com
Date
2013-01-29 21:37:21 -0800 (Tue, 29 Jan 2013)

Log Message

Rubberband scrolling on news.google.com causes text to blink repeatedly
https://bugs.webkit.org/show_bug.cgi?id=107326

Reviewed by Beth Dakin.

When in the middle of layout, RenderBlock::updateScrollInfoAfterLayout()
could cause us to re-evaluate reasons for compositing, via the call
to updateLayerCompositingState() in RenderLayer::updateScrollInfoAfterLayout().

At this time, when layout is still happening, it's bad to look at render
geometry to decide when to do compositing (e.g. for fixed position); we might
incorrectly conclude that the layer is outside the viewport.

Fix by having RenderLayerCompositing store in a member whether it's safe
to look at layout information. requiresCompositingForPosition() then consults
this bit, and, if it needs to make decisions based on layout but layout is not
complete, it doesn't change the compositing state of the layer.

Not testable, since dumping the layer tree will update layout and mask the bug.

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::RenderLayerCompositor):
(WebCore::RenderLayerCompositor::updateCompositingLayers):
(WebCore::RenderLayerCompositor::requiresCompositingForPosition):
* rendering/RenderLayerCompositor.h:
(RenderLayerCompositor):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (141220 => 141221)


--- trunk/Source/WebCore/ChangeLog	2013-01-30 05:36:12 UTC (rev 141220)
+++ trunk/Source/WebCore/ChangeLog	2013-01-30 05:37:21 UTC (rev 141221)
@@ -1,3 +1,32 @@
+2013-01-29  Simon Fraser  <simon.fra...@apple.com>
+
+        Rubberband scrolling on news.google.com causes text to blink repeatedly
+        https://bugs.webkit.org/show_bug.cgi?id=107326
+
+        Reviewed by Beth Dakin.
+
+        When in the middle of layout, RenderBlock::updateScrollInfoAfterLayout()
+        could cause us to re-evaluate reasons for compositing, via the call
+        to updateLayerCompositingState() in RenderLayer::updateScrollInfoAfterLayout().
+        
+        At this time, when layout is still happening, it's bad to look at render
+        geometry to decide when to do compositing (e.g. for fixed position); we might
+        incorrectly conclude that the layer is outside the viewport.
+        
+        Fix by having RenderLayerCompositing store in a member whether it's safe
+        to look at layout information. requiresCompositingForPosition() then consults
+        this bit, and, if it needs to make decisions based on layout but layout is not
+        complete, it doesn't change the compositing state of the layer.
+        
+        Not testable, since dumping the layer tree will update layout and mask the bug.
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::RenderLayerCompositor):
+        (WebCore::RenderLayerCompositor::updateCompositingLayers):
+        (WebCore::RenderLayerCompositor::requiresCompositingForPosition):
+        * rendering/RenderLayerCompositor.h:
+        (RenderLayerCompositor):
+
 2013-01-29  Mark Lam  <mark....@apple.com>
 
         Introducing WTF::TypeSafeEnum and DatabaseError.

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (141220 => 141221)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2013-01-30 05:36:12 UTC (rev 141220)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2013-01-30 05:37:21 UTC (rev 141221)
@@ -61,6 +61,7 @@
 #include "TransformState.h"
 #include "WebCoreMemoryInstrumentation.h"
 #include <wtf/MemoryInstrumentationHashMap.h>
+#include <wtf/TemporaryChange.h>
 
 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
 #include "HTMLMediaElement.h"
@@ -200,6 +201,7 @@
     , m_flushingLayers(false)
     , m_shouldFlushOnReattach(false)
     , m_forceCompositingMode(false)
+    , m_inPostLayoutUpdate(false)
     , m_isTrackingRepaints(false)
     , m_rootLayerAttachment(RootLayerUnattached)
 #if !LOG_DISABLED
@@ -418,6 +420,8 @@
 
     AnimationUpdateBlock animationUpdateBlock(m_renderView->frameView()->frame()->animation());
 
+    TemporaryChange<bool> postLayoutChange(m_inPostLayoutUpdate, true);
+    
     bool checkForHierarchyUpdate = m_reevaluateCompositingAfterLayout;
     bool needGeometryUpdate = false;
 
@@ -2065,6 +2069,12 @@
             *viewportConstrainedNotCompositedReason = RenderLayer::NotCompositedForNonViewContainer;
         return false;
     }
+    
+    // Subsequent tests depend on layout. If we can't tell now, just keep things the way they are until layout is done.
+    if (!m_inPostLayoutUpdate) {
+        m_reevaluateCompositingAfterLayout = true;
+        return layer->isComposited();
+    }
 
     // Fixed position elements that are invisible in the current view don't get their own layer.
     if (FrameView* frameView = m_renderView->frameView()) {
@@ -2075,18 +2085,13 @@
         if (!viewBounds.intersects(enclosingIntRect(layerBounds))) {
             if (viewportConstrainedNotCompositedReason)
                 *viewportConstrainedNotCompositedReason = RenderLayer::NotCompositedForBoundsOutOfView;
-            // Reevaluate compositing after layout because the layer bounds may change and become composited.
-            m_reevaluateCompositingAfterLayout = true;
             return false;
         }
     }
     
     bool paintsContent = layer->isVisuallyNonEmpty() || layer->hasVisibleDescendant();
-    if (!paintsContent) {
-        // isVisuallyNonEmpty() depends on layout.
-        m_reevaluateCompositingAfterLayout = true;
+    if (!paintsContent)
         return false;
-    }
 
     return true;
 }

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (141220 => 141221)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2013-01-30 05:36:12 UTC (rev 141220)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2013-01-30 05:37:21 UTC (rev 141221)
@@ -366,6 +366,7 @@
     bool m_flushingLayers;
     bool m_shouldFlushOnReattach;
     bool m_forceCompositingMode;
+    bool m_inPostLayoutUpdate; // true when it's OK to trust layout information (e.g. layer sizes and positions)
 
     bool m_isTrackingRepaints; // Used for testing.
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to