WebKit Bugzilla
Attachment 349825 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-20180914161706.patch (text/plain), 6.94 KB, created by
Sihui Liu
on 2018-09-14 16:17:07 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Sihui Liu
Created:
2018-09-14 16:17:07 PDT
Size:
6.94 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..8d00c00eae53ab1262cbf1a1b0bdf1ac0b124377 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(mouseEvent, platformMouseEvent, true); > return true; > } > } >@@ -2007,6 +2007,18 @@ bool EventHandler::handleMouseMoveEvent(const PlatformMouseEvent& platformMouseE > return swallowEvent; > } > >+void EventHandler::sendPointerCrossingEventsIfNeeded(MouseEventWithHitTestResults& mouseEvent, const PlatformMouseEvent& platformMouseEvent, bool fireMouseOverOut) >+{ >+// GTK apps expect to receive mouse events when window is not active. >+#if PLATFORM(GTK) >+ updateMouseEventTargetNode(mouseEvent.targetNode(), platformMouseEvent, fireMouseOverOut); >+#else >+ UNUSED_PARAM(mouseEvent); >+ UNUSED_PARAM(platformMouseEvent); >+ UNUSED_PARAM(fireMouseOverOut); >+#endif >+} >+ > void EventHandler::invalidateClick() > { > m_clickCount = 0; >diff --git a/Source/WebCore/page/EventHandler.h b/Source/WebCore/page/EventHandler.h >index 75ad2681445c52b97508b59ce1ba9a11e0682fe9..76031e89ed4dd98dcd64df5cc1905a6e41004fae 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(MouseEventWithHitTestResults&, const PlatformMouseEvent&, bool fireMouseOverOut); >+ > Frame& m_frame; > > bool m_mousePressed { false }; >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..7f8c7a3afe0936c29a335350bb6910e4cae391fa >--- /dev/null >+++ b/LayoutTests/fast/events/inactive_window_no_mouse_event-expected.txt >@@ -0,0 +1,12 @@ >+This tests 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