Title: [261211] trunk
Revision
261211
Author
[email protected]
Date
2020-05-05 20:53:56 -0700 (Tue, 05 May 2020)

Log Message

Minor EventHandler and test cleanup
https://bugs.webkit.org/show_bug.cgi?id=211475

Reviewed by Zalan Bujtas.

Source/WebCore:

Now that we assert that m_elementUnderMouse and m_lastElementUnderMouse are either null
or in this EventHandler's document, we can remove the document comparisons (but this code
is probably wrong as well).

Fix enclosingScrollableArea(), which would return any RenderLayer, but should only
return scrollable ones, and should only return scrollable RenderListBoxes.

* page/EventHandler.cpp:
(WebCore::enclosingScrollableArea):
(WebCore::EventHandler::updateMouseEventTargetNode):

LayoutTests:

Clean up some tests that were mixing js-test and notifyDone().

* fast/scrolling/scroll-animator-basic-events-expected.txt:
* fast/scrolling/scroll-animator-basic-events.html:
* fast/scrolling/scroll-animator-overlay-scrollbars-clicked-expected.txt:
* fast/scrolling/scroll-animator-overlay-scrollbars-clicked.html:
* fast/scrolling/scroll-animator-overlay-scrollbars-hovered-expected.txt:
* fast/scrolling/scroll-animator-overlay-scrollbars-hovered.html:
* fast/scrolling/scroll-animator-select-list-events-expected.txt:
* fast/scrolling/scroll-animator-select-list-events.html:
* platform/mac-wk1/fast/scrolling/scroll-animator-basic-events-expected.txt:
* platform/mac-wk1/fast/scrolling/scroll-animator-select-list-events-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (261210 => 261211)


--- trunk/LayoutTests/ChangeLog	2020-05-06 03:45:38 UTC (rev 261210)
+++ trunk/LayoutTests/ChangeLog	2020-05-06 03:53:56 UTC (rev 261211)
@@ -1,3 +1,23 @@
+2020-05-05  Simon Fraser  <[email protected]>
+
+        Minor EventHandler and test cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=211475
+
+        Reviewed by Zalan Bujtas.
+
+        Clean up some tests that were mixing js-test and notifyDone().
+
+        * fast/scrolling/scroll-animator-basic-events-expected.txt:
+        * fast/scrolling/scroll-animator-basic-events.html:
+        * fast/scrolling/scroll-animator-overlay-scrollbars-clicked-expected.txt:
+        * fast/scrolling/scroll-animator-overlay-scrollbars-clicked.html:
+        * fast/scrolling/scroll-animator-overlay-scrollbars-hovered-expected.txt:
+        * fast/scrolling/scroll-animator-overlay-scrollbars-hovered.html:
+        * fast/scrolling/scroll-animator-select-list-events-expected.txt:
+        * fast/scrolling/scroll-animator-select-list-events.html:
+        * platform/mac-wk1/fast/scrolling/scroll-animator-basic-events-expected.txt:
+        * platform/mac-wk1/fast/scrolling/scroll-animator-select-list-events-expected.txt:
+
 2020-05-05  Chris Dumez  <[email protected]>
 
         fast/overflow/horizontal-scroll-after-back.html is a flaky timeout on macOS

Modified: trunk/LayoutTests/fast/scrolling/scroll-animator-basic-events-expected.txt (261210 => 261211)


--- trunk/LayoutTests/fast/scrolling/scroll-animator-basic-events-expected.txt	2020-05-06 03:45:38 UTC (rev 261210)
+++ trunk/LayoutTests/fast/scrolling/scroll-animator-basic-events-expected.txt	2020-05-06 03:53:56 UTC (rev 261211)
@@ -11,9 +11,9 @@
 CONSOLE MESSAGE: RenderLayer: mouseExitedVerticalScrollbar
 CONSOLE MESSAGE: RenderLayer: mouseExitedContentArea
 CONSOLE MESSAGE: MainFrameView: mouseMovedInContentArea
+This is a scrollable div.
+
 PASS successfullyParsed is true
 
 TEST COMPLETE
