WebKit Bugzilla
Attachment 349993 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-20180917201452.patch (text/plain), 7.64 KB, created by
Sihui Liu
on 2018-09-17 20:14:53 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Sihui Liu
Created:
2018-09-17 20:14:53 PDT
Size:
7.64 KB
patch
obsolete
>Subversion Revision: 235862 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index c03842c1747f1c0b643161b689337847b8c72cd9..9060120f3095142b5407cf70fe64496ddaed4bdc 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,21 @@ >+2018-09-17 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!). >+ >+ When the window is not active, we should only update the scrollbar for mouse events. GTK >+ apps have different expectation on this behavior. >+ >+ Test: fast/events/inactive_window_no_mouse_event.html >+ >+ * page/EventHandler.cpp: >+ (WebCore::EventHandler::handleMouseMoveEvent): >+ (WebCore::EventHandler::shouldSendMouseEventsToInactiveWindows const): >+ * page/EventHandler.h: >+ > 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..8989b903dac7eef835362e9685b4bfb6197ef92c 100644 >--- a/Source/WebCore/page/EventHandler.cpp >+++ b/Source/WebCore/page/EventHandler.cpp >@@ -1964,7 +1964,9 @@ 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); >+ if (shouldSendMouseEventsToInactiveWindows()) >+ updateMouseEventTargetNode(mouseEvent.targetNode(), platformMouseEvent, true); >+ > return true; > } > } >@@ -2007,6 +2009,14 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& platformMouseE > return swallowEvent; > } > >+bool EventHandler::shouldSendMouseEventsToInactiveWindows() const >+{ >+#if PLATFORM(GTK) >+ return true; >+#endif >+ return false; >+} >+ > void EventHandler::invalidateClick() > { > m_clickCount = 0; >diff --git a/Source/WebCore/page/EventHandler.h b/Source/WebCore/page/EventHandler.h >index 75ad2681445c52b97508b59ce1ba9a11e0682fe9..c88a649169fd8aa2d8cd9d47c7e45eb6a1cdfcd8 100644 >--- a/Source/WebCore/page/EventHandler.h >+++ b/Source/WebCore/page/EventHandler.h >@@ -493,6 +493,8 @@ private: > void clearOrScheduleClearingLatchedStateIfNeeded(const PlatformWheelEvent&); > void clearLatchedState(); > >+ bool shouldSendMouseEventsToInactiveWindows() const; >+ > Frame& m_frame; > > bool m_mousePressed { false }; >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index ab1d6d73b687f8d1a119a9a686e530d54cb32c26..407d634c68702a6a9d658f578bd480a436047e9a 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,16 @@ >+2018-09-17 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!). >+ >+ * TestExpectations: >+ * fast/events/inactive_window_no_mouse_event-expected.txt: Added. >+ * fast/events/inactive_window_no_mouse_event.html: Added. >+ * platform/mac-wk2/TestExpectations: >+ > 2018-09-10 Daniel Bates <dabates@apple.com> > > [iOS] Arrow keys do not dispatch DOM events to non-editable elements >diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations >index cb40aa5c31dbc51b4c83369fa00cd24f5e418cc5..4a1ddf81186b39b1a50678ff3338d1521c6ba30d 100644 >--- a/LayoutTests/TestExpectations >+++ b/LayoutTests/TestExpectations >@@ -403,6 +403,9 @@ fast/canvas/webgl/context-update-on-display-configuration.html [ Skip ] > > fast/misc/valid-primary-screen-displayID.html [ Skip ] > >+# This test only works for mac-wk2, other platforms have different behavior or not fully support EventSender. >+fast/events/inactive_window_no_mouse_event.html [ Skip ] >+ > #////////////////////////////////////////////////////////////////////////////////////////// > # End platform-specific tests. > #////////////////////////////////////////////////////////////////////////////////////////// >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..f3d69a8fbdc060798fe967c942dd69c228c8c9d9 >--- /dev/null >+++ b/LayoutTests/fast/events/inactive_window_no_mouse_event-expected.txt >@@ -0,0 +1,12 @@ >+This test verifies no mouseenter, mouseleave or mousemove event sent to web page when window is inactive. >+ >+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". >+ >+ >+PASS mousemoveDetected is false >+PASS mouseenterCount is 0 >+PASS mouseleaveCount is 0 >+PASS successfullyParsed is true >+ >+TEST COMPLETE >+ >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..3a2876feb05949a617b478539c479bac1bdc3be0 >--- /dev/null >+++ b/LayoutTests/fast/events/inactive_window_no_mouse_event.html >@@ -0,0 +1,55 @@ >+<!DOCTYPE html> >+<html> >+<body> >+<div id="around" style="width:600px; height:600px; top:0px; left:0px; background-color:blue; position:absolute"></div> >+<div id="target" style="width:200px; height:200px; top:200px; left:200px; background-color:red; position:absolute"></div> >+ >+<script src="../../resources/js-test.js"></script> >+<script> >+jsTestIsAsync = true; >+ >+description("This test verifies no mouseenter, mouseleave or mousemove event sent to web page when window is inactive."); >+ >+var mouseenterCount = 0; >+var mouseleaveCount = 0; >+var mousemoveDetected = false; >+ >+var target = document.getElementById("target"); >+var around = document.getElementById("around"); >+target.addEventListener('mouseenter',() => { >+ debug("Mouse enters target."); >+ mouseenterCount++; >+}); >+target.addEventListener('mouseleave',() => { >+ debug("Mouse leaves target."); >+ mouseleaveCount++; >+}); >+around.addEventListener('mousemove',() => { >+ shouldBeFalse("mousemoveDetected"); >+ shouldBe("mouseenterCount", "0"); >+ shouldBe("mouseleaveCount", "0"); >+ >+ mousemoveDetected = true; >+ >+ finishJSTest(); >+}); >+ >+if (window.internals) >+ window.internals.setPageIsFocusedAndActive(false); >+ >+if (window.eventSender) { >+ eventSender.mouseMoveTo(1, 1); >+ eventSender.mouseMoveTo(300, 300); >+ eventSender.mouseMoveTo(1, 1); >+} >+ >+setTimeout(() => { >+ if (window.internals) >+ window.internals.setPageIsFocusedAndActive(true); >+ >+ if (window.eventSender) >+ eventSender.mouseMoveTo(0, 0); >+}, 200); >+</script> >+</body> >+</html> >diff --git a/LayoutTests/platform/mac-wk2/TestExpectations b/LayoutTests/platform/mac-wk2/TestExpectations >index 53e4c9de41f2db4d0f017f6d3fb8882e1c702ced..dd1a18f763c719015d793325467a447465fd96c9 100644 >--- a/LayoutTests/platform/mac-wk2/TestExpectations >+++ b/LayoutTests/platform/mac-wk2/TestExpectations >@@ -57,6 +57,8 @@ webkit.org/b/187183 http/tests/security/pasteboard-file-url.html [ Pass ] > > fast/misc/valid-primary-screen-displayID.html [ Pass ] > >+fast/events/inactive_window_no_mouse_event.html [ Pass ] >+ > #////////////////////////////////////////////////////////////////////////////////////////// > # End platform-specific directories. > #//////////////////////////////////////////////////////////////////////////////////////////
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