Title: [238876] trunk
Revision
238876
Author
simon.fra...@apple.com
Date
2018-12-04 14:58:36 -0800 (Tue, 04 Dec 2018)

Log Message

REGRESSION (r238090): position:fixed sidebar on https://www.w3.org/TR/SVG2/coords.html does not stay fixed
https://bugs.webkit.org/show_bug.cgi?id=192320
<rdar://problem/46429833>

Reviewed by Zalan Bujtas.
Source/WebCore:

Re-land r238840 with a more reliable test.

When we fall into slow scrolling mode (for example, because of background-attachment: fixed),
RenderLayerCompositor::updateCompositingLayers() needs to set the geometry dirty bit on layers
for viewport-constrained objects so we update them.

This is only necessary for page scrolling; for overflow scrolls, updateLayerPositions() already
does enough dirtying that fixed layers nested inside scrollers get updated.

Test: compositing/fixed-with-main-thread-scrolling.html

* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateCompositingLayers):

LayoutTests:

* compositing/fixed-with-main-thread-scrolling-expected.html: Added.
* compositing/fixed-with-main-thread-scrolling.html: Added.
* platform/ios/TestExpectations:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238875 => 238876)


--- trunk/LayoutTests/ChangeLog	2018-12-04 22:33:24 UTC (rev 238875)
+++ trunk/LayoutTests/ChangeLog	2018-12-04 22:58:36 UTC (rev 238876)
@@ -1,3 +1,15 @@
+2018-12-04  Simon Fraser  <simon.fra...@apple.com>
+
+        REGRESSION (r238090): position:fixed sidebar on https://www.w3.org/TR/SVG2/coords.html does not stay fixed
+        https://bugs.webkit.org/show_bug.cgi?id=192320
+        <rdar://problem/46429833>
+
+        Reviewed by Zalan Bujtas.
+
+        * compositing/fixed-with-main-thread-scrolling-expected.html: Added.
+        * compositing/fixed-with-main-thread-scrolling.html: Added.
+        * platform/ios/TestExpectations:
+
 2018-12-04  Youenn Fablet  <you...@apple.com>
 
         [iOS] Layout Test imported/w3c/web-platform-tests/service-workers/service-worker/fetch-cors-xhr.https.html is a flaky failure

Added: trunk/LayoutTests/compositing/fixed-with-main-thread-scrolling-expected.html (0 => 238876)


--- trunk/LayoutTests/compositing/fixed-with-main-thread-scrolling-expected.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/fixed-with-main-thread-scrolling-expected.html	2018-12-04 22:58:36 UTC (rev 238876)
@@ -0,0 +1,36 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        body {
+            height: 6000px;
+        }
+        .box {
+            position: absolute;
+            top: 5718px;
+            left: 10px;
+            width: 200px;
+            height: 200px;
+            background-color: green;
+        }
+        
+        .fixed-background {
+            margin-top: 300px;
+            height: 200px;
+            background-image: linear-gradient(white, silver);
+            background-attachment: fixed;
+        }
+    </style>
+</head>
+<body>
+
+<div class="box"></div>
+
+<div class="fixed-background">
+    I have a fixed background.
+</div>
+<script>
+    window.scrollTo(0, 6000);
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/compositing/fixed-with-main-thread-scrolling.html (0 => 238876)


--- trunk/LayoutTests/compositing/fixed-with-main-thread-scrolling.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/fixed-with-main-thread-scrolling.html	2018-12-04 22:58:36 UTC (rev 238876)
@@ -0,0 +1,65 @@
+<!DOCTYPE html>
+<html>
+<head>
+    <style>
+        body {
+            height: 6000px;
+        }
+        .box {
+            position: fixed;
+            top: 10px;
+            left: 10px;
+            width: 200px;
+            height: 200px;
+            background-color: green;
+        }
+        
+        .fixed-background {
+            margin-top: 300px;
+            height: 200px;
+            background-image: linear-gradient(white, silver);
+            background-attachment: fixed;
+        }
+    </style>
+    <script>
+        if (window.testRunner) {
+            testRunner.waitUntilDone();
+        }
+
+        function scrollTest()
+        {
+            eventSender.mouseMoveTo(20, 20);
+            eventSender.monitorWheelEvents();
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, "began", "none");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -100, "changed", "none");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -100, "changed", "none");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, "changed", "none");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "ended", "none");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -100, "none", "begin");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -100, "none", "continue");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -100, "none", "continue");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -100, "none", "continue");
+            eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, "none", "end");
+            eventSender.callAfterScrollingCompletes(() => {
+                setTimeout(() => {
+                    testRunner.notifyDone()                
+                }, 0);
+            });
+        }
+
+        window.addEventListener('load', () => {
+            setTimeout(() => {
+                scrollTest();
+            }, 0)
+        }, false);
+    </script>
+</head>
+<body>
+
+<div class="box"></div>
+
+<div class="fixed-background">
+    I have a fixed background.
+</div>
+</body>
+</html>

