Title: [238280] trunk
Revision
238280
Author
[email protected]
Date
2018-11-16 07:07:17 -0800 (Fri, 16 Nov 2018)

Log Message

Source/WebCore:
[iOS] 2 subsequent taps are required to trigger certain tasks on the desktop version of YouTube.com (hover vs click).
https://bugs.webkit.org/show_bug.cgi?id=191712
<rdar://problem/45612900>

Reviewed by Simon Fraser.

In handleSyntheticClick() we use WKContentObservation to figure out whether the tap should be treated as a hover or a click.
In general, if the mouse-move event triggers a visible content change, we assume we hit a hover-like drop down menu (or something similar)
and no need to dispatch a click event.
The idea here is that if the new content (result of the mouse-move event) does not respond to mouse click, it is most likely
only for tooltip-like reasons and it's ok to proceed with the click event.

Test: fast/events/touch/ios/click-instead-of-hover-simple.html

* rendering/updating/RenderTreeUpdater.cpp:
(WebCore::CheckForVisibilityChange::~CheckForVisibilityChange):

LayoutTests:
[iOS] 2 subsequent taps are required to trigger certain tasks on the desktop version of YouTube.com
https://bugs.webkit.org/show_bug.cgi?id=191712
<rdar://problem/45612900>

Reviewed by Simon Fraser.

* fast/events/touch/ios/click-instead-of-hover-simple-expected.txt: Added.
* fast/events/touch/ios/click-instead-of-hover-simple.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238279 => 238280)


--- trunk/LayoutTests/ChangeLog	2018-11-16 14:51:36 UTC (rev 238279)
+++ trunk/LayoutTests/ChangeLog	2018-11-16 15:07:17 UTC (rev 238280)
@@ -1,5 +1,16 @@
 2018-11-16  Zalan Bujtas  <[email protected]>
 
+        [iOS] 2 subsequent taps are required to trigger certain tasks on the desktop version of YouTube.com
+        https://bugs.webkit.org/show_bug.cgi?id=191712
+        <rdar://problem/45612900>
+
+        Reviewed by Simon Fraser.
+
+        * fast/events/touch/ios/click-instead-of-hover-simple-expected.txt: Added.
+        * fast/events/touch/ios/click-instead-of-hover-simple.html: Added.
+
+2018-11-16  Zalan Bujtas  <[email protected]>
+
         [LFC][IFC] Add support for out-of-flow positioned boxes
         https://bugs.webkit.org/show_bug.cgi?id=191726
 

Added: trunk/LayoutTests/fast/events/touch/ios/click-instead-of-hover-simple-expected.txt (0 => 238280)


--- trunk/LayoutTests/fast/events/touch/ios/click-instead-of-hover-simple-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/click-instead-of-hover-simple-expected.txt	2018-11-16 15:07:17 UTC (rev 238280)
@@ -0,0 +1,3 @@
+PASS if clicked.
+clicked
+tooltip

Added: trunk/LayoutTests/fast/events/touch/ios/click-instead-of-hover-simple.html (0 => 238280)


--- trunk/LayoutTests/fast/events/touch/ios/click-instead-of-hover-simple.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/click-instead-of-hover-simple.html	2018-11-16 15:07:17 UTC (rev 238280)
@@ -0,0 +1,45 @@
+<html>
+<head>
+<title>This test that we trigger click when hover would not display non-clickable content.</title>
+<script src=""
+<style>
+#tapthis {
+    width: 400px;
+    height: 400px;
+    border: 1px solid green;
+}
+</style>
+<script>
+async function test() {
+    if (!window.testRunner || !testRunner.runUIScript)
+        return;
+
+    testRunner.dumpAsText();
+    testRunner.waitUntilDone();
+
+    let rect = tapthis.getBoundingClientRect();
+    let x = rect.left + rect.width / 2;
+    let y = rect.top + rect.height / 2;
+
+	await tapAtPoint(x, y);
+
+    testRunner.notifyDone();
+}
+</script>
+</head>
+<body _onload_="test()">
+<div id=tapthis>PASS if clicked.</div>
+<pre id=result></pre>
+<script>
+tapthis.addEventListener("mouseover", function( event ) {   
+	let newContent = document.createElement("div");
+	newContent.innerHTML = "tooltip";
+	document.body.appendChild(newContent);		
+}, false);
+
+tapthis.addEventListener("click", function( event ) {   
+	result.innerHTML = "clicked";
+}, false);
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (238279 => 238280)


--- trunk/Source/WebCore/ChangeLog	2018-11-16 14:51:36 UTC (rev 238279)
+++ trunk/Source/WebCore/ChangeLog	2018-11-16 15:07:17 UTC (rev 238280)
@@ -1,5 +1,24 @@
 2018-11-16  Zalan Bujtas  <[email protected]>
 
+        [iOS] 2 subsequent taps are required to trigger certain tasks on the desktop version of YouTube.com (hover vs click).
+        https://bugs.webkit.org/show_bug.cgi?id=191712
+        <rdar://problem/45612900>
+
+        Reviewed by Simon Fraser.
+
+        In handleSyntheticClick() we use WKContentObservation to figure out whether the tap should be treated as a hover or a click.
+        In general, if the mouse-move event triggers a visible content change, we assume we hit a hover-like drop down menu (or something similar)
+        and no need to dispatch a click event.
+        The idea here is that if the new content (result of the mouse-move event) does not respond to mouse click, it is most likely
+        only for tooltip-like reasons and it's ok to proceed with the click event.
+
+        Test: fast/events/touch/ios/click-instead-of-hover-simple.html
+
+        * rendering/updating/RenderTreeUpdater.cpp:
+        (WebCore::CheckForVisibilityChange::~CheckForVisibilityChange):
+
+2018-11-16  Zalan Bujtas  <[email protected]>
+
         [LFC][IFC] Add support for out-of-flow positioned boxes
         https://bugs.webkit.org/show_bug.cgi?id=191726
 

Modified: trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp (238279 => 238280)


--- trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2018-11-16 14:51:36 UTC (rev 238279)
+++ trunk/Source/WebCore/rendering/updating/RenderTreeUpdater.cpp	2018-11-16 15:07:17 UTC (rev 238280)
@@ -679,10 +679,20 @@
 {
     if (!WKObservingContentChanges())
         return;
-    if (m_element.isInUserAgentShadowTree())
-        return;
+
     auto* style = m_element.renderStyle();
-    if (!style)
+
+    auto qualifiesForVisibilityCheck = [&] {
+        if (!style)
+            return false;
+        if (m_element.isInUserAgentShadowTree())
+            return false;
+        if (!const_cast<Element&>(m_element).willRespondToMouseClickEvents())
+            return false;
+        return true;
+    };
+
+    if (!qualifiesForVisibilityCheck())
         return;
     if ((m_previousDisplay == DisplayType::None && style->display() != DisplayType::None) || (m_previousVisibility == Visibility::Hidden && style->visibility() != Visibility::Hidden)
         || (m_previousImplicitVisibility == Visibility::Hidden && elementImplicitVisibility(m_element) == Visibility::Visible))
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to