Title: [242683] trunk/LayoutTests
Revision
242683
Author
[email protected]
Date
2019-03-09 21:52:21 -0800 (Sat, 09 Mar 2019)

Log Message

Add a test for scrolling tree adjustment of fixed layers (r242601)
https://bugs.webkit.org/show_bug.cgi?id=195521

Reviewed by Sam Weinig.

This test sets the "unstable" scrolling state (as if the user is actively scrolling) and scrolls,
then changes style to trigger a scrolling tree commit with a changed offset for a fixed layer.
The test shows the wrong fixed layer position before r242601.

Helpers are added to UIHelper to do the scroll, and to wrap setTimeout in an async function.
Sadly we have to wait about 120ms for the scrollbars to fade out.

* resources/ui-helper.js:
(window.UIHelper.async.delayFor):
(window.UIHelper.async.immediateScrollTo):
(window.UIHelper.async.immediateUnstableScrollTo):
* scrollingcoordinator/ios/ui-scroll-fixed-expected.html: Added.
* scrollingcoordinator/ios/ui-scroll-fixed.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (242682 => 242683)


--- trunk/LayoutTests/ChangeLog	2019-03-10 05:43:36 UTC (rev 242682)
+++ trunk/LayoutTests/ChangeLog	2019-03-10 05:52:21 UTC (rev 242683)
@@ -1,3 +1,24 @@
+2019-03-09  Simon Fraser  <[email protected]>
+
+        Add a test for scrolling tree adjustment of fixed layers (r242601)
+        https://bugs.webkit.org/show_bug.cgi?id=195521
+
+        Reviewed by Sam Weinig.
+        
+        This test sets the "unstable" scrolling state (as if the user is actively scrolling) and scrolls,
+        then changes style to trigger a scrolling tree commit with a changed offset for a fixed layer.
+        The test shows the wrong fixed layer position before r242601.
+
+        Helpers are added to UIHelper to do the scroll, and to wrap setTimeout in an async function.
+        Sadly we have to wait about 120ms for the scrollbars to fade out.
+
+        * resources/ui-helper.js:
+        (window.UIHelper.async.delayFor):
+        (window.UIHelper.async.immediateScrollTo):
+        (window.UIHelper.async.immediateUnstableScrollTo):
+        * scrollingcoordinator/ios/ui-scroll-fixed-expected.html: Added.
+        * scrollingcoordinator/ios/ui-scroll-fixed.html: Added.
+
 2019-03-09  Wenson Hsieh  <[email protected]>
 
         REGRESSION (r242551): Sporadic hangs when tapping to change selection on iOS

Modified: trunk/LayoutTests/resources/ui-helper.js (242682 => 242683)


--- trunk/LayoutTests/resources/ui-helper.js	2019-03-10 05:43:36 UTC (rev 242682)
+++ trunk/LayoutTests/resources/ui-helper.js	2019-03-10 05:52:21 UTC (rev 242683)
@@ -197,6 +197,38 @@
         });
     }
 
+    static async delayFor(ms)
+    {
+        return new Promise(resolve => setTimeout(resolve, ms));
+    }
+    
+    static async immediateScrollTo(x, y)
+    {
+        if (!this.isWebKit2()) {
+            window.scrollTo(x, y);
+            return Promise.resolve();
+        }
+
+        await new Promise(resolve => {
+            testRunner.runUIScript(`
+                uiController.immediateScrollToOffset(${x}, ${y});`, resolve);
+        });
+    }
+
+    static async immediateUnstableScrollTo(x, y)
+    {
+        if (!this.isWebKit2()) {
+            window.scrollTo(x, y);
+            return Promise.resolve();
+        }
+
+        await new Promise(resolve => {
+            testRunner.runUIScript(`
+                uiController.stableStateOverride = false;
+                uiController.immediateScrollToOffset(${x}, ${y});`, resolve);
+        });
+    }
+
     static ensureVisibleContentRectUpdate()
     {
         if (!this.isWebKit2())

Added: trunk/LayoutTests/scrollingcoordinator/ios/ui-scroll-fixed-expected.html (0 => 242683)


--- trunk/LayoutTests/scrollingcoordinator/ios/ui-scroll-fixed-expected.html	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/ios/ui-scroll-fixed-expected.html	2019-03-10 05:52:21 UTC (rev 242683)
@@ -0,0 +1,57 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+    <meta name="viewport" content="initial-scale=1.0">
+    <style>
+        body {
+            height: 2000px;
+            margin: 0;
+        }
+
+        #fixed {
+            position: fixed;
+            top: 200px;
+            left: 20px;
+            height: 100px;
+            width: calc(100% - 40px);
+            background-color: blue;
+        }
+        
+        #container {
+            position: absolute;
+            z-index: 0;
+            top: 100px;
+            left: 0;
+            height: 400px;
+            width: 100%;
+            border: 2px solid black;
+            box-sizing: border-box;
+            overflow: hidden; /* Forces compositing on this layer */
+        }
+    </style>
+    <script src=""
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        async function runTest()
+        {
+            if (!testRunner.runUIScript)
+                return
+
+            await UIHelper.delayFor(0);
+            await UIHelper.immediateUnstableScrollTo(0, 50);
+            await UIHelper.delayFor(120); // Wait for scrollbars to disappear.
+            testRunner.notifyDone();
+        }
+        
+        window.addEventListener('load', runTest, false);
+    </script>
+</head>
+<body>
+    <div id="container">
+        <div id="fixed"></div>
+    </div>
+</body>
+</html>

Added: trunk/LayoutTests/scrollingcoordinator/ios/ui-scroll-fixed.html (0 => 242683)


--- trunk/LayoutTests/scrollingcoordinator/ios/ui-scroll-fixed.html	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/ios/ui-scroll-fixed.html	2019-03-10 05:52:21 UTC (rev 242683)
@@ -0,0 +1,62 @@
+<!DOCTYPE html> <!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+
+<html>
+<head>
+    <meta name="viewport" content="initial-scale=1.0">
+    <style>
+        body {
+            height: 2000px;
+            margin: 0;
+        }
+
+        #fixed {
+            position: fixed;
+            top: 200px;
+            left: 20px;
+            height: 100px;
+            width: calc(100% - 40px);
+            background-color: blue;
+        }
+        
+        #container {
+            position: absolute;
+            z-index: 0;
+            top: 50px;
+            left: 0;
+            height: 400px;
+            width: 100%;
+            border: 2px solid black;
+            box-sizing: border-box;
+            overflow: hidden; /* Forces compositing on this layer */
+        }
+        
+        #container.changed {
+            top: 100px;
+        }
+    </style>
+    <script src=""
+    <script>
+        if (window.testRunner)
+            testRunner.waitUntilDone();
+
+        async function runTest()
+        {
+            if (!testRunner.runUIScript)
+                return
+
+            await UIHelper.delayFor(0);
+            await UIHelper.immediateUnstableScrollTo(0, 50);
+            await UIHelper.delayFor((120)); // Wait for scrollbars to disappear.
+            document.getElementById('container').classList.add('changed');
+            testRunner.notifyDone();
+        }
+        
+        window.addEventListener('load', runTest, false);
+    </script>
+</head>
+<body>
+    <div id="container">
+        <div id="fixed"></div>
+    </div>
+</body>
+</html>
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to