Title: [135019] trunk/Source/WebCore
Revision
135019
Author
simon.fra...@apple.com
Date
2012-11-16 17:06:53 -0800 (Fri, 16 Nov 2012)

Log Message

Don't update layer positions on scrolling if we're in the middle of layout
https://bugs.webkit.org/show_bug.cgi?id=102556

Reviewed by Dan Bernstein.

RenderLayer::scrollTo() can be called in the middle of layout. When
that happens we should not waste time updating layer positions,
compositing layers, or widget positions, because we'll do those at the
end of layout anyway.

This prevents us from having inconsistent RenderLayer state, which
hinders future optimizations in this area.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::scrollTo):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (135018 => 135019)


--- trunk/Source/WebCore/ChangeLog	2012-11-17 00:52:27 UTC (rev 135018)
+++ trunk/Source/WebCore/ChangeLog	2012-11-17 01:06:53 UTC (rev 135019)
@@ -1,3 +1,21 @@
+2012-11-16  Simon Fraser  <simon.fra...@apple.com>
+
+        Don't update layer positions on scrolling if we're in the middle of layout
+        https://bugs.webkit.org/show_bug.cgi?id=102556
+
+        Reviewed by Dan Bernstein.
+
+        RenderLayer::scrollTo() can be called in the middle of layout. When
+        that happens we should not waste time updating layer positions,
+        compositing layers, or widget positions, because we'll do those at the
+        end of layout anyway.
+        
+        This prevents us from having inconsistent RenderLayer state, which
+        hinders future optimizations in this area.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::scrollTo):
+
 2012-11-16  Tony Chang  <t...@chromium.org>
 
         Remove ENABLE_CSS_HIERARCHIES since it's no longer in use

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (135018 => 135019)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-11-17 00:52:27 UTC (rev 135018)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2012-11-17 01:06:53 UTC (rev 135019)
@@ -1733,31 +1733,34 @@
     Frame* frame = renderer()->frame();
     InspectorInstrumentation::willScrollLayer(frame);
 
-    // Update the positions of our child layers (if needed as only fixed layers should be impacted by a scroll).
-    // We don't update compositing layers, because we need to do a deep update from the compositing ancestor.
-    updateLayerPositionsAfterScroll();
-
     RenderView* view = renderer()->view();
     
     // We should have a RenderView if we're trying to scroll.
     ASSERT(view);
-    if (view) {
-        // Update regions, scrolling may change the clip of a particular region.
+
+    // Update the positions of our child layers (if needed as only fixed layers should be impacted by a scroll).
+    // We don't update compositing layers, because we need to do a deep update from the compositing ancestor.
+    bool inLayout = view ? view->frameView()->isInLayout() : false;
+    if (!inLayout) {
+        // If we're in the middle of layout, we'll just update layers once layout has finished.
+        updateLayerPositionsAfterScroll();
+        if (view) {
+            // Update regions, scrolling may change the clip of a particular region.
 #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(DRAGGABLE_REGION)
-        view->frameView()->updateAnnotatedRegions();
+            view->frameView()->updateAnnotatedRegions();
 #endif
+            view->updateWidgetPositions();
+        }
 
-        view->updateWidgetPositions();
+        if (!m_updatingMarqueePosition) {
+            // Avoid updating compositing layers if, higher on the stack, we're already updating layer
+            // positions. Updating layer positions requires a full walk of up-to-date RenderLayers, and
+            // in this case we're still updating their positions; we'll update compositing layers later
+            // when that completes.
+            updateCompositingLayersAfterScroll();
+        }
     }
 
-    if (!m_updatingMarqueePosition) {
-        // Avoid updating compositing layers if, higher on the stack, we're already updating layer
-        // positions. Updating layer positions requires a full walk of up-to-date RenderLayers, and
-        // in this case we're still updating their positions; we'll update compositing layers later
-        // when that completes.
-        updateCompositingLayersAfterScroll();
-    }
-
     RenderLayerModelObject* repaintContainer = renderer()->containerForRepaint();
     if (frame) {
         // The caret rect needs to be invalidated after scrolling
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to