Title: [290955] branches/safari-613-branch
Revision
290955
Author
[email protected]
Date
2022-03-07 14:11:31 -0800 (Mon, 07 Mar 2022)

Log Message

Cherry-pick r290812. rdar://problem/84662329

    Element with position: sticky after sticking, starts to move incorrectly when scrolling
    https://bugs.webkit.org/show_bug.cgi?id=231953
    <rdar://84662329>

    Reviewed by Sam Weinig.

    Source/WebCore:

    Sometimes we'd fail to push new StickyPositionViewportConstraints to the scrolling
    tree, because operator== failed to compare m_constrainingRectAtLastLayout. This breaks
    the requirement that the "last committed scroll position" for the overflow scrolling
    node has to be updated in the same commit as the "constraining-rect-at-last-layout"
    on the sticky node.

    Test: scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints.html

    * page/scrolling/ScrollingConstraints.cpp:
    (WebCore::operator<<):
    * page/scrolling/ScrollingConstraints.h:
    (WebCore::StickyPositionViewportConstraints::operator== const):

    LayoutTests:

    * platform/ios-wk2/scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt: Added.
    * scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt: Added.
    * scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints.html: Added.

    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290812 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Modified Paths

Added Paths

Diff

Modified: branches/safari-613-branch/LayoutTests/ChangeLog (290954 => 290955)


--- branches/safari-613-branch/LayoutTests/ChangeLog	2022-03-07 22:11:27 UTC (rev 290954)
+++ branches/safari-613-branch/LayoutTests/ChangeLog	2022-03-07 22:11:31 UTC (rev 290955)
@@ -1,5 +1,51 @@
 2022-03-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r290812. rdar://problem/84662329
+
+    Element with position: sticky after sticking, starts to move incorrectly when scrolling
+    https://bugs.webkit.org/show_bug.cgi?id=231953
+    <rdar://84662329>
+    
+    Reviewed by Sam Weinig.
+    
+    Source/WebCore:
+    
+    Sometimes we'd fail to push new StickyPositionViewportConstraints to the scrolling
+    tree, because operator== failed to compare m_constrainingRectAtLastLayout. This breaks
+    the requirement that the "last committed scroll position" for the overflow scrolling
+    node has to be updated in the same commit as the "constraining-rect-at-last-layout"
+    on the sticky node.
+    
+    Test: scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints.html
+    
+    * page/scrolling/ScrollingConstraints.cpp:
+    (WebCore::operator<<):
+    * page/scrolling/ScrollingConstraints.h:
+    (WebCore::StickyPositionViewportConstraints::operator== const):
+    
+    LayoutTests:
+    
+    * platform/ios-wk2/scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt: Added.
+    * scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt: Added.
+    * scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290812 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-03  Simon Fraser  <[email protected]>
+
+            Element with position: sticky after sticking, starts to move incorrectly when scrolling
+            https://bugs.webkit.org/show_bug.cgi?id=231953
+            <rdar://84662329>
+
+            Reviewed by Sam Weinig.
+
+            * platform/ios-wk2/scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt: Added.
+            * scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt: Added.
+            * scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints.html: Added.
+
+2022-03-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r290785. rdar://problem/66568551
 
     nasa.gov page with fixed backgrounds paints incorrectly on scroll

Added: branches/safari-613-branch/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt (0 => 290955)


--- branches/safari-613-branch/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/platform/ios-wk2/scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt	2022-03-07 22:11:31 UTC (rev 290955)
@@ -0,0 +1,46 @@
+Hello
+
+(Frame scrolling node
+  (scrollable area size 800 600)
+  (contents size 800 600)
+  (scrollable area parameters
+    (horizontal scroll elasticity 1)
+    (vertical scroll elasticity 1)
+    (horizontal scrollbar mode 0)
+    (vertical scrollbar mode 0))
+  (layout viewport at (0,0) size 800x600)
+  (min layout viewport origin (0,0))
+  (max layout viewport origin (0,0))
+  (behavior for fixed 0)
+  (children 2
+    (Overflow scrolling node
+      (scroll position 0 380)
+      (scrollable area size 300 500)
+      (contents size 300 1400)
+      (requested scroll position 0 380)
+      (requested scroll position represents programmatic scroll 1)
+      (scrollable area parameters
+        (horizontal scroll elasticity 1)
+        (vertical scroll elasticity 1)
+        (horizontal scrollbar mode 0)
+        (vertical scrollbar mode 0)
+        (allows vertical scrolling 1))
+    )
+    (Overflow scroll proxy node
+      (related overflow scrolling node scroll position (0,380))
+      (children 1
+        (Sticky node
+          (anchor edges: AnchorEdgeTop )
+          (top offset 0.00)
+          (containing block rect at (0,0) size 300x1400)
+          (sticky box rect at (0,400) size 300x200)
+          (constraining rect at (0,380) size 300x500)
+          (sticky offset at last layout width=0 height=0)
+          (layer position at last layout (0,400))
+        )
+      )
+    )
+  )
+)
+
+

