Changeset 227596 in webkit


Ignore:
Timestamp:
Jan 24, 2018 11:59:07 PM (6 years ago)
Author:
fred.wang@free.fr
Message:

ScrollingStateNode::reconcileLayerPositionForViewportRect is only called on direct children of the root
https://bugs.webkit.org/show_bug.cgi?id=179946

Patch by Frederic Wang <fwang@igalia.com> on 2018-01-24
Reviewed by Simon Fraser.

Source/WebCore:

ScrollingStateNode::reconcileLayerPositionForViewportRect is currently only called on the
direct children of root of the scrolling tree. Hence nodes like "position: fixed" will not
update their layers after scrolling when they are deeper in the tree. This is already
possible on iOS with overflow nodes and will happen with subframes when async scrolling is
implemented. This commit fixes that issue by recursively calling the function
ScrollingStateNode::reconcileLayerPositionForViewportRect on the scrolling tree.

Test: fast/scrolling/ios/reconcile-layer-position-recursive.html

  • page/scrolling/AsyncScrollingCoordinator.cpp:

(WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions): Just call
reconcileLayerPositionForViewportRect on the root node.

  • page/scrolling/ScrollingStateNode.cpp:

(WebCore::ScrollingStateNode::reconcileLayerPositionForViewportRect): By default, this
function now recursively calls reconcileLayerPositionForViewportRect on the children.

  • page/scrolling/ScrollingStateNode.h:
  • page/scrolling/ScrollingStateFixedNode.cpp:

(WebCore::ScrollingStateFixedNode::reconcileLayerPositionForViewportRect): Call the function
on children.

  • page/scrolling/ScrollingStateStickyNode.cpp:

(WebCore::ScrollingStateStickyNode::reconcileLayerPositionForViewportRect): Ditto.

LayoutTests:

Add a test that verifies the correct update of the graphic layer of a "position: fixed" and
"position: sticky" nodes inside a non-flat scrolling tree. The test checks recursive call
on overflow, "position: sticky" and "position: fixed" nodes.

  • fast/scrolling/ios/reconcile-layer-position-recursive-expected.txt: Added.
  • fast/scrolling/ios/reconcile-layer-position-recursive.html: Added.
