⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 246197 in webkit


Ignore:
Timestamp:
Jun 7, 2019, 7:17:49 AM (7 years ago)
Author:
Antti Koivisto
Message:

position:fixed inside overflow positioning nodes is jumpy
https://bugs.webkit.org/show_bug.cgi?id=198647
<rdar://problem/51514437>

Reviewed by Frédéric Wang.

Source/WebCore:

Tests: scrollingcoordinator/ios/fixed-overflow-no-stacking-context-1.html

scrollingcoordinator/ios/fixed-overflow-no-stacking-context-2.html
scrollingcoordinator/ios/fixed-overflow-stacking-context-stationary.html

  • page/scrolling/ScrollingTreeScrollingNode.h:
  • page/scrolling/cocoa/ScrollingTreeFixedNode.mm:

(WebCore::ScrollingTreeFixedNode::applyLayerPositions):

Take deltas from positioning nodes into account.

  • page/scrolling/cocoa/ScrollingTreePositionedNode.h:
  • page/scrolling/cocoa/ScrollingTreePositionedNode.mm:

(WebCore::ScrollingTreePositionedNode::scrollDeltaSinceLastCommit const):

Rename since 'scrollOffset' has other meaning.

(WebCore::ScrollingTreePositionedNode::applyLayerPositions):
(WebCore::ScrollingTreePositionedNode::scrollOffsetSinceLastCommit const): Deleted.

  • page/scrolling/cocoa/ScrollingTreeStickyNode.mm:

(WebCore::ScrollingTreeStickyNode::applyLayerPositions):

LayoutTests:

  • scrollingcoordinator/ios/fixed-overflow-no-stacking-context-1-expected.html: Added.
  • scrollingcoordinator/ios/fixed-overflow-no-stacking-context-1.html: Added.
  • scrollingcoordinator/ios/fixed-overflow-no-stacking-context-2-expected.html: Added.
  • scrollingcoordinator/ios/fixed-overflow-no-stacking-context-2.html: Added.
  • scrollingcoordinator/ios/fixed-overflow-stacking-context-stationary-expected.html: Added.
  • scrollingcoordinator/ios/fixed-overflow-stacking-context-stationary.html: Added.