-This is a scrollable div.
 
-

Modified: trunk/LayoutTests/fast/scrolling/scroll-animator-basic-events.html (261210 => 261211)


--- trunk/LayoutTests/fast/scrolling/scroll-animator-basic-events.html	2020-05-06 03:45:38 UTC (rev 261210)
+++ trunk/LayoutTests/fast/scrolling/scroll-animator-basic-events.html	2020-05-06 03:53:56 UTC (rev 261211)
@@ -11,28 +11,24 @@
 </style>
 <script src=""
 <script>
-  if (window.internals) {
-      window.internals.setUsesMockScrollAnimator(true);
-  }
-  if (window.testRunner) {
-      testRunner.waitUntilDone();
-      testRunner.dumpAsText();
-  }
-  window._onload_ = function () {
+    jsTestIsAsync = true;
     if (window.internals)
-        internals.updateLayoutAndStyleForAllFrames();
-      var div = document.querySelector('#scrollme');
-      if (window.eventSender) {
-          eventSender.mouseMoveTo(0, 0);
-          eventSender.mouseMoveTo(div.offsetLeft + 1, div.offsetTop + 1);
-          eventSender.mouseMoveTo(div.offsetLeft + div.offsetWidth - 4, div.offsetTop + 1);
-          eventSender.mouseDown();
-          eventSender.mouseUp();
-          eventSender.mouseMoveTo(0, 0);
-      }
-      if (window.testRunner)
-          testRunner.notifyDone();
-  };
+        window.internals.setUsesMockScrollAnimator(true);
+
+    window._onload_ = function() {
+        if (window.internals)
+            internals.updateLayoutAndStyleForAllFrames();
+        var div = document.querySelector('#scrollme');
+        if (window.eventSender) {
+            eventSender.mouseMoveTo(0, 0);
+            eventSender.mouseMoveTo(div.offsetLeft + 1, div.offsetTop + 1);
+            eventSender.mouseMoveTo(div.offsetLeft + div.offsetWidth - 4, div.offsetTop + 1);
+            eventSender.mouseDown();
+            eventSender.mouseUp();
+            eventSender.mouseMoveTo(0, 0);
+        }
+        finishJSTest();
+    };
 </script>
 <script src=""
 <body>

Modified: trunk/LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-clicked-expected.txt (261210 => 261211)


--- trunk/LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-clicked-expected.txt	2020-05-06 03:45:38 UTC (rev 261210)
+++ trunk/LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-clicked-expected.txt	2020-05-06 03:53:56 UTC (rev 261211)
@@ -8,10 +8,10 @@
 CONSOLE MESSAGE: MainFrameView: mouseExitedVerticalScrollbar
 CONSOLE MESSAGE: FrameView: mouseExitedContentArea
 CONSOLE MESSAGE: MainFrameView: mouseMovedInContentArea
+Test for https://bugs.webkit.org/show_bug.cgi?id=165056.
+
+
 PASS successfullyParsed is true
 
 TEST COMPLETE
-Test for https://bugs.webkit.org/show_bug.cgi?id=165056.
 
-
-

Modified: trunk/LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-clicked.html (261210 => 261211)


--- trunk/LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-clicked.html	2020-05-06 03:45:38 UTC (rev 261210)
+++ trunk/LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-clicked.html	2020-05-06 03:53:56 UTC (rev 261211)
@@ -1,30 +1,25 @@
 <html>
 <script src=""
 <script>