Modified: trunk/LayoutTests/platform/ios/TestExpectations (238875 => 238876)


--- trunk/LayoutTests/platform/ios/TestExpectations	2018-12-04 22:33:24 UTC (rev 238875)
+++ trunk/LayoutTests/platform/ios/TestExpectations	2018-12-04 22:58:36 UTC (rev 238876)
@@ -794,6 +794,7 @@
 fast/text/all-small-caps-whitespace.html [ Skip ]
 
 # These tests rely on EventSender.keydown(), which is not supported on iOS
+compositing/fixed-with-main-thread-scrolling.html [ Skip ]
 editing/caret/emoji.html [ WontFix ]
 editing/deleting/5729680.html [ Skip ]
 editing/deleting/delete-by-word-001.html [ Skip ]

Modified: trunk/Source/WebCore/ChangeLog (238875 => 238876)


--- trunk/Source/WebCore/ChangeLog	2018-12-04 22:33:24 UTC (rev 238875)
+++ trunk/Source/WebCore/ChangeLog	2018-12-04 22:58:36 UTC (rev 238876)
@@ -1,3 +1,25 @@
+2018-12-04  Simon Fraser  <simon.fra...@apple.com>
+
+        REGRESSION (r238090): position:fixed sidebar on https://www.w3.org/TR/SVG2/coords.html does not stay fixed
+        https://bugs.webkit.org/show_bug.cgi?id=192320
+        <rdar://problem/46429833>
+
+        Reviewed by Zalan Bujtas.
+        
+        Re-land r238840 with a more reliable test.
+        
+        When we fall into slow scrolling mode (for example, because of background-attachment: fixed),
+        RenderLayerCompositor::updateCompositingLayers() needs to set the geometry dirty bit on layers
+        for viewport-constrained objects so we update them.
+        
+        This is only necessary for page scrolling; for overflow scrolls, updateLayerPositions() already
+        does enough dirtying that fixed layers nested inside scrollers get updated.
+
+        Test: compositing/fixed-with-main-thread-scrolling.html
+
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::updateCompositingLayers):
+
 2018-12-04  Youenn Fablet  <you...@apple.com>
 
         Fix MediaRecorder flaky tests

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (238875 => 238876)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2018-12-04 22:33:24 UTC (rev 238875)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2018-12-04 22:58:36 UTC (rev 238876)
@@ -666,9 +666,20 @@
     if (!m_compositing && (m_forceCompositingMode || (isMainFrameCompositor() && page().pageOverlayController().overlayCount())))
         enableCompositingMode(true);
 
+    bool isPageScroll = !updateRoot || updateRoot == &rootRenderLayer();
     updateRoot = &rootRenderLayer();
 
     if (updateType == CompositingUpdateType::OnScroll || updateType == CompositingUpdateType::OnCompositedScroll) {
+        // We only get here if we didn't scroll on the scrolling thread, so this update needs to re-position viewport-constrained layers.
+        if (m_renderView.settings().acceleratedCompositingForFixedPositionEnabled() && isPageScroll) {
+            if (auto* viewportConstrainedObjects = m_renderView.frameView().viewportConstrainedObjects()) {
+                for (auto* renderer : *viewportConstrainedObjects) {
+                    if (auto* layer = renderer->layer())
+                        layer->setNeedsCompositingGeometryUpdate();
+                }
+            }
+        }
+
         // Scrolling can affect overlap. FIXME: avoid for page scrolling.
         updateRoot->setDescendantsNeedCompositingRequirementsTraversal();
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to