Title: [143417] trunk/Source/WebCore
Revision
143417
Author
simon.fra...@apple.com
Date
2013-02-19 17:29:39 -0800 (Tue, 19 Feb 2013)

Log Message

Rubber-banding should not affect the visibleRect of the TileCache
https://bugs.webkit.org/show_bug.cgi?id=110278

Reviewed by Beth Dakin.

When rubber-banding a slow-scrolling page, or image document, we would constantly re-create
the bottom tile because of the logic that adapts the tile size to the visible rect when slow
scrolling.

Avoid that by ensuring that the visibleRect is not affected by rubber-banding. This is done
via a GraphicsLayerClient function that allows RenderLayerCompositor to provide a custom
position for the scroll layer. We constrain that scroll position to remove the overhang that
results from rubber-banding.

I wasn't able to make a test for this, even with internals.setScrollViewPosition().

* platform/graphics/GraphicsLayerClient.h:
(GraphicsLayerClient):
(WebCore::GraphicsLayerClient::customPositionForVisibleRectComputation):
* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::computeVisibleRect):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::customPositionForVisibleRectComputation):
* rendering/RenderLayerCompositor.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143416 => 143417)


--- trunk/Source/WebCore/ChangeLog	2013-02-20 01:24:49 UTC (rev 143416)
+++ trunk/Source/WebCore/ChangeLog	2013-02-20 01:29:39 UTC (rev 143417)
@@ -1,3 +1,30 @@
+2013-02-19  Simon Fraser  <simon.fra...@apple.com>
+
+        Rubber-banding should not affect the visibleRect of the TileCache
+        https://bugs.webkit.org/show_bug.cgi?id=110278
+
+        Reviewed by Beth Dakin.
+        
+        When rubber-banding a slow-scrolling page, or image document, we would constantly re-create
+        the bottom tile because of the logic that adapts the tile size to the visible rect when slow
+        scrolling.
+        
+        Avoid that by ensuring that the visibleRect is not affected by rubber-banding. This is done
+        via a GraphicsLayerClient function that allows RenderLayerCompositor to provide a custom
+        position for the scroll layer. We constrain that scroll position to remove the overhang that
+        results from rubber-banding.
+
+        I wasn't able to make a test for this, even with internals.setScrollViewPosition().
+
+        * platform/graphics/GraphicsLayerClient.h:
+        (GraphicsLayerClient):
+        (WebCore::GraphicsLayerClient::customPositionForVisibleRectComputation):
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::computeVisibleRect):
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::customPositionForVisibleRectComputation):
+        * rendering/RenderLayerCompositor.h:
+
 2013-02-19  Tony Gentilcore  <to...@chromium.org>
 
         Fix crash in preloading scanning base tags with no href attribute for background parser

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h (143416 => 143417)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h	2013-02-20 01:24:49 UTC (rev 143416)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h	2013-02-20 01:29:39 UTC (rev 143417)
@@ -77,6 +77,10 @@
     // initialized to identity already. Returns false if the layer has no transform.
     virtual bool getCurrentTransform(const GraphicsLayer*, TransformationMatrix&) const { return false; }
 
+    // Allows the client to modify a layer position used during the visibleRect calculation, for example to ignore
+    // scroll overhang.
+    virtual void customPositionForVisibleRectComputation(const GraphicsLayer*, FloatPoint&) const { }
+
     // Multiplier for backing store size, related to high DPI.
     virtual float deviceScaleFactor() const { return 1; }
     // Page scale factor.

Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp (143416 => 143417)


--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2013-02-20 01:24:49 UTC (rev 143416)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp	2013-02-20 01:29:39 UTC (rev 143417)
@@ -917,8 +917,12 @@
     TransformState::TransformAccumulation accumulation = preserve3D ? TransformState::AccumulateTransform : TransformState::FlattenTransform;
 
     TransformationMatrix layerTransform;
-    layerTransform.translate(m_position.x(), m_position.y());
+    FloatPoint position = m_position;
+    if (m_client)
+        m_client->customPositionForVisibleRectComputation(this, position);
 
+    layerTransform.translate(position.x(), position.y());
+
     TransformationMatrix currentTransform;
     if (client() && client()->getCurrentTransform(this, currentTransform) && !currentTransform.isIdentity()) {
         FloatPoint3D absoluteAnchorPoint(anchorPoint());

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (143416 => 143417)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2013-02-20 01:24:49 UTC (rev 143416)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2013-02-20 01:29:39 UTC (rev 143417)
@@ -302,6 +302,20 @@
         m_compositingLayersNeedRebuild = needRebuild;
 }
 
+void RenderLayerCompositor::customPositionForVisibleRectComputation(const GraphicsLayer* graphicsLayer, FloatPoint& position) const
+{
+    if (graphicsLayer != m_scrollLayer.get())
+        return;
+
+    FrameView* frameView = m_renderView ? m_renderView->frameView() : 0;
+    if (!frameView)
+        return;
+
+    FloatPoint scrollPosition = -position;
+    scrollPosition = frameView->constrainScrollPositionForOverhang(roundedIntPoint(scrollPosition));
+    position = -scrollPosition;
+}
+
 void RenderLayerCompositor::scheduleLayerFlush()
 {
     if (Page* page = this->page())

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.h (143416 => 143417)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2013-02-20 01:24:49 UTC (rev 143416)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.h	2013-02-20 01:29:39 UTC (rev 143417)
@@ -249,6 +249,7 @@
     
     // GraphicsLayerUpdaterClient implementation
     virtual void flushLayers(GraphicsLayerUpdater*) OVERRIDE;
+    virtual void customPositionForVisibleRectComputation(const GraphicsLayer*, FloatPoint&) const OVERRIDE;
     
     // Whether the given RL needs a compositing layer.
     bool needsToBeComposited(const RenderLayer*, RenderLayer::ViewportConstrainedNotCompositedReason* = 0) const;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to