-if (window.internals) {
-    window.internals.setUsesMockScrollAnimator(true);
-    window.internals.setUsesOverlayScrollbars(true);
-}
+    jsTestIsAsync = true;
+    if (window.internals) {
+        window.internals.setUsesMockScrollAnimator(true);
+        window.internals.setUsesOverlayScrollbars(true);
+    }
 
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
-
-function runTest() {
-    if (window.internals)
-        internals.updateLayoutAndStyleForAllFrames();
-    if (window.eventSender) {
-        eventSender.mouseMoveTo(0, 0);
-        // Move to a position that is over the vertical scrollbar and the iframe.
-        eventSender.mouseMoveTo(window.innerWidth - 4, 100);
-        eventSender.mouseDown();
-        eventSender.mouseUp();
-        eventSender.mouseMoveTo(0, 0);
-    }
-    if (window.testRunner)
-        testRunner.notifyDone();
-};
+    function runTest() {
+        if (window.internals)
+            internals.updateLayoutAndStyleForAllFrames();
+        if (window.eventSender) {
+            eventSender.mouseMoveTo(0, 0);
+            // Move to a position that is over the vertical scrollbar and the iframe.
+            eventSender.mouseMoveTo(window.innerWidth - 4, 100);
+            eventSender.mouseDown();
+            eventSender.mouseUp();
+            eventSender.mouseMoveTo(0, 0);
+        }
+        finishJSTest();
+    };
 </script>
 <script src=""
 <body>

Modified: trunk/LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-hovered-expected.txt (261210 => 261211)


--- trunk/LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-hovered-expected.txt	2020-05-06 03:45:38 UTC (rev 261210)
+++ trunk/LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-hovered-expected.txt	2020-05-06 03:53:56 UTC (rev 261211)
@@ -6,10 +6,10 @@
 CONSOLE MESSAGE: FrameView: mouseExitedHorizontalScrollbar
 CONSOLE MESSAGE: FrameView: mouseExitedContentArea
 CONSOLE MESSAGE: MainFrameView: mouseMovedInContentArea
+Test for https://bugs.webkit.org/show_bug.cgi?id=153304.
+
+
 PASS successfullyParsed is true
 
 TEST COMPLETE
-Test for https://bugs.webkit.org/show_bug.cgi?id=153304.
 
-
-

Modified: trunk/LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-hovered.html (261210 => 261211)


--- trunk/LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-hovered.html	2020-05-06 03:45:38 UTC (rev 261210)
+++ trunk/LayoutTests/fast/scrolling/scroll-animator-overlay-scrollbars-hovered.html	2020-05-06 03:53:56 UTC (rev 261211)
@@ -1,26 +1,23 @@
 <html>
 <script src=""
 <script>
