Changeset 243211 in webkit


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

Some elements lag behind async overflow scrolling on palace-games.com
https://bugs.webkit.org/show_bug.cgi?id=195934

Reviewed by Zalan Bujtas.
Source/WebCore:

The logic added in r242997 was wrong for an absolutely-positioned layer whose containig block was
inside an overflow:scroll, but whose compositing ancestor was outside. This is a case where
we need to make a Positioning node for the absolute layer, because it needs to move along
with the scrolled content.

There are six permutations of overflow, containing block and compositing ancestor that we care about.
Showing renderer (aka DOM) order, they are (where <- indicates child <- parent):

layer <- cb <- ca <- os -- no positioned node required
layer <- cb <- os <- ca -- compositing parent skips overflow, need a "Moved" Positioned node.
layer <- ov <- cb <- ca -- no positioned node required
layer <- ov <- ca <- cb -- no positioned node required
layer <- ca <- cb <- ov -- no positioned node required
layer <- ca <- ov <- cb -- containing block skips overflow, need a "Stationary" Positioned node.

[cb = containing block, ca = compositing ancestor, ov = overflow scroll]

Test: scrollingcoordinator/scrolling-tree/positioned-nodes-complex.html

  • rendering/RenderLayer.cpp:

(WebCore::outputPaintOrderTreeRecursive):

  • rendering/RenderLayerCompositor.cpp:

(WebCore::layerParentedAcrossCoordinatedScrollingBoundary):
(WebCore::RenderLayerCompositor::computeCoordinatedPositioningForLayer const):

LayoutTests:

Add a test with more combinations of overflow, containing block and compositing ancestor.

  • platform/ios-wk2/scrollingcoordinator/scrolling-tree/positioned-nodes-complex-expected.txt: Added.
  • scrollingcoordinator/scrolling-tree/positioned-nodes-complex-expected.txt: Added.
  • scrollingcoordinator/scrolling-tree/positioned-nodes-complex.html: Added.
Location:
trunk
Files:
3 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r243209 r243211  
     12019-03-20  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Some elements lag behind async overflow scrolling on palace-games.com
     4        https://bugs.webkit.org/show_bug.cgi?id=195934
     5
     6        Reviewed by Zalan Bujtas.
     7       
     8        Add a test with more combinations of overflow, containing block and compositing ancestor.
     9
     10        * platform/ios-wk2/scrollingcoordinator/scrolling-tree/positioned-nodes-complex-expected.txt: Added.
     11        * scrollingcoordinator/scrolling-tree/positioned-nodes-complex-expected.txt: Added.
     12        * scrollingcoordinator/scrolling-tree/positioned-nodes-complex.html: Added.
     13
    1142019-03-20  Simon Fraser  <simon.fraser@apple.com>
    215
  • trunk/Source/WebCore/ChangeLog

    r243209 r243211  
     12019-03-20  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Some elements lag behind async overflow scrolling on palace-games.com
     4        https://bugs.webkit.org/show_bug.cgi?id=195934
     5
     6        Reviewed by Zalan Bujtas.
     7
     8        The logic added in r242997 was wrong for an absolutely-positioned layer whose containig block was
     9        inside an overflow:scroll, but whose compositing ancestor was outside. This is a case where
     10        we need to make a Positioning node for the absolute layer, because it needs to move along
     11        with the scrolled content.
     12       
     13        There are six permutations of overflow, containing block and compositing ancestor that we care about.
     14        Showing renderer (aka DOM) order, they are (where <- indicates child <- parent):
     15       
     16        layer <- cb <- ca <- os -- no positioned node required
     17        layer <- cb <- os <- ca -- compositing parent skips overflow, need a "Moved" Positioned node.
     18        layer <- ov <- cb <- ca -- no positioned node required
     19        layer <- ov <- ca <- cb -- no positioned node required
     20        layer <- ca <- cb <- ov -- no positioned node required
     21        layer <- ca <- ov <- cb -- containing block skips overflow, need a "Stationary" Positioned node.
     22       
     23        [cb = containing block, ca = compositing ancestor, ov = overflow scroll]
     24
     25        Test: scrollingcoordinator/scrolling-tree/positioned-nodes-complex.html
     26
     27        * rendering/RenderLayer.cpp:
     28        (WebCore::outputPaintOrderTreeRecursive):
     29        * rendering/RenderLayerCompositor.cpp:
     30        (WebCore::layerParentedAcrossCoordinatedScrollingBoundary):
     31        (WebCore::RenderLayerCompositor::computeCoordinatedPositioningForLayer const):
     32
    1332019-03-20  Simon Fraser  <simon.fraser@apple.com>
    234
  • trunk/Source/WebCore/rendering/RenderLayer.cpp

    r243145 r243211  
    67476747        auto positionedNodeID = backing.scrollingNodeIDForRole(WebCore::ScrollCoordinationRole::Positioning);
    67486748
    6749         if (scrollingNodeID || frameHostingNodeID || viewportConstrainedNodeID) {
     6749        if (scrollingNodeID || frameHostingNodeID || viewportConstrainedNodeID || positionedNodeID) {
    67506750            stream << " {";
    67516751            bool first = true;
  • trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp

    r243209 r243211  
    29232923}
    29242924
    2925 // Is there scrollable overflow between this layer and its composited ancestor?
    2926 static bool layerParentedAcrossCoordinatedScrollingBoundary(const RenderLayer& layer, const RenderLayer& compositedAncestor)
     2925// Is there scrollable overflow between this layer and its composited ancestor, and the containing block is the scroller or inside the scroller.
     2926static bool layerParentedAcrossCoordinatedScrollingBoundary(const RenderLayer& layer, const RenderLayer& compositedAncestor, bool checkContainingBlock, bool& containingBlockIsInsideOverflow)
    29272927{
    29282928    ASSERT(layer.isComposited());
    29292929
    29302930    for (const auto* currLayer = layer.parent(); currLayer != &compositedAncestor; currLayer = currLayer->parent()) {
     2931        if (checkContainingBlock && currLayer->renderer().canContainAbsolutelyPositionedObjects())
     2932            containingBlockIsInsideOverflow = true;
     2933
    29312934        if (currLayer->hasCompositedScrollableOverflow())
    29322935            return true;
     
    29522955
    29532956    auto& renderer = layer.renderer();
    2954     if (renderer.isOutOfFlowPositioned() && renderer.style().position() == PositionType::Absolute) {
     2957    bool containingBlockCanSkipOverflow = renderer.isOutOfFlowPositioned() && renderer.style().position() == PositionType::Absolute;
     2958    if (containingBlockCanSkipOverflow) {
    29552959        if (layerContainingBlockCrossesCoordinatedScrollingBoundary(layer, *compositedAncestor))
    29562960            return ScrollPositioningBehavior::Stationary;
    2957 
    2958         return ScrollPositioningBehavior::None;
    29592961    }
    29602962
     
    29622964    //    outside the overflow:scroll. In that case, we have to move the layer via the scrolling tree to make
    29632965    //    it move along with the overflow scrolling.
    2964     if (layerParentedAcrossCoordinatedScrollingBoundary(layer, *compositedAncestor))
     2966    bool containingBlockIsInsideOverflow = !containingBlockCanSkipOverflow;
     2967    if (layerParentedAcrossCoordinatedScrollingBoundary(layer, *compositedAncestor, containingBlockCanSkipOverflow, containingBlockIsInsideOverflow) && containingBlockIsInsideOverflow)
    29652968        return ScrollPositioningBehavior::Moves;
    29662969
Note: See TracChangeset for help on using the changeset viewer.