Changeset 143417 in webkit


Ignore:
Timestamp:
Feb 19, 2013, 5:29:39 PM (12 years ago)
Author:
Simon Fraser
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:
Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r143415 r143417  
     12013-02-19  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Rubber-banding should not affect the visibleRect of the TileCache
     4        https://bugs.webkit.org/show_bug.cgi?id=110278
     5
     6        Reviewed by Beth Dakin.
     7       
     8        When rubber-banding a slow-scrolling page, or image document, we would constantly re-create
     9        the bottom tile because of the logic that adapts the tile size to the visible rect when slow
     10        scrolling.
     11       
     12        Avoid that by ensuring that the visibleRect is not affected by rubber-banding. This is done
     13        via a GraphicsLayerClient function that allows RenderLayerCompositor to provide a custom
     14        position for the scroll layer. We constrain that scroll position to remove the overhang that
     15        results from rubber-banding.
     16
     17        I wasn't able to make a test for this, even with internals.setScrollViewPosition().
     18
     19        * platform/graphics/GraphicsLayerClient.h:
     20        (GraphicsLayerClient):
     21        (WebCore::GraphicsLayerClient::customPositionForVisibleRectComputation):
     22        * platform/graphics/ca/GraphicsLayerCA.cpp:
     23        (WebCore::GraphicsLayerCA::computeVisibleRect):
     24        * rendering/RenderLayerCompositor.cpp:
     25        (WebCore::RenderLayerCompositor::customPositionForVisibleRectComputation):
     26        * rendering/RenderLayerCompositor.h:
     27
    1282013-02-19  Tony Gentilcore  <tonyg@chromium.org>
    229
  • trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h

    r133517 r143417  
    7878    virtual bool getCurrentTransform(const GraphicsLayer*, TransformationMatrix&) const { return false; }
    7979
     80    // Allows the client to modify a layer position used during the visibleRect calculation, for example to ignore
     81    // scroll overhang.
     82    virtual void customPositionForVisibleRectComputation(const GraphicsLayer*, FloatPoint&) const { }
     83
    8084    // Multiplier for backing store size, related to high DPI.
    8185    virtual float deviceScaleFactor() const { return 1; }
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r141789 r143417  
    918918
    919919    TransformationMatrix layerTransform;
    920     layerTransform.translate(m_position.x(), m_position.y());
     920    FloatPoint position = m_position;
     921    if (m_client)
     922        m_client->customPositionForVisibleRectComputation(this, position);
     923
     924    layerTransform.translate(position.x(), position.y());
    921925
    922926    TransformationMatrix currentTransform;
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r143295 r143417  
    303303}
    304304
     305void RenderLayerCompositor::customPositionForVisibleRectComputation(const GraphicsLayer* graphicsLayer, FloatPoint& position) const
     306{
     307    if (graphicsLayer != m_scrollLayer.get())
     308        return;
     309
     310    FrameView* frameView = m_renderView ? m_renderView->frameView() : 0;
     311    if (!frameView)
     312        return;
     313
     314    FloatPoint scrollPosition = -position;
     315    scrollPosition = frameView->constrainScrollPositionForOverhang(roundedIntPoint(scrollPosition));
     316    position = -scrollPosition;
     317}
     318
    305319void RenderLayerCompositor::scheduleLayerFlush()
    306320{
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.h

    r141221 r143417  
    250250    // GraphicsLayerUpdaterClient implementation
    251251    virtual void flushLayers(GraphicsLayerUpdater*) OVERRIDE;
     252    virtual void customPositionForVisibleRectComputation(const GraphicsLayer*, FloatPoint&) const OVERRIDE;
    252253   
    253254    // Whether the given RL needs a compositing layer.
Note: See TracChangeset for help on using the changeset viewer.