-if (window.internals) {
-    window.internals.setUsesMockScrollAnimator(true);
-    window.internals.setUsesOverlayScrollbars(true);
-}
-if (window.testRunner) {
-    testRunner.waitUntilDone();
-    testRunner.dumpAsText();
-}
-function runTest() {
-    if (window.internals)
-        internals.updateLayoutAndStyleForAllFrames();
-    document.body.offsetHeight;
-    if (window.eventSender) {
-        eventSender.mouseMoveTo(0, 0);
-        eventSender.mouseMoveTo(frame.offsetLeft + 4, frame.offsetTop + frame.offsetHeight - 4);
-        eventSender.mouseMoveTo(0, 0);
+    jsTestIsAsync = true;
+    if (window.internals) {
+        window.internals.setUsesMockScrollAnimator(true);
+        window.internals.setUsesOverlayScrollbars(true);
     }
-    if (window.testRunner)
-        testRunner.notifyDone();
-};
+
+    function runTest() {
+        if (window.internals)
+            internals.updateLayoutAndStyleForAllFrames();
+        document.body.offsetHeight;
+        if (window.eventSender) {
+            eventSender.mouseMoveTo(0, 0);
+            eventSender.mouseMoveTo(frame.offsetLeft + 4, frame.offsetTop + frame.offsetHeight - 4);
+            eventSender.mouseMoveTo(0, 0);
+        }
+        finishJSTest();
+    };
 </script>
 <script src=""
 <body>

Modified: trunk/LayoutTests/fast/scrolling/scroll-animator-select-list-events-expected.txt (261210 => 261211)


--- trunk/LayoutTests/fast/scrolling/scroll-animator-select-list-events-expected.txt	2020-05-06 03:45:38 UTC (rev 261210)
+++ trunk/LayoutTests/fast/scrolling/scroll-animator-select-list-events-expected.txt	2020-05-06 03:53:56 UTC (rev 261211)
@@ -11,10 +11,10 @@
 CONSOLE MESSAGE: RenderListBox: mouseExitedVerticalScrollbar
 CONSOLE MESSAGE: RenderListBox: mouseExitedContentArea
 CONSOLE MESSAGE: MainFrameView: mouseMovedInContentArea
+Test for https://bugs.webkit.org/show_bug.cgi?id=153398.
+
+
 PASS successfullyParsed is true
 
 TEST COMPLETE
-Test for https://bugs.webkit.org/show_bug.cgi?id=153398.
 
-
-

Modified: trunk/LayoutTests/fast/scrolling/scroll-animator-select-list-events.html (261210 => 261211)


--- trunk/LayoutTests/fast/scrolling/scroll-animator-select-list-events.html	2020-05-06 03:45:38 UTC (rev 261210)
+++ trunk/LayoutTests/fast/scrolling/scroll-animator-select-list-events.html	2020-05-06 03:53:56 UTC (rev 261211)
@@ -1,28 +1,24 @@
 <html>
 <script src=""
 <script>
-  if (window.internals) {
-      window.internals.setUsesMockScrollAnimator(true);
-  }
-  if (window.testRunner) {
-      testRunner.waitUntilDone();
-      testRunner.dumpAsText();
-  }
-  window._onload_ = function () {
+    jsTestIsAsync = true;
     if (window.internals)
-        internals.updateLayoutAndStyleForAllFrames();
-      var list = document.getElementById("list");
-      if (window.eventSender) {
-          eventSender.mouseMoveTo(0, 0);
-          eventSender.mouseMoveTo(list.offsetLeft + 1, list.offsetTop + 1);
-          eventSender.mouseMoveTo(list.offsetLeft + list.offsetWidth - 4, list.offsetTop + 1);
-          eventSender.mouseDown();
-          eventSender.mouseUp();
-          eventSender.mouseMoveTo(0, 0);
-      }
-      if (window.testRunner)
-          testRunner.notifyDone();
-  };
+        window.internals.setUsesMockScrollAnimator(true);
+
+    window._onload_ = function() {
+        if (window.internals)
+            internals.updateLayoutAndStyleForAllFrames();
+        var list = document.getElementById("list");
+        if (window.eventSender) {
+            eventSender.mouseMoveTo(0, 0);
+            eventSender.mouseMoveTo(list.offsetLeft + 1, list.offsetTop + 1);
+            eventSender.mouseMoveTo(list.offsetLeft + list.offsetWidth - 4, list.offsetTop + 1);
+            eventSender.mouseDown();
+            eventSender.mouseUp();
+            eventSender.mouseMoveTo(0, 0);
+        }
+        finishJSTest();
+    };
 </script>
 <script src=""
 <body>

Modified: trunk/LayoutTests/platform/mac-wk1/fast/scrolling/scroll-animator-basic-events-expected.txt (261210 => 261211)


--- trunk/LayoutTests/platform/mac-wk1/fast/scrolling/scroll-animator-basic-events-expected.txt	2020-05-06 03:45:38 UTC (rev 261210)
+++ trunk/LayoutTests/platform/mac-wk1/fast/scrolling/scroll-animator-basic-events-expected.txt	2020-05-06 03:53:56 UTC (rev 261211)
@@ -7,9 +7,9 @@
 CONSOLE MESSAGE: RenderLayer: mouseMovedInContentArea
 CONSOLE MESSAGE: RenderLayer: mouseExitedVerticalScrollbar
 CONSOLE MESSAGE: RenderLayer: mouseExitedContentArea
+This is a scrollable div.
+
 PASS successfullyParsed is true
 
 TEST COMPLETE
-This is a scrollable div.
 
-

Modified: trunk/LayoutTests/platform/mac-wk1/fast/scrolling/scroll-animator-select-list-events-expected.txt (261210 => 261211)


--- trunk/LayoutTests/platform/mac-wk1/fast/scrolling/scroll-animator-select-list-events-expected.txt	2020-05-06 03:45:38 UTC (rev 261210)
+++ trunk/LayoutTests/platform/mac-wk1/fast/scrolling/scroll-animator-select-list-events-expected.txt	2020-05-06 03:53:56 UTC (rev 261211)
@@ -7,10 +7,10 @@
 CONSOLE MESSAGE: RenderListBox: mouseMovedInContentArea
 CONSOLE MESSAGE: RenderListBox: mouseExitedVerticalScrollbar
 CONSOLE MESSAGE: RenderListBox: mouseExitedContentArea
+Test for https://bugs.webkit.org/show_bug.cgi?id=153398.
+
+
 PASS successfullyParsed is true
 
 TEST COMPLETE
-Test for https://bugs.webkit.org/show_bug.cgi?id=153398.
 
-
-

Modified: trunk/Source/WebCore/ChangeLog (261210 => 261211)


--- trunk/Source/WebCore/ChangeLog	2020-05-06 03:45:38 UTC (rev 261210)
+++ trunk/Source/WebCore/ChangeLog	2020-05-06 03:53:56 UTC (rev 261211)
@@ -1,3 +1,21 @@
+2020-05-05  Simon Fraser  <[email protected]>
+
+        Minor EventHandler and test cleanup
+        https://bugs.webkit.org/show_bug.cgi?id=211475
+
+        Reviewed by Zalan Bujtas.
+
+        Now that we assert that m_elementUnderMouse and m_lastElementUnderMouse are either null
+        or in this EventHandler's document, we can remove the document comparisons (but this code
+        is probably wrong as well).
+
+        Fix enclosingScrollableArea(), which would return any RenderLayer, but should only
+        return scrollable ones, and should only return scrollable RenderListBoxes.
+
+        * page/EventHandler.cpp:
+        (WebCore::enclosingScrollableArea):
+        (WebCore::EventHandler::updateMouseEventTargetNode):
+
 2020-05-05  David Kilzer  <[email protected]>
 
         Fix deprecated NSGraphicsContext methods using 'graphicsPort'