Added: branches/safari-613-branch/LayoutTests/scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt (0 => 290955)


--- branches/safari-613-branch/LayoutTests/scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt	2022-03-07 22:11:31 UTC (rev 290955)
@@ -0,0 +1,46 @@
+Hello
+
+(Frame scrolling node
+  (scrollable area size 800 600)
+  (contents size 800 600)
+  (scrollable area parameters
+    (horizontal scroll elasticity 2)
+    (vertical scroll elasticity 2)
+    (horizontal scrollbar mode 0)
+    (vertical scrollbar mode 0))
+  (layout viewport at (0,0) size 800x600)
+  (min layout viewport origin (0,0))
+  (max layout viewport origin (0,0))
+  (behavior for fixed 0)
+  (children 2
+    (Overflow scrolling node
+      (scroll position 0 380)
+      (scrollable area size 285 500)
+      (contents size 285 1400)
+      (requested scroll position 0 380)
+      (requested scroll position represents programmatic scroll 1)
+      (scrollable area parameters
+        (horizontal scroll elasticity 1)
+        (vertical scroll elasticity 0)
+        (horizontal scrollbar mode 0)
+        (vertical scrollbar mode 0)
+        (allows vertical scrolling 1))
+    )
+    (Overflow scroll proxy node
+      (related overflow scrolling node scroll position (0,380))
+      (children 1
+        (Sticky node
+          (anchor edges: AnchorEdgeTop )
+          (top offset 0.00)
+          (containing block rect at (0,0) size 285x1400)
+          (sticky box rect at (0,400) size 285x200)
+          (constraining rect at (0,380) size 285x500)
+          (sticky offset at last layout width=0 height=0)
+          (layer position at last layout (0,400))
+        )
+      )
+    )
+  )
+)
+
+

Added: branches/safari-613-branch/LayoutTests/scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints.html (0 => 290955)


--- branches/safari-613-branch/LayoutTests/scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints.html	                        (rev 0)
+++ branches/safari-613-branch/LayoutTests/scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints.html	2022-03-07 22:11:31 UTC (rev 290955)
@@ -0,0 +1,65 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true ] -->
+<html>
+<head>
+<style>
+    .scroll {
+        width: 300px;
+        height: 500px;
+        overflow: auto;
+        border: 1px solid red;
+        background-color: red;
+    }
+    .spacer {
+        height: 400px;
+        border: 2px solid blue;
+        background-color: silver;
+        box-sizing: border-box;
+    }
+    .sticky {
+        position: sticky;
+        top: 0;
+        height: 200px;
+        background-color: yellow;
+        outline: 1px solid lightblue;
+        outline-offset: -1px;
+        font-size: 78px;
+    }
+</style>
+<script>
+    if (window.testRunner) {
+        testRunner.dumpAsText();
+        testRunner.waitUntilDone();
+    }
+
+    function dumpTreeAndFinish()
+    {
+        if (window.internals)
+            document.getElementById('scrollingTree').innerText = window.internals.scrollingStateTreeAsText() + "\n";
+
+        if (window.testRunner)
+            testRunner.notifyDone();
+    }
+    
+    window.addEventListener('load', function() {
+        requestAnimationFrame(() => {
+            let scroller = document.querySelector('.scroll');
+            scroller.scrollTop = 400;
+            
+            requestAnimationFrame(() => {
+                scroller.scrollTop = 380;
+                dumpTreeAndFinish();
+            })
+        });
+    }, false);
+</script>
+</head>
+<body>
+    <div class="scroll">
+        <div class="spacer"></div>
+        <div class="sticky">Hello</div>
+        <div class="spacer"></div>
+        <div class="spacer"></div>
+    </div>
+    <pre id="scrollingTree"></pre>
+</body>
+</html>

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (290954 => 290955)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-03-07 22:11:27 UTC (rev 290954)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-03-07 22:11:31 UTC (rev 290955)
@@ -1,5 +1,60 @@
 2022-03-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r290812. rdar://problem/84662329
