Changeset 243209 in webkit


Ignore:
Timestamp:
Mar 20, 2019 9:32:32 AM (5 years ago)
Author:
Simon Fraser
Message:

Explicitly trigger compositing for layers that need to be moved by ScrollingTreePositionedNodes
https://bugs.webkit.org/show_bug.cgi?id=195710
Source/WebCore:

<rdar://problem/48867502>

Reviewed by Zalan Bujtas.

A position:absolute layer whose containing block is outside an enclosing overflow:scroll, but
whose compositing ancestor is the overflow or is inside it, needs to be composited so that
we can make a Positioning scrolling tree node for it.

Handle this case as a "OverflowScrollPositioning" indirect compositing reason.

Test: compositing/layer-creation/absolute-in-async-overflow-scroll.html

  • inspector/agents/InspectorLayerTreeAgent.cpp:

(WebCore::InspectorLayerTreeAgent::reasonsForCompositingLayer):

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

(WebCore::RenderLayerCompositor::computeCompositingRequirements):
(WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
(WebCore::RenderLayerCompositor::reasonsForCompositing const):
(WebCore::RenderLayerCompositor::logReasonsForCompositing):
(WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason const):
(WebCore::RenderLayerCompositor::layerContainingBlockCrossesCoordinatedScrollingBoundary):
(WebCore::layerContainingBlockCrossesCoordinatedScrollingBoundary): Deleted.

  • rendering/RenderLayerCompositor.h: Generalize OverflowScrollingTouch to OverflowScrolling.

LayoutTests:

Reviewed by Zalan Bujtas.

  • compositing/layer-creation/absolute-in-async-overflow-scroll-expected.txt: Added.
  • compositing/layer-creation/absolute-in-async-overflow-scroll.html: Added.
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r243207 r243209  
     12019-03-20  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Explicitly trigger compositing for layers that need to be moved by ScrollingTreePositionedNodes
     4        https://bugs.webkit.org/show_bug.cgi?id=195710
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        * compositing/layer-creation/absolute-in-async-overflow-scroll-expected.txt: Added.
     9        * compositing/layer-creation/absolute-in-async-overflow-scroll.html: Added.
     10
    1112019-03-20  Devin Rousso  <drousso@apple.com>
    212
  • trunk/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt

    r242997 r243209  
    8282        (vertical scrollbar mode 0)
    8383        (has enabled vertical scrollbar 1))
     84      (children 1
     85        (Positioned node
     86          (layout constraints
     87            (layer-position-at-last-layout (81,30))
     88            (positioning-behavior stationary))
     89          (related overflow nodes 1)
     90        )
     91      )
    8492    )
    8593  )
  • trunk/LayoutTests/scrollingcoordinator/scrolling-tree/positioned-nodes-expected.txt

    r242997 r243209  
    8383        (vertical scrollbar mode 0)
    8484        (has enabled vertical scrollbar 1))
     85      (children 1
     86        (Positioned node
     87          (layout constraints
     88            (layer-position-at-last-layout (81,28))
     89            (positioning-behavior stationary))
     90          (related overflow nodes 1)
     91        )
     92      )
    8593    )
    8694  )
  • trunk/Source/WebCore/ChangeLog

    r243207 r243209  
     12019-03-20  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Explicitly trigger compositing for layers that need to be moved by ScrollingTreePositionedNodes
     4        https://bugs.webkit.org/show_bug.cgi?id=195710
     5        <rdar://problem/48867502>
     6
     7        Reviewed by Zalan Bujtas.
     8
     9        A position:absolute layer whose containing block is outside an enclosing overflow:scroll, but
     10        whose compositing ancestor is the overflow or is inside it, needs to be composited so that
     11        we can make a Positioning scrolling tree node for it.
     12
     13        Handle this case as a "OverflowScrollPositioning" indirect compositing reason.
     14
     15        Test: compositing/layer-creation/absolute-in-async-overflow-scroll.html
     16
     17        * inspector/agents/InspectorLayerTreeAgent.cpp:
     18        (WebCore::InspectorLayerTreeAgent::reasonsForCompositingLayer):
     19        * rendering/RenderLayer.h:
     20        * rendering/RenderLayerCompositor.cpp:
     21        (WebCore::RenderLayerCompositor::computeCompositingRequirements):
     22        (WebCore::RenderLayerCompositor::requiresOwnBackingStore const):
     23        (WebCore::RenderLayerCompositor::reasonsForCompositing const):
     24        (WebCore::RenderLayerCompositor::logReasonsForCompositing):
     25        (WebCore::RenderLayerCompositor::requiresCompositingForIndirectReason const):
     26        (WebCore::RenderLayerCompositor::layerContainingBlockCrossesCoordinatedScrollingBoundary):
     27        (WebCore::layerContainingBlockCrossesCoordinatedScrollingBoundary): Deleted.
     28        * rendering/RenderLayerCompositor.h: Generalize OverflowScrollingTouch to OverflowScrolling.
     29
    1302019-03-20  Devin Rousso  <drousso@apple.com>
    231
  • trunk/Source/WebCore/inspector/agents/InspectorLayerTreeAgent.cpp

    r236777 r243209  
    277277        compositingReasons->setPositionSticky(true);
    278278
    279     if (reasons.contains(CompositingReason::OverflowScrollingTouch))
     279    if (reasons.contains(CompositingReason::OverflowScrolling))
    280280        compositingReasons->setOverflowScrollingTouch(true);
     281
     282    // FIXME: handle OverflowScrollPositioning (webkit.org/b/195985).
    281283
    282284    if (reasons.contains(CompositingReason::Stacking))
  • trunk/Source/WebCore/rendering/RenderLayer.h

    r243134 r243209  
    11241124        None,
    11251125        Stacking,
     1126        OverflowScrollPositioning,
    11261127        Overlap,
    11271128        BackgroundLayer,
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r243146 r243209  
    956956    RenderLayer::IndirectCompositingReason indirectCompositingReason;
    957957    if (!willBeComposited && canBeComposited(layer)
    958         && requiresCompositingForIndirectReason(layer.renderer(), childState.subtreeIsCompositing, anyDescendantHas3DTransform, indirectCompositingReason)) {
     958        && requiresCompositingForIndirectReason(layer.renderer(), compositingState.compositingAncestor, childState.subtreeIsCompositing, anyDescendantHas3DTransform, indirectCompositingReason)) {
    959959        layer.setIndirectCompositingReason(indirectCompositingReason);
    960960        childState.compositingAncestor = &layer;
     
    22292229        RenderLayer::IndirectCompositingReason reason = layer.indirectCompositingReason();
    22302230        return reason == RenderLayer::IndirectCompositingReason::Overlap
     2231            || reason == RenderLayer::IndirectCompositingReason::OverflowScrollPositioning
    22312232            || reason == RenderLayer::IndirectCompositingReason::Stacking
    22322233            || reason == RenderLayer::IndirectCompositingReason::BackgroundLayer
     
    22852286
    22862287    if (requiresCompositingForOverflowScrolling(*renderer.layer(), queryData))
    2287         reasons.add(CompositingReason::OverflowScrollingTouch);
     2288        reasons.add(CompositingReason::OverflowScrolling);
    22882289
    22892290    switch (renderer.layer()->indirectCompositingReason()) {
     
    22922293    case RenderLayer::IndirectCompositingReason::Stacking:
    22932294        reasons.add(CompositingReason::Stacking);
     2295        break;
     2296    case RenderLayer::IndirectCompositingReason::OverflowScrollPositioning:
     2297        reasons.add(CompositingReason::OverflowScrollPositioning);
    22942298        break;
    22952299    case RenderLayer::IndirectCompositingReason::Overlap:
     
    23752379        return "position: sticky";
    23762380
    2377     if (reasons & CompositingReason::OverflowScrollingTouch)
    2378         return "-webkit-overflow-scrolling: touch";
     2381    if (reasons & CompositingReason::OverflowScrolling)
     2382        return "async overflow scrolling";
    23792383
    23802384    if (reasons & CompositingReason::Stacking)
     
    27672771
    27682772// FIXME: why doesn't this handle the clipping cases?
    2769 bool RenderLayerCompositor::requiresCompositingForIndirectReason(RenderLayerModelObject& renderer, bool hasCompositedDescendants, bool has3DTransformedDescendants, RenderLayer::IndirectCompositingReason& reason) const
    2770 {
    2771     auto& layer = *downcast<RenderBoxModelObject>(renderer).layer();
     2773bool RenderLayerCompositor::requiresCompositingForIndirectReason(RenderLayerModelObject& renderer, const RenderLayer* compositingAncestor, bool hasCompositedDescendants, bool has3DTransformedDescendants, RenderLayer::IndirectCompositingReason& reason) const
     2774{
     2775    auto& layer = *renderer.layer();
    27722776
    27732777    // When a layer has composited descendants, some effects, like 2d transforms, filters, masks etc must be implemented
     
    27882792        if (renderer.style().hasPerspective()) {
    27892793            reason = RenderLayer::IndirectCompositingReason::Perspective;
     2794            return true;
     2795        }
     2796    }
     2797
     2798    if (renderer.isAbsolutelyPositioned() && compositingAncestor) {
     2799        if (layerContainingBlockCrossesCoordinatedScrollingBoundary(layer, *compositingAncestor)) {
     2800            reason = RenderLayer::IndirectCompositingReason::OverflowScrollPositioning;
    27902801            return true;
    27912802        }
     
    28932904
    28942905// Is this layer's containingBlock an ancestor of scrollable overflow, and is the layer's compositing ancestor inside that overflow?
    2895 static bool layerContainingBlockCrossesCoordinatedScrollingBoundary(const RenderLayer& layer, const RenderLayer& compositedAncestor)
    2896 {
    2897     ASSERT(layer.isComposited());
    2898     ASSERT(layer.renderer().style().position() == PositionType::Absolute);
     2906bool RenderLayerCompositor::layerContainingBlockCrossesCoordinatedScrollingBoundary(const RenderLayer& layer, const RenderLayer& compositedAncestor)
     2907{
     2908    ASSERT(layer.renderer().isAbsolutelyPositioned());
    28992909
    29002910    bool sawCompositingAncestor = false;
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.h

    r243146 r243209  
    6666    PositionFixed                          = 1 << 9,
    6767    PositionSticky                         = 1 << 10,
    68     OverflowScrollingTouch                 = 1 << 11,
     68    OverflowScrolling                      = 1 << 11,
    6969    Stacking                               = 1 << 12,
    7070    Overlap                                = 1 << 13,
    71     NegativeZIndexChildren                 = 1 << 14,
    72     TransformWithCompositedDescendants     = 1 << 15,
    73     OpacityWithCompositedDescendants       = 1 << 16,
    74     MaskWithCompositedDescendants          = 1 << 17,
    75     ReflectionWithCompositedDescendants    = 1 << 18,
    76     FilterWithCompositedDescendants        = 1 << 19,
    77     BlendingWithCompositedDescendants      = 1 << 20,
    78     Perspective                            = 1 << 21,
    79     Preserve3D                             = 1 << 22,
    80     WillChange                             = 1 << 23,
    81     Root                                   = 1 << 24,
    82     IsolatesCompositedBlendingDescendants  = 1 << 25,
    83     EmbeddedView                           = 1 << 26,
     71    OverflowScrollPositioning              = 1 << 14,
     72    NegativeZIndexChildren                 = 1 << 15,
     73    TransformWithCompositedDescendants     = 1 << 16,
     74    OpacityWithCompositedDescendants       = 1 << 17,
     75    MaskWithCompositedDescendants          = 1 << 18,
     76    ReflectionWithCompositedDescendants    = 1 << 19,
     77    FilterWithCompositedDescendants        = 1 << 20,
     78    BlendingWithCompositedDescendants      = 1 << 21,
     79    Perspective                            = 1 << 22,
     80    Preserve3D                             = 1 << 23,
     81    WillChange                             = 1 << 24,
     82    Root                                   = 1 << 25,
     83    IsolatesCompositedBlendingDescendants  = 1 << 26,
     84    EmbeddedView                           = 1 << 27,
    8485};
    8586
     
    476477    bool requiresCompositingForOverflowScrolling(const RenderLayer&, RequiresCompositingData&) const;
    477478    bool requiresCompositingForEditableImage(RenderLayerModelObject&) const;
    478     bool requiresCompositingForIndirectReason(RenderLayerModelObject&, bool hasCompositedDescendants, bool has3DTransformedDescendants, RenderLayer::IndirectCompositingReason&) const;
     479    bool requiresCompositingForIndirectReason(RenderLayerModelObject&, const RenderLayer* compositingAncestor, bool hasCompositedDescendants, bool has3DTransformedDescendants, RenderLayer::IndirectCompositingReason&) const;
     480
     481    static bool layerContainingBlockCrossesCoordinatedScrollingBoundary(const RenderLayer&, const RenderLayer& compositedAncestor);
    479482
    480483    static bool styleChangeMayAffectIndirectCompositingReasons(const RenderStyle& oldStyle, const RenderStyle& newStyle);
Note: See TracChangeset for help on using the changeset viewer.