Changeset 183970 in webkit


Ignore:
Timestamp:
May 7, 2015, 6:46:59 PM (10 years ago)
Author:
Simon Fraser
Message:

REGRESSION (r183300): Fixed elements flash when scrolling
https://bugs.webkit.org/show_bug.cgi?id=144778
rdar://problem/20769741

Reviewed by Dean Jackson.

After r183300 we can detached layer backing store when outside the coverage region.
However, position:fixed layers are moved around by the ScrollingCoordinator behind
GraphicsLayer's back, so we can do layer flushes with stale information about layer
geometry.

To avoid dropping backing store for layers in this situation, prevent backing
store detachment on layers registered with the ScrollingCoordinator as viewport-constrained
layers. Preventing detachment on a layer also prevents detachment on all descendant
layers.

  • platform/graphics/GraphicsLayer.h:

(WebCore::GraphicsLayer::setAllowsBackingStoreDetachment):
(WebCore::GraphicsLayer::allowsBackingStoreDetachment):

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::GraphicsLayerCA):
(WebCore::GraphicsLayerCA::setVisibleAndCoverageRects): Set m_intersectsCoverageRect to true
if backing store detachment is prevented.
(WebCore::GraphicsLayerCA::recursiveCommitChanges): Set a bit in the CommitState to
communicate to descendants that detachment is prevented.

  • platform/graphics/ca/GraphicsLayerCA.h:

(WebCore::GraphicsLayerCA::CommitState::CommitState): Deleted.

  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::setIsScrollCoordinatedWithViewportConstrainedRole):

  • rendering/RenderLayerBacking.h:

(WebCore::RenderLayerBacking::setScrollingNodeIDForRole): If registering with a non-zero
nodeID for the ViewportConstrained role, turn off backing store detachment.

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r183967 r183970  
     12015-05-07  Simon Fraser  <simon.fraser@apple.com>
     2
     3        REGRESSION (r183300): Fixed elements flash when scrolling
     4        https://bugs.webkit.org/show_bug.cgi?id=144778
     5        rdar://problem/20769741
     6
     7        Reviewed by Dean Jackson.
     8
     9        After r183300 we can detached layer backing store when outside the coverage region.
     10        However, position:fixed layers are moved around by the ScrollingCoordinator behind
     11        GraphicsLayer's back, so we can do layer flushes with stale information about layer
     12        geometry.
     13       
     14        To avoid dropping backing store for layers in this situation, prevent backing
     15        store detachment on layers registered with the ScrollingCoordinator as viewport-constrained
     16        layers. Preventing detachment on a layer also prevents detachment on all descendant
     17        layers.
     18
     19        * platform/graphics/GraphicsLayer.h:
     20        (WebCore::GraphicsLayer::setAllowsBackingStoreDetachment):
     21        (WebCore::GraphicsLayer::allowsBackingStoreDetachment):
     22        * platform/graphics/ca/GraphicsLayerCA.cpp:
     23        (WebCore::GraphicsLayerCA::GraphicsLayerCA):
     24        (WebCore::GraphicsLayerCA::setVisibleAndCoverageRects): Set m_intersectsCoverageRect to true
     25        if backing store detachment is prevented.
     26        (WebCore::GraphicsLayerCA::recursiveCommitChanges): Set a bit in the CommitState to
     27        communicate to descendants that detachment is prevented.
     28        * platform/graphics/ca/GraphicsLayerCA.h:
     29        (WebCore::GraphicsLayerCA::CommitState::CommitState): Deleted.
     30        * rendering/RenderLayerBacking.cpp:
     31        (WebCore::RenderLayerBacking::setIsScrollCoordinatedWithViewportConstrainedRole):
     32        * rendering/RenderLayerBacking.h:
     33        (WebCore::RenderLayerBacking::setScrollingNodeIDForRole): If registering with a non-zero
     34        nodeID for the ViewportConstrained role, turn off backing store detachment.
     35
    1362015-05-07  Sam Weinig  <sam@webkit.org>
    237
  • trunk/Source/WebCore/platform/graphics/GraphicsLayer.h

    r182159 r183970  
    491491    float pageScaleFactor() const { return m_client.pageScaleFactor(); }
    492492    float deviceScaleFactor() const { return m_client.deviceScaleFactor(); }
     493   
     494    // Whether this layer (and descendants) can detach backing store when outside the coverage area.
     495    virtual void setAllowsBackingStoreDetachment(bool) { }
     496    virtual bool allowsBackingStoreDetachment() const { return true; }
    493497
    494498    virtual void deviceOrPageScaleFactorChanged() { }
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r183942 r183970  
    354354    , m_needsFullRepaint(false)
    355355    , m_usingBackdropLayerType(false)
     356    , m_allowsBackingStoreDetachment(true)
    356357    , m_intersectsCoverageRect(true)
    357358{
     
    12531254}
    12541255
    1255 void GraphicsLayerCA::setVisibleAndCoverageRects(const VisibleAndCoverageRects& rects)
     1256void GraphicsLayerCA::setVisibleAndCoverageRects(const VisibleAndCoverageRects& rects, bool allowBackingStoreDetachment)
    12561257{
    12571258    bool visibleRectChanged = rects.visibleRect != m_visibleRect;
     
    12761277
    12771278        // FIXME: we need to take reflections into account when determining whether this layer intersects the coverage rect.
    1278         m_intersectsCoverageRect = m_coverageRect.intersects(FloatRect(m_boundsOrigin, size()));
     1279        m_intersectsCoverageRect = !allowBackingStoreDetachment || m_coverageRect.intersects(FloatRect(m_boundsOrigin, size()));
    12791280
    12801281        if (GraphicsLayerCA* maskLayer = downcast<GraphicsLayerCA>(m_maskLayer)) {
     
    13011302        }
    13021303    }
    1303     setVisibleAndCoverageRects(rects);
     1304    setVisibleAndCoverageRects(rects, m_allowsBackingStoreDetachment && commitState.ancestorsAllowBackingStoreDetachment);
    13041305
    13051306#ifdef VISIBLE_TILE_WASH
     
    13441345        affectedByTransformAnimation = true;
    13451346    }
     1347   
     1348    childCommitState.ancestorsAllowBackingStoreDetachment &= m_allowsBackingStoreDetachment;
    13461349
    13471350    if (GraphicsLayerCA* maskLayer = downcast<GraphicsLayerCA>(m_maskLayer))
     
    36263629}
    36273630
     3631void GraphicsLayerCA::setAllowsBackingStoreDetachment(bool allowDetachment)
     3632{
     3633    if (allowDetachment == m_allowsBackingStoreDetachment)
     3634        return;
     3635
     3636    m_allowsBackingStoreDetachment = allowDetachment;
     3637    noteLayerPropertyChanged(CoverageRectChanged);
     3638}
     3639
    36283640void GraphicsLayerCA::deviceOrPageScaleFactorChanged()
    36293641{
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r183354 r183970  
    149149
    150150    struct CommitState {
    151         bool ancestorHasTransformAnimation;
    152         int treeDepth;
    153         CommitState()
    154             : ancestorHasTransformAnimation(false)
    155             , treeDepth(0)
    156         { }
     151        int treeDepth { 0 };
     152        bool ancestorHasTransformAnimation { false };
     153        bool ancestorsAllowBackingStoreDetachment { true };
    157154    };
    158155    void recursiveCommitChanges(const CommitState&, const TransformState&, float pageScaleFactor = 1, const FloatPoint& positionRelativeToBase = FloatPoint(), bool affectedByPageScale = false);
     
    197194
    198195    virtual bool isCommittingChanges() const override { return m_isCommittingChanges; }
     196
     197    WEBCORE_EXPORT virtual void setAllowsBackingStoreDetachment(bool) override;
     198    WEBCORE_EXPORT virtual bool allowsBackingStoreDetachment() const override { return m_allowsBackingStoreDetachment; }
    199199
    200200    WEBCORE_EXPORT virtual double backingStoreMemoryEstimate() const override;
     
    294294    const FloatRect& coverageRect() const { return m_coverageRect; }
    295295
    296     void setVisibleAndCoverageRects(const VisibleAndCoverageRects&);
     296    void setVisibleAndCoverageRects(const VisibleAndCoverageRects&, bool allowBackingStoreDetachment);
    297297   
    298298    static FloatRect adjustTiledLayerVisibleRect(TiledBacking*, const FloatRect& oldVisibleRect, const FloatRect& newVisibleRect, const FloatSize& oldSize, const FloatSize& newSize);
     
    511511    bool m_needsFullRepaint : 1;
    512512    bool m_usingBackdropLayerType : 1;
     513    bool m_allowsBackingStoreDetachment : 1;
    513514    bool m_intersectsCoverageRect : 1;
    514515
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r183950 r183970  
    15701570}
    15711571
     1572void RenderLayerBacking::setIsScrollCoordinatedWithViewportConstrainedRole(bool viewportCoordinated)
     1573{
     1574    m_graphicsLayer->setAllowsBackingStoreDetachment(!viewportCoordinated);
     1575}
     1576
    15721577GraphicsLayerPaintingPhase RenderLayerBacking::paintingPhaseForPrimaryLayer() const
    15731578{
  • trunk/Source/WebCore/rendering/RenderLayerBacking.h

    r183849 r183970  
    127127        case ViewportConstrained:
    128128            m_viewportConstrainedNodeID = nodeID;
     129            setIsScrollCoordinatedWithViewportConstrainedRole(nodeID);
    129130            break;
    130131        }
     
    132133   
    133134    ScrollingNodeID scrollingNodeIDForChildren() const { return m_scrollingNodeID ? m_scrollingNodeID : m_viewportConstrainedNodeID; }
     135
     136    void setIsScrollCoordinatedWithViewportConstrainedRole(bool);
    134137
    135138    bool hasMaskLayer() const { return m_maskLayer != 0; }
Note: See TracChangeset for help on using the changeset viewer.