Location:
trunk
Files:
2 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r227595 r227596  
     12018-01-24  Frederic Wang  <fwang@igalia.com>
     2
     3        ScrollingStateNode::reconcileLayerPositionForViewportRect is only called on direct children of the root
     4        https://bugs.webkit.org/show_bug.cgi?id=179946
     5
     6        Reviewed by Simon Fraser.
     7
     8        Add a test that verifies the correct update of the graphic layer of a "position: fixed" and
     9        "position: sticky" nodes inside a non-flat scrolling tree. The test checks recursive call
     10        on overflow, "position: sticky" and "position: fixed" nodes.
     11
     12        * fast/scrolling/ios/reconcile-layer-position-recursive-expected.txt: Added.
     13        * fast/scrolling/ios/reconcile-layer-position-recursive.html: Added.
     14
    1152018-01-24  Manuel Rego Casasnovas  <rego@igalia.com>
    216
  • trunk/Source/WebCore/ChangeLog

    r227594 r227596  
     12018-01-24  Frederic Wang  <fwang@igalia.com>
     2
     3        ScrollingStateNode::reconcileLayerPositionForViewportRect is only called on direct children of the root
     4        https://bugs.webkit.org/show_bug.cgi?id=179946
     5
     6        Reviewed by Simon Fraser.
     7
     8        ScrollingStateNode::reconcileLayerPositionForViewportRect is currently only called on the
     9        direct children of root of the scrolling tree. Hence nodes like "position: fixed" will not
     10        update their layers after scrolling when they are deeper in the tree. This is already
     11        possible on iOS with overflow nodes and will happen with subframes when async scrolling is
     12        implemented. This commit fixes that issue by recursively calling the function
     13        ScrollingStateNode::reconcileLayerPositionForViewportRect on the scrolling tree.
     14
     15        Test: fast/scrolling/ios/reconcile-layer-position-recursive.html
     16
     17        * page/scrolling/AsyncScrollingCoordinator.cpp:
     18        (WebCore::AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions): Just call
     19        reconcileLayerPositionForViewportRect on the root node.
     20        * page/scrolling/ScrollingStateNode.cpp:
     21        (WebCore::ScrollingStateNode::reconcileLayerPositionForViewportRect): By default, this
     22        function now recursively calls reconcileLayerPositionForViewportRect on the children.
     23        * page/scrolling/ScrollingStateNode.h:
     24        * page/scrolling/ScrollingStateFixedNode.cpp:
     25        (WebCore::ScrollingStateFixedNode::reconcileLayerPositionForViewportRect): Call the function
     26        on children.
     27        * page/scrolling/ScrollingStateStickyNode.cpp:
     28        (WebCore::ScrollingStateStickyNode::reconcileLayerPositionForViewportRect): Ditto.
     29
    1302018-01-24  Zan Dobersek  <zdobersek@igalia.com>
    231
  • trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp

    r227396 r227596  
    492492        return;
    493493
    494     auto children = m_scrollingStateTree->rootStateNode()->children();
    495     if (!children)
    496         return;
    497 
    498494    LOG_WITH_STREAM(Scrolling, stream << getpid() << " AsyncScrollingCoordinator::reconcileViewportConstrainedLayerPositions for viewport rect " << viewportRect);
    499495
    500     // FIXME: We'll have to traverse deeper into the tree at some point.
    501     for (auto& child : *children)
    502         child->reconcileLayerPositionForViewportRect(viewportRect, action);
     496    m_scrollingStateTree->rootStateNode()->reconcileLayerPositionForViewportRect(viewportRect, action);
    503497}
    504498
  • trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp

    r223728 r227596  
    7272void ScrollingStateFixedNode::reconcileLayerPositionForViewportRect(const LayoutRect& viewportRect, ScrollingLayerPositionAction action)
    7373{
     74    ScrollingStateNode::reconcileLayerPositionForViewportRect(viewportRect, action);
     75
    7476    FloatPoint position = m_constraints.layerPositionForViewportRect(viewportRect);
    7577    if (layer().representsGraphicsLayer()) {
  • trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp

    r225227 r227596  
    101101}
    102102
     103void ScrollingStateNode::reconcileLayerPositionForViewportRect(const LayoutRect& viewportRect, ScrollingLayerPositionAction action)
     104{
     105    if (!m_children)
     106        return;
     107
     108    for (auto& child : *m_children)
     109        child->reconcileLayerPositionForViewportRect(viewportRect, action);
     110}
     111
    103112void ScrollingStateNode::setLayer(const LayerRepresentation& layerRepresentation)
    104113{
  • trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h

    r223337 r227596  
    219219    void setChangedProperties(ChangedProperties changedProperties) { m_changedProperties = changedProperties; }
    220220   
    221     virtual void reconcileLayerPositionForViewportRect(const LayoutRect& /*viewportRect*/, ScrollingLayerPositionAction) { }
     221    virtual void reconcileLayerPositionForViewportRect(const LayoutRect& /*viewportRect*/, ScrollingLayerPositionAction);
    222222
    223223    const LayerRepresentation& layer() const { return m_layer; }
  • trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.cpp

    r223728 r227596  
    7272void ScrollingStateStickyNode::reconcileLayerPositionForViewportRect(const LayoutRect& viewportRect, ScrollingLayerPositionAction action)
    7373{
     74    ScrollingStateNode::reconcileLayerPositionForViewportRect(viewportRect, action);
     75
    7476    FloatPoint position = m_constraints.layerPositionForConstrainingRect(viewportRect);
    7577    if (layer().representsGraphicsLayer()) {
Note: See TracChangeset for help on using the changeset viewer.