Title: [238840] trunk
Revision
238840
Author
[email protected]
Date
2018-12-03 20:03:46 -0800 (Mon, 03 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:

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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238839 => 238840)


--- trunk/LayoutTests/ChangeLog	2018-12-04 04:03:13 UTC (rev 238839)
+++ trunk/LayoutTests/ChangeLog	2018-12-04 04:03:46 UTC (rev 238840)
@@ -1,3 +1,14 @@
+2018-12-03  Simon Fraser  <[email protected]>
+
+        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.
+
 2018-12-03  Justin Michaud  <[email protected]>
 
         CSS Painting API should scale display list when drawing

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


--- 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 04:03:46 UTC (rev 238840)
@@ -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 => 238840)


--- trunk/LayoutTests/compositing/fixed-with-main-thread-scrolling.html	                        (rev 0)
+++ trunk/LayoutTests/compositing/fixed-with-main-thread-scrolling.html	2018-12-04 04:03:46 UTC (rev 238840)
@@ -0,0 +1,60 @@
+<!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.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");
+            testRunner.notifyDone();
+        }
+
+        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/Source/WebCore/ChangeLog (238839 => 238840)


--- trunk/Source/WebCore/ChangeLog	2018-12-04 04:03:13 UTC (rev 238839)
+++ trunk/Source/WebCore/ChangeLog	2018-12-04 04:03:46 UTC (rev 238840)
@@ -1,3 +1,23 @@
+2018-12-03  Simon Fraser  <[email protected]>
+
+        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.
+        
+        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-03  Justin Michaud  <[email protected]>
 
         CSS Painting API should scale display list when drawing

Modified: trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp (238839 => 238840)


--- trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2018-12-04 04:03:13 UTC (rev 238839)
+++ trunk/Source/WebCore/rendering/RenderLayerCompositor.cpp	2018-12-04 04:03:46 UTC (rev 238840)
@@ -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
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to