REGRESSION (r252205?): [ Mac wk2 ] tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler.html became very flaky
https://bugs.webkit.org/show_bug.cgi?id=206296

Reviewed by Ryosuke Niwa.

Attempt to de-flake this test. It was using js-test-pre/post, but not jsTestIsAsync/finishJSTest(), and seemed to sometimes
dump testPassed() a second even after notifyDone() was called. The <pre> is made fixed size so that the length of the layer
tree dump doesn't change the layer sizes.

Also clean it up to remove unused CSS and script.

* platform/mac-wk2/TestExpectations:
* tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler-expected.txt:
* tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler.html:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@254793 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index c65a0d3..5600c92 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2020-01-17  Simon Fraser  <simon.fraser@apple.com>
+
+        REGRESSION (r252205?): [ Mac wk2 ] tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler.html became very flaky
+        https://bugs.webkit.org/show_bug.cgi?id=206296
+
+        Reviewed by Ryosuke Niwa.
+
+        Attempt to de-flake this test. It was using js-test-pre/post, but not jsTestIsAsync/finishJSTest(), and seemed to sometimes
+        dump testPassed() a second even after notifyDone() was called. The <pre> is made fixed size so that the length of the layer
+        tree dump doesn't change the layer sizes.
+
+        Also clean it up to remove unused CSS and script.
+
+        * platform/mac-wk2/TestExpectations:
+        * tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler-expected.txt:
+        * tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler.html:
+
 2020-01-17  Lauro Moura  <lmoura@igalia.com>
 
         [GTK] Gardening mouse cursor style change tests
diff --git a/LayoutTests/platform/mac-wk2/TestExpectations b/LayoutTests/platform/mac-wk2/TestExpectations
index 70f6d83..37a18d8 100644
--- a/LayoutTests/platform/mac-wk2/TestExpectations
+++ b/LayoutTests/platform/mac-wk2/TestExpectations
@@ -927,5 +927,3 @@
 webkit.org/b/205301 [ Mojave+ ] inspector/canvas/requestShaderSource-webgpu.html [ Pass Failure ]
 
 webkit.org/b/205808 fast/text/international/unicode-bidi-other-neutrals.html [ Pass Failure ]
-
-webkit.org/b/206296 [ Debug ] tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler.html [ Pass Failure ]
\ No newline at end of file
diff --git a/LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler-expected.txt b/LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler-expected.txt
index aa77b7f..3f266d7 100644
--- a/LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler-expected.txt
+++ b/LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler-expected.txt
@@ -7,20 +7,20 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
+PASS Select did not receive wheel events.
 PASS successfullyParsed is true
 
 TEST COMPLETE
-PASS Select did not receive wheel events.
 (GraphicsLayer
   (anchor 0.00 0.00)
-  (bounds 2008.00 2266.00)
+  (bounds 2008.00 2221.00)
   (visible rect 0.00, 70.00 785.00 x 585.00)
   (coverage rect 0.00, 70.00 785.00 x 585.00)
   (intersects coverage rect 1)
   (contentsScale 1.00)
   (children 1
     (GraphicsLayer
-      (bounds 2008.00 2266.00)
+      (bounds 2008.00 2221.00)
       (contentsOpaque 1)
       (visible rect 0.00, 70.00 785.00 x 585.00)
       (coverage rect 0.00, 0.00 1570.00 x 1755.00)
diff --git a/LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler.html b/LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler.html
index ebed5a9..d680cd1 100644
--- a/LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler.html
+++ b/LayoutTests/tiled-drawing/scrolling/fast-scroll-select-latched-mainframe-with-handler.html
@@ -6,116 +6,96 @@
     width: 680px;
 }
 
-.table td, .table th {
-    padding: 2px;
-}
-
-.table th {
-    height: 20px;
-    text-align: left;
-    font-weight: strong;
-}
-
-.table tr:nth-child(odd) {
-    background: #f3f3f3;
-}
-
 .scrollable_select option:nth-child(odd) {
     background: #f3f3f3;
 }
 
+pre {
+    max-height: 200px;
+    max-width: 200px;
+}
 </style>
 <script src="../../resources/js-test-pre.js"></script>
 <script>
-var wheelCount = 0;
-function onScrollWheel(evt) {
-    wheelCount = wheelCount + 1;
-}
+    window.jsTestIsAsync = true;
 
-function onLoad() {
-    document.addEventListener("mousewheel", onScrollWheel);
-    window.addEventListener("scroll", onPageScroll);
-    setupTopLevel();
-}
+    var selectTarget;
+    var pageScrollPositionBefore;
+    var selectScrollPositionBefore;
+
+    function onPageScroll()
+    {
+        if (document.scrollingElement.scrollTop >= 70)
+            checkForScroll();
+    }
+
+    function checkForScroll()
+    {
+        // The select should not have scrolled at all.
+        var pageScrollPositionAfter = document.scrollingElement.scrollTop;
+        var selectScrollPositionAfter = selectTarget.scrollTop;
+
+        if (selectScrollPositionBefore != selectScrollPositionAfter)
+            testFailed("Select consumed wheel events.");
+        else
+            testPassed("Select did not receive wheel events.");
+
+        if (window.internals) {
+            document.getElementById('layers').innerText = internals.layerTreeAsText(document,
+                internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS | internals.LAYER_TREE_INCLUDES_TILE_CACHES);
+        }
+
+        finishJSTest();
+    }
+
+    function scrollTest()
+    {
+        selectTarget = document.getElementById('target');
+
+        pageScrollPositionBefore = document.scrollingElement.scrollTop;
+        selectScrollPositionBefore = selectTarget.scrollTop;
+
+        // Scroll the #source until we reach the #target.
+        var startPosX = Math.round(selectTarget.offsetLeft) + 20;
+        var startPosY = Math.round(selectTarget.offsetTop) - 42;
+        eventSender.mouseMoveTo(startPosX, startPosY);
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'begin');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -4, 'none', 'continue');
+        eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end');
+        eventSender.callAfterScrollingCompletes(checkForScroll);
+
+        // We should finish via the scroll event; this will fire in the case of failure when the page doesn't scroll.
+    }
+
+    function setupTest()
+    {
+        window.addEventListener("scroll", onPageScroll);
+
+        if (window.eventSender) {
+            testRunner.dumpAsText();
+            testRunner.waitUntilDone();
+
+            eventSender.monitorWheelEvents();
+            setTimeout(scrollTest, 0);
+        } else {
+            var messageLocation = document.getElementById('parent');
+            var message = document.createElement('div');
+            message.innerHTML = "<p>This test is better run under DumpRenderTree. To manually test it, place the mouse pointer<br/>"
+                + "at the top of the page, and then use the mouse wheel or a two-finger swipe to scroll down<br/>"
+                + "past the selectTarget.<br/><br/>"
+                + "You should not see the 'content21' label if this test is successful.</p>";
+            messageLocation.appendChild(message);
+        }
+    }
+    
+    window.addEventListener('load', setupTest, false);
 </script>
 </head>
