Title: [289300] branches/safari-613-branch/Source/WebCore
Revision
289300
Author
[email protected]
Date
2022-02-07 18:55:01 -0800 (Mon, 07 Feb 2022)

Log Message

Cherry-pick r288536. rdar://problem/87981122

    REGRESSION (r286932): Fixed position elements jiggle sometimes (Twitter, Facebook)
    https://bugs.webkit.org/show_bug.cgi?id=235543
    <rdar://87981122>

    Reviewed by Tim Horton.

    In r286932 we ensure that the scrolling layer's position gets committed in the scrolling
    thread to reduce stutters. However, we also have to do the same for fixed and sticky
    layers, because they need to committed in synchrony with the scrolling layer.

    Also change some 'override' to 'final' and add locking annotations.

    * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
    * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
    (WebCore::ScrollingTreeFixedNode::applyLayerPositions):
    * page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.h:
    * page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.mm:
    (WebCore::ScrollingTreeStickyNodeCocoa::applyLayerPositions):

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

Modified Paths

Diff

Modified: branches/safari-613-branch/Source/WebCore/ChangeLog (289299 => 289300)


--- branches/safari-613-branch/Source/WebCore/ChangeLog	2022-02-08 02:54:57 UTC (rev 289299)
+++ branches/safari-613-branch/Source/WebCore/ChangeLog	2022-02-08 02:55:01 UTC (rev 289300)
@@ -1,5 +1,52 @@
 2022-02-07  Russell Epstein  <[email protected]>
 
+        Cherry-pick r288536. rdar://problem/87981122
+
+    REGRESSION (r286932): Fixed position elements jiggle sometimes (Twitter, Facebook)
+    https://bugs.webkit.org/show_bug.cgi?id=235543
+    <rdar://87981122>
+    
+    Reviewed by Tim Horton.
+    
+    In r286932 we ensure that the scrolling layer's position gets committed in the scrolling
+    thread to reduce stutters. However, we also have to do the same for fixed and sticky
+    layers, because they need to committed in synchrony with the scrolling layer.
+    
+    Also change some 'override' to 'final' and add locking annotations.
+    
+    * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
+    * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
+    (WebCore::ScrollingTreeFixedNode::applyLayerPositions):
+    * page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.h:
+    * page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.mm:
+    (WebCore::ScrollingTreeStickyNodeCocoa::applyLayerPositions):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@288536 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2022-01-24  Simon Fraser  <[email protected]>
+
+            REGRESSION (r286932): Fixed position elements jiggle sometimes (Twitter, Facebook)
+            https://bugs.webkit.org/show_bug.cgi?id=235543
+            <rdar://87981122>
+
+            Reviewed by Tim Horton.
+
+            In r286932 we ensure that the scrolling layer's position gets committed in the scrolling
+            thread to reduce stutters. However, we also have to do the same for fixed and sticky
+            layers, because they need to committed in synchrony with the scrolling layer.
+
+            Also change some 'override' to 'final' and add locking annotations.
+
+            * page/scrolling/cocoa/ScrollingTreeFixedNode.h:
+            * page/scrolling/cocoa/ScrollingTreeFixedNode.mm:
+            (WebCore::ScrollingTreeFixedNode::applyLayerPositions):
+            * page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.h:
+            * page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.mm:
+            (WebCore::ScrollingTreeStickyNodeCocoa::applyLayerPositions):
+
+2022-02-07  Russell Epstein  <[email protected]>
+
         Cherry-pick r288493. rdar://problem/82554226
 
     REGRESSION (iOS 15): HTMLAudioElement fails to load new audio when device is locked or safari is in background

Modified: branches/safari-613-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.h (289299 => 289300)


--- branches/safari-613-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.h	2022-02-08 02:54:57 UTC (rev 289299)
+++ branches/safari-613-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.h	2022-02-08 02:55:01 UTC (rev 289300)
@@ -28,6 +28,7 @@
 #if ENABLE(ASYNC_SCROLLING)
 
 #include "ScrollingConstraints.h"
+#include "ScrollingTree.h"
 #include "ScrollingTreeNode.h"
 #include <wtf/RetainPtr.h>
 
@@ -46,10 +47,10 @@
 private:
     ScrollingTreeFixedNode(ScrollingTree&, ScrollingNodeID);
 
-    void commitStateBeforeChildren(const ScrollingStateNode&) override;
-    void applyLayerPositions() override;
+    void commitStateBeforeChildren(const ScrollingStateNode&) final;
+    void applyLayerPositions() final WTF_REQUIRES_LOCK(scrollingTree().treeLock());
 
