Title: [243415] trunk
Revision
243415
Author
[email protected]
Date
2019-03-23 14:07:51 -0700 (Sat, 23 Mar 2019)

Log Message

[ContentChangeObserver] Taping on a form control should always result in click.
https://bugs.webkit.org/show_bug.cgi?id=196177

Reviewed by Simon Fraser.

Source/WebKit:

This patch enures that we send a synthetic click when the traget node is a form control (button, edit field etc) even if
the mousemove brings up some hover content.

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

LayoutTests:

* fast/events/touch/ios/content-observation/tap-on-input-type-button-element-expected.txt: Added.
* fast/events/touch/ios/content-observation/tap-on-input-type-button-element.html: Added.
* fast/events/touch/ios/content-observation/tap-on-input-type-text-element-expected.txt: Added.
* fast/events/touch/ios/content-observation/tap-on-input-type-text-element.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (243414 => 243415)


--- trunk/LayoutTests/ChangeLog	2019-03-23 20:58:37 UTC (rev 243414)
+++ trunk/LayoutTests/ChangeLog	2019-03-23 21:07:51 UTC (rev 243415)
@@ -1,5 +1,17 @@
 2019-03-23  Zalan Bujtas  <[email protected]>
 
+        [ContentChangeObserver] Taping on a form control should always result in click.
+        https://bugs.webkit.org/show_bug.cgi?id=196177
+
+        Reviewed by Simon Fraser.
+
+        * fast/events/touch/ios/content-observation/tap-on-input-type-button-element-expected.txt: Added.
+        * fast/events/touch/ios/content-observation/tap-on-input-type-button-element.html: Added.
+        * fast/events/touch/ios/content-observation/tap-on-input-type-text-element-expected.txt: Added.
+        * fast/events/touch/ios/content-observation/tap-on-input-type-text-element.html: Added.
+
+2019-03-23  Zalan Bujtas  <[email protected]>
+
         [ContentChangeObserver] Add support for observing opacity.
         https://bugs.webkit.org/show_bug.cgi?id=196172
 

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/tap-on-input-type-button-element-expected.txt (0 => 243415)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/tap-on-input-type-button-element-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/tap-on-input-type-button-element-expected.txt	2019-03-23 21:07:51 UTC (rev 243415)
@@ -0,0 +1,3 @@
+PASS if 'clicked' text is shown below.
+
+clicked

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/tap-on-input-type-button-element.html (0 => 243415)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/tap-on-input-type-button-element.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/tap-on-input-type-button-element.html	2019-03-23 21:07:51 UTC (rev 243415)
@@ -0,0 +1,54 @@
+<html>
+<head>
+<title>This tests the case when the tap target node is a form control element.</title>
+<script src=""
+<style>
+#becomesVisible {
+    visibility: hidden;
+    width: 100px;
+    height: 100px;
+    background-color: green;
+	transition-property: opacity, left;
+	transition-duration: 100ms, 200ms;
+}
+</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()">
+PASS if 'clicked' text is shown below.<br>
+<input type="button" value="tap this button" id=tapthis>
+<div id=becomesVisible></div>
+<pre id=result></pre>
+<script>
+tapthis.addEventListener("mousemove", function( event ) {
+    becomesVisible.style.visibility = "visible";
+}, false);
+
+becomesVisible.addEventListener("click", function( event ) {   
+    result.innerHTML = "clicked hidden";
+}, false);
+
+tapthis.addEventListener("click", function( event ) {   
+    result.innerHTML = "clicked";
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, false);
+</script>
+</body>
+</html>

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/tap-on-input-type-text-element-expected.txt (0 => 243415)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/tap-on-input-type-text-element-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/tap-on-input-type-text-element-expected.txt	2019-03-23 21:07:51 UTC (rev 243415)
@@ -0,0 +1,3 @@
+PASS if 'clicked' text is shown below.
+
+clicked

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/tap-on-input-type-text-element.html (0 => 243415)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/tap-on-input-type-text-element.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/tap-on-input-type-text-element.html	2019-03-23 21:07:51 UTC (rev 243415)
@@ -0,0 +1,54 @@
+<html>
+<head>
+<title>This tests the case when the tap target node is a text field element.</title>
+<script src=""
+<style>
+#becomesVisible {
+    visibility: hidden;
+    width: 100px;
+    height: 100px;
+    background-color: green;
+	transition-property: opacity, left;
+	transition-duration: 100ms, 200ms;
+}
+</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()">
+PASS if 'clicked' text is shown below.<br>
+<input type="text" value="tap this edit field" id=tapthis>
+<div id=becomesVisible></div>
+<pre id=result></pre>
+<script>
+tapthis.addEventListener("mousemove", function( event ) {
+    becomesVisible.style.visibility = "visible";
+}, false);
+
+becomesVisible.addEventListener("click", function( event ) {   
+    result.innerHTML = "clicked hidden";
+}, false);
+
+tapthis.addEventListener("click", function( event ) {   
+    result.innerHTML = "clicked";
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, false);
+</script>
+</body>
+</html>

Modified: trunk/Source/WebKit/ChangeLog (243414 => 243415)


--- trunk/Source/WebKit/ChangeLog	2019-03-23 20:58:37 UTC (rev 243414)
+++ trunk/Source/WebKit/ChangeLog	2019-03-23 21:07:51 UTC (rev 243415)
@@ -1,3 +1,16 @@
+2019-03-23  Zalan Bujtas  <[email protected]>
+
+        [ContentChangeObserver] Taping on a form control should always result in click.
+        https://bugs.webkit.org/show_bug.cgi?id=196177
+
+        Reviewed by Simon Fraser.
+
+        This patch enures that we send a synthetic click when the traget node is a form control (button, edit field etc) even if
+        the mousemove brings up some hover content.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::handleSyntheticClick):
+
 2019-03-23  Andy Estes  <[email protected]>
 
         [Apple Pay] Stop calling PKPaymentAuthorizationViewController class methods on iOS

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


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-03-23 20:58:37 UTC (rev 243414)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-03-23 21:07:51 UTC (rev 243415)
@@ -579,6 +579,11 @@
     if (m_isClosed)
         return;
 
+    if (is<HTMLFormControlElement>(nodeRespondingToClick)) {
+        LOG(ContentObservation, "handleSyntheticClick: Target node is a form control -> click.");
+        completeSyntheticClick(nodeRespondingToClick, location, modifiers, WebCore::OneFingerTap);
+        return;
+    }
     auto& contentChangeObserver = respondingDocument.contentChangeObserver();
     auto observedContentChange = contentChangeObserver.observedContentChange();
     if (observedContentChange == WKContentVisibilityChange) {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to