[ContentChangeObserver] Add iFrame elements to the list of "considered clickable...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Mar 2019 14:09:23 +0000 (14:09 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Mar 2019 14:09:23 +0000 (14:09 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196410
<rdar://problem/49436828>

Reviewed by Simon Fraser.

Source/WebCore:

163.com constructs an iFrame to display the login pane on hover. This patch ensures that we take iFrames into account while observing for visible content change by considering iFrame elements "clickable".
(While iFrames don't necessarily have clickable content, we can't just sit and wait until they are fully loaded.)

Test: fast/events/touch/ios/content-observation/iframe-is-shown-on-hover.html

* page/ios/ContentChangeObserver.cpp:
(WebCore::ContentChangeObserver::StyleChangeScope::isConsideredClickable const):

LayoutTests:

* fast/events/touch/ios/content-observation/iframe-is-shown-on-hover-expected.txt: Added.
* fast/events/touch/ios/content-observation/iframe-is-shown-on-hover.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@243678 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/ChangeLog
LayoutTests/fast/events/touch/ios/content-observation/iframe-is-shown-on-hover-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/touch/ios/content-observation/iframe-is-shown-on-hover.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/ios/ContentChangeObserver.cpp

index 5c03763..dacf9dc 100644 (file)
@@ -1,5 +1,16 @@
 2019-03-30  Zalan Bujtas  <zalan@apple.com>
 
+        [ContentChangeObserver] Add iFrame elements to the list of "considered clickable" elements.
+        https://bugs.webkit.org/show_bug.cgi?id=196410
+        <rdar://problem/49436828>
+
+        Reviewed by Simon Fraser.
+
+        * fast/events/touch/ios/content-observation/iframe-is-shown-on-hover-expected.txt: Added.
+        * fast/events/touch/ios/content-observation/iframe-is-shown-on-hover.html: Added.
+
+2019-03-30  Zalan Bujtas  <zalan@apple.com>
+
         [ContentChangeObserver] Subframe load should not reset content observation on the mainframe
         https://bugs.webkit.org/show_bug.cgi?id=196408
         <rdar://problem/49436797>
diff --git a/LayoutTests/fast/events/touch/ios/content-observation/iframe-is-shown-on-hover-expected.txt b/LayoutTests/fast/events/touch/ios/content-observation/iframe-is-shown-on-hover-expected.txt
new file mode 100644 (file)
index 0000000..ce9f55f
--- /dev/null
@@ -0,0 +1,3 @@
+PASS if 'clicked' text is not shown below.
+
+
diff --git a/LayoutTests/fast/events/touch/ios/content-observation/iframe-is-shown-on-hover.html b/LayoutTests/fast/events/touch/ios/content-observation/iframe-is-shown-on-hover.html
new file mode 100644 (file)
index 0000000..ab6cdf5
--- /dev/null
@@ -0,0 +1,60 @@
+<html>
+<head>
+<title>This tests the case when iframe is display as the result of a hover.</title>
+<script src="../../../../../resources/basic-gestures.js"></script>
+<style>
+#tapthis {
+    width: 400px;
+    height: 400px;
+    border: 1px solid green;
+}
+
+#becomesVisible {
+       display: none;
+    width: 100px;
+    height: 100px;
+    background-color: green;
+    overflow: hidden;
+}
+
+</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 'clicked' text is not shown below.</div>
+<iframe id=becomesVisible src="data:text/html;charset=utf-8,subframe content"></iframe>
+<pre id=result></pre>
+<script>
+tapthis.addEventListener("mouseover", function( event ) {
+    becomesVisible.style.display = "block";
+    document.body.offsetHeight;
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, false);
+
+becomesVisible.addEventListener("click", function( event ) {   
+    result.innerHTML = "clicked hidden";
+}, false);
+
+tapthis.addEventListener("click", function( event ) {   
+    result.innerHTML = "clicked";
+}, false);
+</script>
+</body>
+</html>
index 3ece356..12784dc 100644 (file)
@@ -1,3 +1,19 @@
+2019-03-30  Zalan Bujtas  <zalan@apple.com>
+
+        [ContentChangeObserver] Add iFrame elements to the list of "considered clickable" elements.
+        https://bugs.webkit.org/show_bug.cgi?id=196410
+        <rdar://problem/49436828>
+
+        Reviewed by Simon Fraser.
+
+        163.com constructs an iFrame to display the login pane on hover. This patch ensures that we take iFrames into account while observing for visible content change by considering iFrame elements "clickable".
+        (While iFrames don't necessarily have clickable content, we can't just sit and wait until they are fully loaded.)
+
+        Test: fast/events/touch/ios/content-observation/iframe-is-shown-on-hover.html
+
+        * page/ios/ContentChangeObserver.cpp:
+        (WebCore::ContentChangeObserver::StyleChangeScope::isConsideredClickable const):
+
 2019-03-30  Antti Koivisto  <antti@apple.com>
 
         Try to fix Windows build.
index 114cf2c..41381de 100644 (file)
@@ -30,6 +30,7 @@
 #include "ChromeClient.h"
 #include "DOMTimer.h"
 #include "Document.h"
+#include "HTMLIFrameElement.h"
 #include "HTMLImageElement.h"
 #include "Logging.h"
 #include "NodeRenderStyle.h"
@@ -486,6 +487,9 @@ bool ContentChangeObserver::StyleChangeScope::isConsideredClickable() const
         return false;
 
     auto& element = const_cast<Element&>(m_element);
+    if (is<HTMLIFrameElement>(element))
+        return true;
+
     if (is<HTMLImageElement>(element)) {
         // This is required to avoid HTMLImageElement's touch callout override logic. See rdar://problem/48937767.
         return element.Element::willRespondToMouseClickEvents();