Modified: trunk/Source/WebCore/page/EventHandler.cpp (261210 => 261211)


--- trunk/Source/WebCore/page/EventHandler.cpp	2020-05-06 03:45:38 UTC (rev 261210)
+++ trunk/Source/WebCore/page/EventHandler.cpp	2020-05-06 03:53:56 UTC (rev 261211)
@@ -1890,10 +1890,17 @@
         if (!renderer)
             continue;
 
-        if (is<RenderListBox>(*renderer))
-            return downcast<RenderListBox>(renderer);
+        if (is<RenderListBox>(*renderer)) {
+            auto* scrollableArea = static_cast<ScrollableArea*>(downcast<RenderListBox>(renderer));
+            if (scrollableArea->isScrollableOrRubberbandable())
+                return scrollableArea;
+        }
 
-        return renderer->enclosingLayer();
+        auto* layer = renderer->enclosingLayer();
+        if (!layer)
+            return nullptr;
+
+        return layer->enclosingScrollableLayer(IncludeSelfOrNot::IncludeSelf, CrossFrameBoundaries::No);
     }
 
     return nullptr;
@@ -2546,7 +2553,7 @@
         auto scrollableAreaForNodeUnderMouse = enclosingScrollableArea(m_elementUnderMouse.get());
         Page* page = m_frame.page();
 
-        if (m_lastElementUnderMouse && (!m_elementUnderMouse || &m_elementUnderMouse->document() != m_frame.document())) {
+        if (m_lastElementUnderMouse && !m_elementUnderMouse) {
             // The mouse has moved between frames.
             if (Frame* frame = m_lastElementUnderMouse->document().frame()) {
                 if (FrameView* frameView = frame->view())
@@ -2562,7 +2569,7 @@
             }
         }
 
-        if (m_elementUnderMouse && (!m_lastElementUnderMouse || &m_lastElementUnderMouse->document() != m_frame.document())) {
+        if (m_elementUnderMouse && !m_lastElementUnderMouse) {
             // The mouse has moved between frames.
             if (Frame* frame = m_elementUnderMouse->document().frame()) {
                 if (FrameView* frameView = frame->view())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to