-    void dumpProperties(WTF::TextStream&, OptionSet<ScrollingStateTreeAsTextBehavior>) const override;
+    void dumpProperties(WTF::TextStream&, OptionSet<ScrollingStateTreeAsTextBehavior>) const final;
 
     FixedPositionViewportConstraints m_constraints;
     RetainPtr<CALayer> m_layer;

Modified: branches/safari-613-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.mm (289299 => 289300)


--- branches/safari-613-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.mm	2022-02-08 02:54:57 UTC (rev 289299)
+++ branches/safari-613-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeFixedNode.mm	2022-02-08 02:55:01 UTC (rev 289300)
@@ -30,6 +30,7 @@
 
 #import "Logging.h"
 #import "ScrollingStateFixedNode.h"
+#import "ScrollingThread.h"
 #import "ScrollingTree.h"
 #import "ScrollingTreeFrameScrollingNode.h"
 #import "ScrollingTreeOverflowScrollProxyNode.h"
@@ -126,6 +127,14 @@
 
     LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeFixedNode " << scrollingNodeID() << " relatedNodeScrollPositionDidChange: viewportRectAtLastLayout " << m_constraints.viewportRectAtLastLayout() << " last layer pos " << m_constraints.layerPositionAtLastLayout() << " layerPosition " << layerPosition);
 
+#if ENABLE(SCROLLING_THREAD)
+    if (ScrollingThread::isCurrentThread()) {
+        // Match the behavior of ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers().
+        if (!scrollingTree().isScrollingSynchronizedWithMainThread())
+            [m_layer _web_setLayerTopLeftPosition:CGPointZero];
+    }
+#endif
+
     [m_layer _web_setLayerTopLeftPosition:layerPosition - m_constraints.alignmentOffset()];
 }
 

Modified: branches/safari-613-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.h (289299 => 289300)


--- branches/safari-613-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.h	2022-02-08 02:54:57 UTC (rev 289299)
+++ branches/safari-613-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.h	2022-02-08 02:55:01 UTC (rev 289300)
@@ -28,6 +28,7 @@
 #if ENABLE(ASYNC_SCROLLING)
 
 #include "ScrollingConstraints.h"
+#include "ScrollingTree.h"
 #include "ScrollingTreeStickyNode.h"
 #include <wtf/RetainPtr.h>
 
@@ -46,9 +47,9 @@
 private:
     ScrollingTreeStickyNodeCocoa(ScrollingTree&, ScrollingNodeID);
 
-    void commitStateBeforeChildren(const ScrollingStateNode&) override;
-    void applyLayerPositions() override;
-    FloatPoint layerTopLeft() const override;
+    void commitStateBeforeChildren(const ScrollingStateNode&) final;
+    void applyLayerPositions() final WTF_REQUIRES_LOCK(scrollingTree().treeLock());
+    FloatPoint layerTopLeft() const final;
 
     RetainPtr<CALayer> m_layer;
 };

Modified: branches/safari-613-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.mm (289299 => 289300)


--- branches/safari-613-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.mm	2022-02-08 02:54:57 UTC (rev 289299)
+++ branches/safari-613-branch/Source/WebCore/page/scrolling/cocoa/ScrollingTreeStickyNodeCocoa.mm	2022-02-08 02:55:01 UTC (rev 289300)
@@ -30,6 +30,7 @@
 
 #import "Logging.h"
 #import "ScrollingStateStickyNode.h"
+#import "ScrollingThread.h"
 #import "ScrollingTree.h"
 #import "WebCoreCALayerExtras.h"
 #import <wtf/text/TextStream.h>
@@ -62,6 +63,14 @@
 
     LOG_WITH_STREAM(Scrolling, stream << "ScrollingTreeStickyNodeCocoa " << scrollingNodeID() << " constrainingRectAtLastLayout " << m_constraints.constrainingRectAtLastLayout() << " last layer pos " << m_constraints.layerPositionAtLastLayout() << " layerPosition " << layerPosition);
 
+#if ENABLE(SCROLLING_THREAD)
+    if (ScrollingThread::isCurrentThread()) {
+        // Match the behavior of ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers().
+        if (!scrollingTree().isScrollingSynchronizedWithMainThread())
+            [m_layer _web_setLayerTopLeftPosition:CGPointZero];
+    }
+#endif
+
     [m_layer _web_setLayerTopLeftPosition:layerPosition - m_constraints.alignmentOffset()];
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to