-<body onload="onLoad();">
-<script>
-
-var selectTarget;
-var pageScrollPositionBefore;
-var selectScrollPositionBefore;
-var continueCount = 5;
-
-function onPageScroll()
-{
-    if (document.scrollingElement.scrollTop >= 70)
-        checkForScroll();
-}
-
-function checkForScroll()
-{
-    // The select should not have scrolled at all.
-    var pageScrollPositionAfter = document.scrollingElement.scrollTop;
-    var selectScrollPositionAfter = selectTarget.scrollTop;
-
-    if (selectScrollPositionBefore != selectScrollPositionAfter)
-        testFailed("Select consumed wheel events.");
-    else
-        testPassed("Select did not receive wheel events.");
-
-    if (window.internals) {
-        document.getElementById('layers').innerText = internals.layerTreeAsText(document,
-            internals.LAYER_TREE_INCLUDES_VISIBLE_RECTS | internals.LAYER_TREE_INCLUDES_TILE_CACHES);
-    }
-
-    testRunner.notifyDone();
-}
-
-function scrollTest()
-{
-    pageScrollPositionBefore = document.scrollingElement.scrollTop;
-
-    selectTarget = document.getElementById('target');
-
-    selectScrollPositionBefore = selectTarget.scrollTop;
-
-    // Scroll the #source until we reach the #target.
-    var startPosX = Math.round(selectTarget.offsetLeft) + 20;
-    var startPosY = Math.round(selectTarget.offsetTop) - 42;
-    eventSender.mouseMoveTo(startPosX, startPosY);
-    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'began', 'none');
-    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none');
-    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'changed', 'none');
-    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'ended', 'none');
-    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -1, 'none', 'begin');
-    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, -4, 'none', 'continue');
-    eventSender.mouseScrollByWithWheelAndMomentumPhases(0, 0, 'none', 'end');
-    eventSender.callAfterScrollingCompletes(checkForScroll);
-
-    // We should finish via the scroll event; this will fire in the case of failure when the page doesn't scroll.
-}
-
-function setupTopLevel()
-{
-    if (window.eventSender) {
-        testRunner.dumpAsText();
-        testRunner.waitUntilDone();
-
-        eventSender.monitorWheelEvents();
-        setTimeout(scrollTest, 0);
-    } else {
-        var messageLocation = document.getElementById('parent');
-        var message = document.createElement('div');
-        message.innerHTML = "<p>This test is better run under DumpRenderTree. To manually test it, place the mouse pointer<br/>"
-            + "at the top of the page, and then use the mouse wheel or a two-finger swipe to scroll down<br/>"
-            + "past the selectTarget.<br/><br/>"
-            + "You should not see the 'content21' label if this test is successful.</p>";
-        messageLocation.appendChild(message);
-    }
-}
-
-</script>
+<body>
 <div id="parent" style="height: 2000px; width: 2000px;">
     <div id="source" style="height: 100px; width: 500px;">
         Put mouse here and flick downwards