+
+    Element with position: sticky after sticking, starts to move incorrectly when scrolling
+    https://bugs.webkit.org/show_bug.cgi?id=231953
+    <rdar://84662329>
+    
+    Reviewed by Sam Weinig.
+    
+    Source/WebCore:
+    
+    Sometimes we'd fail to push new StickyPositionViewportConstraints to the scrolling
+    tree, because operator== failed to compare m_constrainingRectAtLastLayout. This breaks
+    the requirement that the "last committed scroll position" for the overflow scrolling
+    node has to be updated in the same commit as the "constraining-rect-at-last-layout"
+    on the sticky node.
+    
+    Test: scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints.html
+    
+    * page/scrolling/ScrollingConstraints.cpp:
+    (WebCore::operator<<):
+    * page/scrolling/ScrollingConstraints.h:
+    (WebCore::StickyPositionViewportConstraints::operator== const):
+    
+    LayoutTests:
+    
+    * platform/ios-wk2/scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt: Added.
+    * scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints-expected.txt: Added.
+    * scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints.html: Added.
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@290812 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-03-03  Simon Fraser  <[email protected]>
+
+            Element with position: sticky after sticking, starts to move incorrectly when scrolling
+            https://bugs.webkit.org/show_bug.cgi?id=231953
+            <rdar://84662329>
+
+            Reviewed by Sam Weinig.
+
+            Sometimes we'd fail to push new StickyPositionViewportConstraints to the scrolling
+            tree, because operator== failed to compare m_constrainingRectAtLastLayout. This breaks
+            the requirement that the "last committed scroll position" for the overflow scrolling
+            node has to be updated in the same commit as the "constraining-rect-at-last-layout"
+            on the sticky node.
+
+            Test: scrollingcoordinator/scrolling-tree/sticky-in-overflow-stale-constraints.html
+
+            * page/scrolling/ScrollingConstraints.cpp:
+            (WebCore::operator<<):
+            * page/scrolling/ScrollingConstraints.h:
+            (WebCore::StickyPositionViewportConstraints::operator== const):
+
+2022-03-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r290785. rdar://problem/66568551
 
     nasa.gov page with fixed backgrounds paints incorrectly on scroll

Modified: branches/safari-613-branch/Source/WebCore/page/scrolling/ScrollingConstraints.cpp (290954 => 290955)


--- branches/safari-613-branch/Source/WebCore/page/scrolling/ScrollingConstraints.cpp	2022-03-07 22:11:27 UTC (rev 290954)
+++ branches/safari-613-branch/Source/WebCore/page/scrolling/ScrollingConstraints.cpp	2022-03-07 22:11:31 UTC (rev 290955)
@@ -130,6 +130,10 @@
     ts.dumpProperty("sticky-position-at-last-layout", constraints.stickyOffsetAtLastLayout());
     ts.dumpProperty("layer-position-at-last-layout", constraints.layerPositionAtLastLayout());
 
+    ts.dumpProperty("sticky-box-rect", constraints.stickyBoxRect());
+    ts.dumpProperty("containing-block-rect", constraints.containingBlockRect());
+    ts.dumpProperty("constraining-rect-at-last-layout", constraints.constrainingRectAtLastLayout());
+
     return ts;
 }
 

Modified: branches/safari-613-branch/Source/WebCore/page/scrolling/ScrollingConstraints.h (290954 => 290955)


--- branches/safari-613-branch/Source/WebCore/page/scrolling/ScrollingConstraints.h	2022-03-07 22:11:27 UTC (rev 290954)
+++ branches/safari-613-branch/Source/WebCore/page/scrolling/ScrollingConstraints.h	2022-03-07 22:11:31 UTC (rev 290955)
@@ -174,6 +174,7 @@
             && m_rightOffset == other.m_rightOffset
             && m_topOffset == other.m_topOffset
             && m_bottomOffset == other.m_bottomOffset
+            && m_constrainingRectAtLastLayout == other.m_constrainingRectAtLastLayout
             && m_containingBlockRect == other.m_containingBlockRect
             && m_stickyBoxRect == other.m_stickyBoxRect
             && m_stickyOffsetAtLastLayout == other.m_stickyOffsetAtLastLayout
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to