Title: [266664] trunk/Source/WebCore
Revision
266664
Author
[email protected]
Date
2020-09-05 10:55:35 -0700 (Sat, 05 Sep 2020)

Log Message

REGRESSION (r260571): Scrolling on weather.com in Safari causes the gradient background to flicker (fixed backgrounds)
https://bugs.webkit.org/show_bug.cgi?id=216192
<rdar://problem/68192010>

Reviewed by Tim Horton.

If a page has slow-scrolling reasons, like background-attachment:fixed on a non-root element,
then we should never update layer positions on the scrolling thread, since this results
in scroll position being out of sync with the painted background position.

* page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::canUpdateLayersOnScrollingThread const):
(WebCore::ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout):
(WebCore::ThreadedScrollingTree::delayedRenderingUpdateDetectionTimerFired):
(WebCore::ThreadedScrollingTree::displayDidRefreshOnScrollingThread):
* page/scrolling/ThreadedScrollingTree.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (266663 => 266664)


--- trunk/Source/WebCore/ChangeLog	2020-09-05 17:51:09 UTC (rev 266663)
+++ trunk/Source/WebCore/ChangeLog	2020-09-05 17:55:35 UTC (rev 266664)
@@ -1,3 +1,22 @@
+2020-09-04  Simon Fraser  <[email protected]>
+
+        REGRESSION (r260571): Scrolling on weather.com in Safari causes the gradient background to flicker (fixed backgrounds)
+        https://bugs.webkit.org/show_bug.cgi?id=216192
+        <rdar://problem/68192010>
+
+        Reviewed by Tim Horton.
+
+        If a page has slow-scrolling reasons, like background-attachment:fixed on a non-root element,
+        then we should never update layer positions on the scrolling thread, since this results
+        in scroll position being out of sync with the painted background position.
+
+        * page/scrolling/ThreadedScrollingTree.cpp:
+        (WebCore::ThreadedScrollingTree::canUpdateLayersOnScrollingThread const):
+        (WebCore::ThreadedScrollingTree::waitForRenderingUpdateCompletionOrTimeout):
+        (WebCore::ThreadedScrollingTree::delayedRenderingUpdateDetectionTimerFired):
+        (WebCore::ThreadedScrollingTree::displayDidRefreshOnScrollingThread):
+        * page/scrolling/ThreadedScrollingTree.h:
+
 2020-09-05  Myles C. Maxfield  <[email protected]>
 
         [Cocoa] Unify implementation of custom font name aliases between all Cocoa platforms

Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp (266663 => 266664)


--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2020-09-05 17:51:09 UTC (rev 266663)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp	2020-09-05 17:55:35 UTC (rev 266664)
@@ -116,6 +116,12 @@
     }
 }
 
+bool ThreadedScrollingTree::canUpdateLayersOnScrollingThread() const
+{
+    auto* rootNode = this->rootNode();
+    return !(rootNode && rootNode->hasSynchronousScrollingReasons());
+}
+
 void ThreadedScrollingTree::scrollingTreeNodeDidScroll(ScrollingTreeScrollingNode& node, ScrollingLayerPositionAction scrollingLayerPositionAction)
 {
     if (!m_scrollingCoordinator)
@@ -258,7 +264,8 @@
         m_state = SynchronizationState::Desynchronized;
         // At this point we know the main thread is taking too long in the rendering update,
         // so we give up trying to sync with the main thread and update layers here on the scrolling thread.
-        applyLayerPositionsInternal();
+        if (canUpdateLayersOnScrollingThread())
+            applyLayerPositionsInternal();
         tracePoint(ScrollingThreadRenderUpdateSyncEnd, 1);
     } else
         tracePoint(ScrollingThreadRenderUpdateSyncEnd);
@@ -291,7 +298,8 @@
     ASSERT(ScrollingThread::isCurrentThread());
 
     LockHolder treeLocker(m_treeMutex);
-    applyLayerPositionsInternal();
+    if (canUpdateLayersOnScrollingThread())
+        applyLayerPositionsInternal();
     m_state = SynchronizationState::Desynchronized;
 }
 
@@ -302,7 +310,7 @@
 
     LockHolder treeLocker(m_treeMutex);
 
-    if (m_state != SynchronizationState::Idle)
+    if (m_state != SynchronizationState::Idle && canUpdateLayersOnScrollingThread())
         applyLayerPositionsInternal();
 
     switch (m_state) {

Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h (266663 => 266664)


--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h	2020-09-05 17:51:09 UTC (rev 266663)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h	2020-09-05 17:55:35 UTC (rev 266664)
@@ -81,6 +81,8 @@
 
     void displayDidRefreshOnScrollingThread();
     void waitForRenderingUpdateCompletionOrTimeout();
+    
+    bool canUpdateLayersOnScrollingThread() const;
 
     void scheduleDelayedRenderingUpdateDetectionTimer(Seconds);
     void delayedRenderingUpdateDetectionTimerFired();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to