Title: [244537] trunk
Revision
244537
Author
za...@apple.com
Date
2019-04-22 18:36:39 -0700 (Mon, 22 Apr 2019)

Log Message

[ContentChangeObserver] Some dropdown menus may close without user gesture on americanexpress.com
https://bugs.webkit.org/show_bug.cgi?id=197175
<rdar://problem/49613013>

Reviewed by Simon Fraser.

Source/WebKit:

Do not generate additional synthetic mouse events (e.g. mouseout in this case) when the content handles the click event. This helps cases when the synthetic mouseout ended up dismissing the dropdown menus.
However it won't regress cases like youtube.com, where sending mouseout is required to have the control bar dismissed on play.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::completeSyntheticClick):

LayoutTests:

* fast/events/touch/ios/content-observation/mouse-out-event-should-not-fire-on-click-when-default-prevented-expected.txt: Added.
* fast/events/touch/ios/content-observation/mouse-out-event-should-not-fire-on-click-when-default-prevented.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (244536 => 244537)


--- trunk/LayoutTests/ChangeLog	2019-04-23 01:18:12 UTC (rev 244536)
+++ trunk/LayoutTests/ChangeLog	2019-04-23 01:36:39 UTC (rev 244537)
@@ -1,3 +1,14 @@
+2019-04-22  Zalan Bujtas  <za...@apple.com>
+
+        [ContentChangeObserver] Some dropdown menus may close without user gesture on americanexpress.com
+        https://bugs.webkit.org/show_bug.cgi?id=197175
+        <rdar://problem/49613013>
+
+        Reviewed by Simon Fraser.
+
+        * fast/events/touch/ios/content-observation/mouse-out-event-should-not-fire-on-click-when-default-prevented-expected.txt: Added.
+        * fast/events/touch/ios/content-observation/mouse-out-event-should-not-fire-on-click-when-default-prevented.html: Added.
+
 2019-04-22  Justin Fan  <justin_...@apple.com>
 
         [WebGPU] Move swap chain methods from GPUDevice to GPUCanvasContext

Modified: trunk/LayoutTests/fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click.html (244536 => 244537)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click.html	2019-04-23 01:18:12 UTC (rev 244536)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click.html	2019-04-23 01:36:39 UTC (rev 244537)
@@ -35,7 +35,7 @@
 </script>
 </head>
 <body _onload_="test()">
-<div id=tapthis>PASS if 'mouseout' text is shown below.</div>
+<button id=tapthis>PASS if 'mouseout' text is shown below.</button>
 <div id=becomesVisible></div>
 <pre id=result></pre>
 <script>

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/mouse-out-event-should-not-fire-on-click-when-default-prevented-expected.txt (0 => 244537)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/mouse-out-event-should-not-fire-on-click-when-default-prevented-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/mouse-out-event-should-not-fire-on-click-when-default-prevented-expected.txt	2019-04-23 01:36:39 UTC (rev 244537)
@@ -0,0 +1,2 @@
+PASS if 'mouseout' text is not shown below.
+ clicked 

Copied: trunk/LayoutTests/fast/events/touch/ios/content-observation/mouse-out-event-should-not-fire-on-click-when-default-prevented.html (from rev 244533, trunk/LayoutTests/fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click.html) (0 => 244537)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/mouse-out-event-should-not-fire-on-click-when-default-prevented.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/mouse-out-event-should-not-fire-on-click-when-default-prevented.html	2019-04-23 01:36:39 UTC (rev 244537)
@@ -0,0 +1,59 @@
+<!DOCTYPE html><!-- webkit-test-runner [ useFlexibleViewport=true ] -->
+<html>
+<head>
+<title>This tests that we fire mouseout on synthetic click unless the click is preventDefaulted</title>
+<script src=""
+<style>
+#tapthis {
+    width: 400px;
+    height: 400px;
+    border: 1px solid green;
+}
+
+#becomesVisible {
+    width: 100px;
+    height: 100px;
+    background-color: green;
+}
+</style>
+<script>
+async function test() {
+    if (!window.testRunner || !testRunner.runUIScript)
+        return;
+    if (window.internals)
+        internals.settings.setContentChangeObserverEnabled(true);
+
+    testRunner.waitUntilDone();
+    testRunner.dumpAsText();
+
+    let rect = tapthis.getBoundingClientRect();
+    let x = rect.left + rect.width / 2;
+    let y = rect.top + rect.height / 2;
+
+    await tapAtPoint(x, y);
+}
+</script>
+</head>
+<body _onload_="test()">
+<div id=tapthis>PASS if 'mouseout' text is not shown below.</div>
+<div id=becomesVisible></div>
+<pre id=result></pre>
+<script>
+
+becomesVisible.addEventListener("click", function( event ) {   
+    result.innerHTML = "clicked hidden";
+}, false);
+
+tapthis.addEventListener("mouseout", function( event ) {   
+    result.innerHTML = result.innerHTML + " mouseout triggered ";
+}, false);
+
+tapthis.addEventListener("click", function( event ) {   
+    result.innerHTML = result.innerHTML + " clicked ";
+    event.preventDefault();
+    if (window.testRunner)
+    	setTimeout("testRunner.notifyDone()", 0);
+}, false);
+</script>
+</body>
+</html>

Modified: trunk/Source/WebKit/ChangeLog (244536 => 244537)


--- trunk/Source/WebKit/ChangeLog	2019-04-23 01:18:12 UTC (rev 244536)
+++ trunk/Source/WebKit/ChangeLog	2019-04-23 01:36:39 UTC (rev 244537)
@@ -1,3 +1,17 @@
+2019-04-22  Zalan Bujtas  <za...@apple.com>
+
+        [ContentChangeObserver] Some dropdown menus may close without user gesture on americanexpress.com
+        https://bugs.webkit.org/show_bug.cgi?id=197175
+        <rdar://problem/49613013>
+
+        Reviewed by Simon Fraser.
+
+        Do not generate additional synthetic mouse events (e.g. mouseout in this case) when the content handles the click event. This helps cases when the synthetic mouseout ended up dismissing the dropdown menus.
+        However it won't regress cases like youtube.com, where sending mouseout is required to have the control bar dismissed on play. 
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::completeSyntheticClick):
+
 2019-04-22  Alex Christensen  <achristen...@webkit.org>
 
         Deprecate WKContextCreateWithInjectedBundlePath

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (244536 => 244537)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-04-23 01:18:12 UTC (rev 244536)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-04-23 01:36:39 UTC (rev 244537)
@@ -688,7 +688,7 @@
     if (newFocusedElement && newFocusedElement == oldFocusedElement)
         elementDidRefocus(*newFocusedElement);
 
-    if (nodeRespondingToClick.document().frame())
+    if (!tapWasHandled && nodeRespondingToClick.document().frame())
         nodeRespondingToClick.document().frame()->eventHandler().dispatchSyntheticMouseOut(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::NoType, 0, shiftKey, ctrlKey, altKey, metaKey, WallTime::now(), 0, WebCore::NoTap));
     if (m_isClosed)
         return;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to