WebKit Bugzilla
Attachment 349774 Details for
Bug 187545
: REGRESSION(r196265): WKWebView fires mouseover, mouseenter, and mouseleave events even when it's in a background window
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-187545-20180914103356.patch (text/plain), 6.13 KB, created by
Sihui Liu
on 2018-09-14 10:33:57 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Sihui Liu
Created:
2018-09-14 10:33:57 PDT
Size:
6.13 KB
patch
obsolete
>Subversion Revision: 235862 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c03842c1747f1c0b643161b689337847b8c72cd9..8ee0ede9069bbba9cde26c4a555f2274784dd201 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,18 @@ >+2018-09-14 Sihui Liu <sihui_liu@apple.com> >+ >+ REGRESSION (r196265): WKWebView fires mouseover, mouseenter, and mouseleave events even when it's in a background window >+ https://bugs.webkit.org/show_bug.cgi?id=187545 >+ <rdar://problem/42401575> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ We should only update the scrollbar for for mouse event if the window is not active. >+ >+ Test: fast/events/inactive_window_no_mouse_event.html >+ >+ * page/EventHandler.cpp: >+ (WebCore::EventHandler::handleMouseMoveEvent): >+ > 2018-09-10 Simon Fraser <simon.fraser@apple.com> > > svg/W3C-SVG-1.1/render-groups-03-t.svg and some other SVG tests leak documents >diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp >index 36504769757ba13922ba6c8ef9f8f89e3f086adf..c14e2ca753fff0ae1e6438c98924c2adb6485c4d 100644 >--- a/Source/WebCore/page/EventHandler.cpp >+++ b/Source/WebCore/page/EventHandler.cpp >@@ -1964,7 +1964,7 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& platformMouseE > scrollbar->mouseMoved(platformMouseEvent); // Handle hover effects on platforms that support visual feedback on scrollbar hovering. > #endif > if (onlyUpdateScrollbars) { >- updateMouseEventTargetNode(mouseEvent.targetNode(), platformMouseEvent, true); >+ sendPointerCrossingEventsIfNeeded(); > return true; > } > } >@@ -2007,6 +2007,14 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& platformMouseE > return swallowEvent; > } > >+void EventHandler::sendPointerCrossingEventsIfNeeded() >+{ >+// GTK apps expect to receive mouse events when window is not active. >+#if PLATFORM(GTK) >+ updateMouseEventTargetNode(mouseEvent.targetNode(), platformMouseEvent, true); >+#endif >+} >+ > void EventHandler::invalidateClick() > { > m_clickCount = 0; >diff --git a/Source/WebCore/page/EventHandler.h b/Source/WebCore/page/EventHandler.h >index 75ad2681445c52b97508b59ce1ba9a11e0682fe9..e2917fc9f208907509e3c12d907acd5a7ebca3ee 100644 >--- a/Source/WebCore/page/EventHandler.h >+++ b/Source/WebCore/page/EventHandler.h >@@ -493,6 +493,8 @@ private: > void clearOrScheduleClearingLatchedStateIfNeeded(const PlatformWheelEvent&); > void clearLatchedState(); > >+ void sendPointerCrossingEventsIfNeeded(); >+ > Frame& m_frame; > > bool m_mousePressed { false }; >diff --git a/LayoutTests/fast/events/inactive_window_no_mouse_event-expected.txt b/LayoutTests/fast/events/inactive_window_no_mouse_event-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..e69eb3f3150c79575c2cfa387cd93a21a70d8411 >--- /dev/null >+++ b/LayoutTests/fast/events/inactive_window_no_mouse_event-expected.txt >@@ -0,0 +1,9 @@ >+This tests what happens when the window is inactive. To manually run the test, open the page in Safari. Open another app like TextEdit which makes Safari window inactive. Move mouse to the red square on the page, you should see no new statements about mouse event. >+ >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+PASS mousemoveDetected is false >+PASS mouseenterCount is 0 >+PASS mouseleaveCount is 0 >+ >diff --git a/LayoutTests/fast/events/inactive_window_no_mouse_event.html b/LayoutTests/fast/events/inactive_window_no_mouse_event.html >new file mode 100644 >index 0000000000000000000000000000000000000000..3e6d226509bf3851f50b323be975d6ecbca87485 >--- /dev/null >+++ b/LayoutTests/fast/events/inactive_window_no_mouse_event.html >@@ -0,0 +1,59 @@ >+<!DOCTYPE html> >+<html> >+<body> >+<script src="../../resources/js-test.js"></script> >+<script> >+function log(message) { >+ document.getElementById('console').innerHTML += (message + "\n"); >+} >+ >+var mouseenterCount = 0; >+var mouseleaveCount = 0; >+var mousemoveDetected = false; >+ >+document.addEventListener("DOMContentLoaded", function(event) { >+ >+ var target = document.getElementById("target"); >+ target.addEventListener('mouseenter',() => { >+ log("Mouse enters target."); >+ mouseenterCount ++; >+ }); >+ target.addEventListener('mouseleave',() => { >+ log("Mouse leaves target."); >+ mouseleaveCount ++; >+ }); >+ document.body.addEventListener('mousemove',() => { >+ shouldBeFalse("mousemoveDetected"); >+ shouldBe("mouseenterCount", "0"); >+ shouldBe("mouseleaveCount", "0"); >+ >+ mousemoveDetected = true; >+ >+ if (window.testRunner) { >+ testRunner.notifyDone(); >+ } >+ }); >+ >+ window.internals.setPageIsFocusedAndActive(false); >+ >+ eventSender.mouseMoveTo(1, 1); >+ eventSender.mouseMoveTo(300, 300); >+ eventSender.mouseMoveTo(1, 1); >+ >+ if (window.testRunner) { >+ testRunner.waitUntilDone(); >+ } >+ >+ setTimeout(() => { >+ window.internals.setPageIsFocusedAndActive(true); >+ eventSender.mouseMoveTo(100, 100); >+ }, 200); >+}); >+</script> >+ >+<p>This tests what happens when the window is inactive. To manually run the test, open the page in Safari. Open another app like TextEdit which makes Safari window inactive. Move mouse to the red square on the page, you should see no new statements about mouse event.</p> >+<div id="target" style="width:200px; height:200px; top:200px; left:200px; background-color:red; position:absolute"> >+</div> >+<pre id="console"></pre> >+</body> >+</html> >diff --git a/LayoutTests/platform/gtk/TestExpectations b/LayoutTests/platform/gtk/TestExpectations >index 4b5201496cca9cb737139004ae2649cd63e77a09..9b379755c37015ecd2e02f7522d193eb2eb27c17 100644 >--- a/LayoutTests/platform/gtk/TestExpectations >+++ b/LayoutTests/platform/gtk/TestExpectations >@@ -1217,6 +1217,9 @@ editing/spelling/text-replacement-after-typing-to-word.html [ Skip ] > # Depends on mac-specific code in TestController. > webkit.org/b/187550 http/tests/plugins/plugin-allow-then-reload.html [ Failure ] > >+# Expects different behaviors on GTK >+webkit.org/b/187545 fast/events/inactive_window_no_mouse_event.html [ Skip ] >+ > #//////////////////////////////////////////////////////////////////////////////////////// > # End of Expected failures. > #
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 187545
:
349690
|
349743
|
349748
|
349750
|
349752
|
349753
|
349754
|
349762
|
349765
|
349768
|
349770
|
349774
|
349786
|
349788
|
349789
|
349790
|
349805
|
349824
|
349825
|
349836
|
349876
|
349878
|
349936
|
349993
|
350266