Location:
trunk
Files:
6 added
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r246195 r246197  
     12019-06-07  Antti Koivisto  <antti@apple.com>
     2
     3        position:fixed inside overflow positioning nodes is jumpy
     4        https://bugs.webkit.org/show_bug.cgi?id=198647
     5        <rdar://problem/51514437>
     6
     7        Reviewed by Frédéric Wang.
     8
     9        * scrollingcoordinator/ios/fixed-overflow-no-stacking-context-1-expected.html: Added.
     10        * scrollingcoordinator/ios/fixed-overflow-no-stacking-context-1.html: Added.
     11        * scrollingcoordinator/ios/fixed-overflow-no-stacking-context-2-expected.html: Added.
     12        * scrollingcoordinator/ios/fixed-overflow-no-stacking-context-2.html: Added.
     13        * scrollingcoordinator/ios/fixed-overflow-stacking-context-stationary-expected.html: Added.
     14        * scrollingcoordinator/ios/fixed-overflow-stacking-context-stationary.html: Added.
     15
    1162019-06-07  Enrique Ocaña González  <eocanha@igalia.com>
    217
  • trunk/Source/WebCore/ChangeLog

    r246195 r246197  
     12019-06-07  Antti Koivisto  <antti@apple.com>
     2
     3        position:fixed inside overflow positioning nodes is jumpy
     4        https://bugs.webkit.org/show_bug.cgi?id=198647
     5        <rdar://problem/51514437>
     6
     7        Reviewed by Frédéric Wang.
     8
     9        Tests: scrollingcoordinator/ios/fixed-overflow-no-stacking-context-1.html
     10               scrollingcoordinator/ios/fixed-overflow-no-stacking-context-2.html
     11               scrollingcoordinator/ios/fixed-overflow-stacking-context-stationary.html
     12
     13        * page/scrolling/ScrollingTreeScrollingNode.h:
     14        * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
     15        (WebCore::ScrollingTreeFixedNode::applyLayerPositions):
     16
     17        Take deltas from positioning nodes into account.
     18
     19        * page/scrolling/cocoa/ScrollingTreePositionedNode.h:
     20        * page/scrolling/cocoa/ScrollingTreePositionedNode.mm:
     21        (WebCore::ScrollingTreePositionedNode::scrollDeltaSinceLastCommit const):
     22
     23        Rename since 'scrollOffset' has other meaning.
     24
     25        (WebCore::ScrollingTreePositionedNode::applyLayerPositions):
     26        (WebCore::ScrollingTreePositionedNode::scrollOffsetSinceLastCommit const): Deleted.
     27        * page/scrolling/cocoa/ScrollingTreeStickyNode.mm:
     28        (WebCore::ScrollingTreeStickyNode::applyLayerPositions):
     29
    1302019-06-07  Enrique Ocaña González  <eocanha@igalia.com>
    231
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h

    r245818 r246197  
    5656    FloatPoint currentScrollPosition() const { return m_currentScrollPosition; }
    5757    FloatPoint lastCommittedScrollPosition() const { return m_lastCommittedScrollPosition; }
     58    FloatSize scrollDeltaSinceLastCommit() const { return m_currentScrollPosition - m_lastCommittedScrollPosition; }
    5859
    5960    // These are imperative; they adjust the scrolling layers.
  • trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.mm

    r245818 r246197  
    3434#import "ScrollingTreeFrameScrollingNode.h"
    3535#import "ScrollingTreeOverflowScrollingNode.h"
     36#import "ScrollingTreePositionedNode.h"
    3637#import "WebCoreCALayerExtras.h"
    3738#import <wtf/text/TextStream.h>
     
    7071    auto computeLayerPosition = [&] {
    7172        FloatSize overflowScrollDelta;
    72         // FIXME: This code is wrong in complex cases where the fixed element is inside a positioned node as
    73         //        the scroll container order does not match the scrolling tree ancestor order.
    74         for (auto* node = parent(); node; node = node->parent()) {
    75             if (is<ScrollingTreeFrameScrollingNode>(*node)) {
     73        for (auto* ancestor = parent(); ancestor; ancestor = ancestor->parent()) {
     74            if (is<ScrollingTreePositionedNode>(*ancestor)) {
     75                auto& positioningAncestor = downcast<ScrollingTreePositionedNode>(*ancestor);
     76                if (positioningAncestor.layer() != m_layer)
     77                    overflowScrollDelta -= positioningAncestor.scrollDeltaSinceLastCommit();
     78            }
     79
     80            if (is<ScrollingTreeFrameScrollingNode>(*ancestor)) {
    7681                // Fixed nodes are positioned relative to the containing frame scrolling node.
    7782                // We bail out after finding one.
    78                 auto layoutViewport = downcast<ScrollingTreeFrameScrollingNode>(*node).layoutViewport();
     83                auto layoutViewport = downcast<ScrollingTreeFrameScrollingNode>(*ancestor).layoutViewport();
    7984                return m_constraints.layerPositionForViewportRect(layoutViewport) - overflowScrollDelta;
    8085            }
    8186
    82             if (is<ScrollingTreeOverflowScrollingNode>(*node)) {
     87            if (is<ScrollingTreeOverflowScrollingNode>(*ancestor)) {
    8388                // To keep the layer still during async scrolling we adjust by how much the position has changed since layout.
    84                 auto& overflowNode = downcast<ScrollingTreeOverflowScrollingNode>(*node);
    85                 auto localDelta = overflowNode.lastCommittedScrollPosition() - overflowNode.currentScrollPosition();
    86                 overflowScrollDelta += localDelta;
     89                auto& overflowNode = downcast<ScrollingTreeOverflowScrollingNode>(*ancestor);
     90                overflowScrollDelta -= overflowNode.scrollDeltaSinceLastCommit();
    8791            }
    8892        }
  • trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreePositionedNode.h

    r246083 r246197  
    4747    const Vector<ScrollingNodeID>& relatedOverflowScrollingNodes() const { return m_relatedOverflowScrollingNodes; }
    4848
    49     FloatSize scrollOffsetSinceLastCommit() const;
     49    FloatSize scrollDeltaSinceLastCommit() const;
    5050
    5151private:
  • trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreePositionedNode.mm

    r246083 r246197  
    7777}
    7878
    79 FloatSize ScrollingTreePositionedNode::scrollOffsetSinceLastCommit() const
     79FloatSize ScrollingTreePositionedNode::scrollDeltaSinceLastCommit() const
    8080{
    81     FloatSize offset;
     81    FloatSize delta;
    8282    for (auto nodeID : m_relatedOverflowScrollingNodes) {
    8383        if (auto* node = scrollingTree().nodeForID(nodeID)) {
    8484            if (is<ScrollingTreeOverflowScrollingNode>(node)) {
    8585                auto& overflowNode = downcast<ScrollingTreeOverflowScrollingNode>(*node);
    86                 offset += overflowNode.currentScrollPosition() - overflowNode.lastCommittedScrollPosition();
     86                delta += overflowNode.scrollDeltaSinceLastCommit();
    8787            }
    8888        }
     
    9090    if (m_constraints.scrollPositioningBehavior() == ScrollPositioningBehavior::Stationary) {
    9191        // Stationary nodes move in the opposite direction.
    92         return -offset;
     92        return -delta;
    9393    }
    9494
    95     return offset;
     95    return delta;
    9696}
    9797
    9898void ScrollingTreePositionedNode::applyLayerPositions()
    9999{
    100     auto offset = scrollOffsetSinceLastCommit();
    101     auto layerPosition = m_constraints.layerPositionAtLastLayout() - offset;
     100    auto delta = scrollDeltaSinceLastCommit();
     101    auto layerPosition = m_constraints.layerPositionAtLastLayout() - delta;
    102102
    103     LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreePositionedNode " << scrollingNodeID() << " applyLayerPositions: overflow delta " << offset << " moving layer to " << layerPosition);
     103    LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreePositionedNode " << scrollingNodeID() << " applyLayerPositions: overflow delta " << delta << " moving layer to " << layerPosition);
    104104
    105105    [m_layer _web_setLayerTopLeftPosition:layerPosition - m_constraints.alignmentOffset()];
  • trunk/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNode.mm

    r246083 r246197  
    9898                    if (positioningAncestor.layer() == m_layer) {
    9999                        // We'll also do the adjustment the positioning node would do.
    100                         position -= positioningAncestor.scrollOffsetSinceLastCommit();
     100                        position -= positioningAncestor.scrollDeltaSinceLastCommit();
    101101                    }
    102102                   
Note: See TracChangeset for help on using the changeset viewer.