Changeset 240047 in webkit


Ignore:
Timestamp:
Jan 16, 2019 12:40:59 PM (5 years ago)
Author:
Simon Fraser
Message:

Make didCommitChangesForLayer() explicitly about the platform layer changing because of tile/non-tile swapping
https://bugs.webkit.org/show_bug.cgi?id=193290

Reviewed by Tim Horton.

RenderLayerCompositor::didFlushChangesForLayer() triggers updates scrolling tree nodes for
the flushed layer, but it's not clear what has changed at this point.

didCommitChangesForLayer()/didFlushChangesForLayer() were added to explicitly handle the
case where the underlying platform layer for a GraphicsLayer changes because the layer swaps
between tiled and non-tiled, and structural layer changes; we need to push the new layer to
the scrolling tree because it operates on platform layers. So the only work that
didFlushChangesForLayer() should do is to update layers on scrolling tree nodes; it doesn't
need to do any geometry updating. Move towards that goal by renaming this callback to
didChangePlatformLayerForLayer() to make its function more explicit.

  • platform/graphics/GraphicsLayerClient.h:

(WebCore::GraphicsLayerClient::didChangePlatformLayerForLayer):
(WebCore::GraphicsLayerClient::didCommitChangesForLayer const): Deleted.

  • platform/graphics/ca/GraphicsLayerCA.cpp:

(WebCore::GraphicsLayerCA::flushCompositingStateForThisLayerOnly):
(WebCore::GraphicsLayerCA::recursiveCommitChanges):
(WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):

  • platform/graphics/ca/GraphicsLayerCA.h:
  • rendering/RenderLayerBacking.cpp:

(WebCore::RenderLayerBacking::didChangePlatformLayerForLayer):
(WebCore::RenderLayerBacking::didCommitChangesForLayer const): Deleted.

  • rendering/RenderLayerBacking.h:
  • rendering/RenderLayerCompositor.cpp:

(WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
(WebCore::LegacyWebKitScrollingLayerCoordinator::didChangePlatformLayerForLayer):
(WebCore::RenderLayerCompositor::didFlushChangesForLayer): Deleted.
(WebCore::RenderLayerCompositor::didCommitChangesForLayer const): Deleted.
(WebCore::LegacyWebKitScrollingLayerCoordinator::didFlushChangesForLayer): Deleted.

  • rendering/RenderLayerCompositor.h:
Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r240046 r240047  
     12019-01-15  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Make didCommitChangesForLayer() explicitly about the platform layer changing because of tile/non-tile swapping
     4        https://bugs.webkit.org/show_bug.cgi?id=193290
     5
     6        Reviewed by Tim Horton.
     7
     8        RenderLayerCompositor::didFlushChangesForLayer() triggers updates scrolling tree nodes for
     9        the flushed layer, but it's not clear what has changed at this point.
     10
     11        didCommitChangesForLayer()/didFlushChangesForLayer() were added to explicitly handle the
     12        case where the underlying platform layer for a GraphicsLayer changes because the layer swaps
     13        between tiled and non-tiled, and structural layer changes; we need to push the new layer to
     14        the scrolling tree because it operates on platform layers. So the only work that
     15        didFlushChangesForLayer() should do is to update layers on scrolling tree nodes; it doesn't
     16        need to do any geometry updating. Move towards that goal by renaming this callback to
     17        didChangePlatformLayerForLayer() to make its function more explicit.
     18
     19        * platform/graphics/GraphicsLayerClient.h:
     20        (WebCore::GraphicsLayerClient::didChangePlatformLayerForLayer):
     21        (WebCore::GraphicsLayerClient::didCommitChangesForLayer const): Deleted.
     22        * platform/graphics/ca/GraphicsLayerCA.cpp:
     23        (WebCore::GraphicsLayerCA::flushCompositingStateForThisLayerOnly):
     24        (WebCore::GraphicsLayerCA::recursiveCommitChanges):
     25        (WebCore::GraphicsLayerCA::commitLayerChangesBeforeSublayers):
     26        * platform/graphics/ca/GraphicsLayerCA.h:
     27        * rendering/RenderLayerBacking.cpp:
     28        (WebCore::RenderLayerBacking::didChangePlatformLayerForLayer):
     29        (WebCore::RenderLayerBacking::didCommitChangesForLayer const): Deleted.
     30        * rendering/RenderLayerBacking.h:
     31        * rendering/RenderLayerCompositor.cpp:
     32        (WebCore::RenderLayerCompositor::didChangePlatformLayerForLayer):
     33        (WebCore::LegacyWebKitScrollingLayerCoordinator::didChangePlatformLayerForLayer):
     34        (WebCore::RenderLayerCompositor::didFlushChangesForLayer): Deleted.
     35        (WebCore::RenderLayerCompositor::didCommitChangesForLayer const): Deleted.
     36        (WebCore::LegacyWebKitScrollingLayerCoordinator::didFlushChangesForLayer): Deleted.
     37        * rendering/RenderLayerCompositor.h:
     38
    1392019-01-16  Chris Dumez  <cdumez@apple.com>
    240
  • trunk/Source/WebCore/platform/graphics/GraphicsLayerClient.h

    r239548 r240047  
    102102
    103103    virtual void paintContents(const GraphicsLayer*, GraphicsContext&, GraphicsLayerPaintingPhase, const FloatRect& /* inClip */, GraphicsLayerPaintBehavior) { }
    104     virtual void didCommitChangesForLayer(const GraphicsLayer*) const { }
     104    virtual void didChangePlatformLayerForLayer(const GraphicsLayer*) { }
    105105
    106106    // Provides current transform (taking transform-origin and animations into account). Input matrix has been
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp

    r239833 r240047  
    12721272{
    12731273    float pageScaleFactor;
    1274     bool hadChanges = m_uncommittedChanges;
     1274    bool layerTypeChanged = false;
    12751275   
    12761276    CommitState commitState;
    12771277
    12781278    FloatPoint offset = computePositionRelativeToBase(pageScaleFactor);
    1279     commitLayerChangesBeforeSublayers(commitState, pageScaleFactor, offset);
     1279    commitLayerChangesBeforeSublayers(commitState, pageScaleFactor, offset, layerTypeChanged);
    12801280    commitLayerChangesAfterSublayers(commitState);
    12811281
    1282     if (hadChanges)
    1283         client().didCommitChangesForLayer(this);
     1282    if (layerTypeChanged)
     1283        client().didChangePlatformLayerForLayer(this);
    12841284}
    12851285
     
    15661566
    15671567    bool wasRunningTransformAnimation = isRunningTransformAnimation();
    1568 
    1569     commitLayerChangesBeforeSublayers(childCommitState, pageScaleFactor, baseRelativePosition);
     1568    bool layerTypeChanged = false;
     1569   
     1570    commitLayerChangesBeforeSublayers(childCommitState, pageScaleFactor, baseRelativePosition, layerTypeChanged);
    15701571
    15711572    bool nowRunningTransformAnimation = wasRunningTransformAnimation;
     
    15871588    if (GraphicsLayerCA* maskLayer = downcast<GraphicsLayerCA>(m_maskLayer.get())) {
    15881589        maskLayer->setVisibleAndCoverageRects(rects, m_isViewportConstrained || commitState.ancestorIsViewportConstrained);
    1589         maskLayer->commitLayerChangesBeforeSublayers(childCommitState, pageScaleFactor, baseRelativePosition);
     1590        maskLayer->commitLayerChangesBeforeSublayers(childCommitState, pageScaleFactor, baseRelativePosition, layerTypeChanged);
    15901591    }
    15911592
     
    16171618        client().notifyFlushBeforeDisplayRefresh(this);
    16181619
    1619     if (hadChanges)
    1620         client().didCommitChangesForLayer(this);
     1620    if (layerTypeChanged)
     1621        client().didChangePlatformLayerForLayer(this);
    16211622
    16221623    if (usesDisplayListDrawing() && m_drawsContent && (!m_hasEverPainted || hadDirtyRects)) {
     
    17131714}
    17141715
    1715 void GraphicsLayerCA::commitLayerChangesBeforeSublayers(CommitState& commitState, float pageScaleFactor, const FloatPoint& positionRelativeToBase)
     1716void GraphicsLayerCA::commitLayerChangesBeforeSublayers(CommitState& commitState, float pageScaleFactor, const FloatPoint& positionRelativeToBase, bool& layerChanged)
    17161717{
    17171718    SetForScope<bool> committingChangesChange(m_isCommittingChanges, true);
     
    17401741        neededLayerType = PlatformCALayer::LayerTypeWebLayer;
    17411742
    1742     if (neededLayerType != m_layer->layerType())
     1743    if (neededLayerType != m_layer->layerType()) {
    17431744        changeLayerTypeTo(neededLayerType);
     1745        layerChanged = true;
     1746    }
    17441747
    17451748    // Need to handle Preserves3DChanged first, because it affects which layers subsequent properties are applied to
    1746     if (m_uncommittedChanges & (Preserves3DChanged | ReplicatedLayerChanged | BackdropFiltersChanged))
    1747         updateStructuralLayer();
     1749    if (m_uncommittedChanges & (Preserves3DChanged | ReplicatedLayerChanged | BackdropFiltersChanged)) {
     1750        if (updateStructuralLayer())
     1751            layerChanged = true;
     1752    }
    17481753
    17491754    if (m_uncommittedChanges & GeometryChanged)
     
    22662271}
    22672272
    2268 void GraphicsLayerCA::updateStructuralLayer()
    2269 {
    2270     ensureStructuralLayer(structuralLayerPurpose());
    2271 }
    2272 
    2273 void GraphicsLayerCA::ensureStructuralLayer(StructuralLayerPurpose purpose)
     2273bool GraphicsLayerCA::updateStructuralLayer()
     2274{
     2275    return ensureStructuralLayer(structuralLayerPurpose());
     2276}
     2277
     2278bool GraphicsLayerCA::ensureStructuralLayer(StructuralLayerPurpose purpose)
    22742279{
    22752280    const LayerChangeFlags structuralLayerChangeFlags = NameChanged
     
    22842289        | OpacityChanged;
    22852290
     2291    bool structuralLayerChanged = false;
     2292
    22862293    if (purpose == NoStructuralLayer) {
    22872294        if (m_structuralLayer) {
     
    22982305            // Release the structural layer.
    22992306            m_structuralLayer = nullptr;
     2307            structuralLayerChanged = true;
    23002308
    23012309            addUncommittedChanges(structuralLayerChangeFlags);
    23022310        }
    2303         return;
    2304     }
    2305 
    2306     bool structuralLayerChanged = false;
    2307    
     2311        return structuralLayerChanged;
     2312    }
     2313
    23082314    if (purpose == StructuralLayerForPreserves3D) {
    23092315        if (m_structuralLayer && m_structuralLayer->layerType() != PlatformCALayer::LayerTypeTransformLayer)
     
    23252331   
    23262332    if (!structuralLayerChanged)
    2327         return;
     2333        return false;
    23282334   
    23292335    addUncommittedChanges(structuralLayerChangeFlags);
     
    23502356
    23512357    moveAnimations(m_layer.get(), m_structuralLayer.get());
     2358    return true;
    23522359}
    23532360
  • trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h

    r238108 r240047  
    278278    }
    279279
    280     void commitLayerChangesBeforeSublayers(CommitState&, float pageScaleFactor, const FloatPoint& positionRelativeToBase);
     280    void commitLayerChangesBeforeSublayers(CommitState&, float pageScaleFactor, const FloatPoint& positionRelativeToBase, bool& layerTypeChanged);
    281281    void commitLayerChangesAfterSublayers(CommitState&);
    282282
     
    403403    void updateContentsOpaque(float pageScaleFactor);
    404404    void updateBackfaceVisibility();
    405     void updateStructuralLayer();
     405    bool updateStructuralLayer();
    406406    void updateDrawsContent();
    407407    void updateCoverage(const CommitState&);
     
    444444        StructuralLayerForBackdrop
    445445    };
    446     void ensureStructuralLayer(StructuralLayerPurpose);
     446    bool ensureStructuralLayer(StructuralLayerPurpose);
    447447    StructuralLayerPurpose structuralLayerPurpose() const;
    448448   
  • trunk/Source/WebCore/rendering/RenderLayerBacking.cpp

    r239985 r240047  
    26612661}
    26622662
    2663 void RenderLayerBacking::didCommitChangesForLayer(const GraphicsLayer* layer) const
    2664 {
    2665     compositor().didFlushChangesForLayer(m_owningLayer, layer);
     2663void RenderLayerBacking::didChangePlatformLayerForLayer(const GraphicsLayer* layer)
     2664{
     2665    compositor().didChangePlatformLayerForLayer(m_owningLayer, layer);
    26662666}
    26672667
  • trunk/Source/WebCore/rendering/RenderLayerBacking.h

    r239576 r240047  
    209209    float pageScaleFactor() const override;
    210210    float zoomedOutPageScaleFactor() const override;
    211     void didCommitChangesForLayer(const GraphicsLayer*) const override;
     211
     212    void didChangePlatformLayerForLayer(const GraphicsLayer*) override;
    212213    bool getCurrentTransform(const GraphicsLayer*, TransformationMatrix&) const override;
    213214
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r239985 r240047  
    537537}
    538538
    539 void RenderLayerCompositor::didFlushChangesForLayer(RenderLayer& layer, const GraphicsLayer* graphicsLayer)
     539void RenderLayerCompositor::didChangePlatformLayerForLayer(RenderLayer& layer, const GraphicsLayer* graphicsLayer)
    540540{
    541541    if (m_scrollCoordinatedLayers.contains(&layer))
     
    544544#if PLATFORM(IOS_FAMILY)
    545545    if (m_legacyScrollingLayerCoordinator)
    546         m_legacyScrollingLayerCoordinator->didFlushChangesForLayer(layer);
     546        m_legacyScrollingLayerCoordinator->didChangePlatformLayerForLayer(layer);
    547547#endif
    548548
     
    29862986}
    29872987
    2988 void RenderLayerCompositor::didCommitChangesForLayer(const GraphicsLayer*) const
    2989 {
    2990     // Nothing to do here yet.
    2991 }
    2992 
    29932988bool RenderLayerCompositor::documentUsesTiledBacking() const
    29942989{
     
    42314226}
    42324227
    4233 void LegacyWebKitScrollingLayerCoordinator::didFlushChangesForLayer(RenderLayer& layer)
     4228void LegacyWebKitScrollingLayerCoordinator::didChangePlatformLayerForLayer(RenderLayer& layer)
    42344229{
    42354230    if (m_scrollingLayers.contains(&layer))
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.h

    r239658 r240047  
    108108    void removeScrollingLayer(RenderLayer&, RenderLayerBacking&);
    109109
    110     void didFlushChangesForLayer(RenderLayer&);
     110    void didChangePlatformLayerForLayer(RenderLayer&);
    111111
    112112private:
     
    160160    void scheduleLayerFlush(bool canThrottle);
    161161    void flushPendingLayerChanges(bool isFlushRoot = true);
    162    
     162
    163163    // Called when the GraphicsLayer for the given RenderLayer has flushed changes inside of flushPendingLayerChanges().
    164     void didFlushChangesForLayer(RenderLayer&, const GraphicsLayer*);
     164    void didChangePlatformLayerForLayer(RenderLayer&, const GraphicsLayer*);
    165165
    166166    // Called when something outside WebKit affects the visible rect (e.g. delegated scrolling). Might schedule a layer flush.
     
    290290    float pageScaleFactor() const override;
    291291    float zoomedOutPageScaleFactor() const override;
    292 
    293     void didCommitChangesForLayer(const GraphicsLayer*) const override;
     292    void didChangePlatformLayerForLayer(const GraphicsLayer*) override { }
    294293    void notifyFlushBeforeDisplayRefresh(const GraphicsLayer*) override;
    295294
Note: See TracChangeset for help on using the changeset viewer.