[ContentChangeObserver] Subframe load should not reset content observation on the...
authorzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Mar 2019 13:47:42 +0000 (13:47 +0000)
committerzalan@apple.com <zalan@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 30 Mar 2019 13:47:42 +0000 (13:47 +0000)
https://bugs.webkit.org/show_bug.cgi?id=196408
<rdar://problem/49436797>

Reviewed by Simon Fraser.

Source/WebKit:

Hover intent fails when an unrelated frame commits a load the same time.
cancelPotentialTapInFrame is called from didCommitLoad, but what we are looking for here is the user initiated cancel of a tap (cancelPotentialTap).
(If the current frame navigates away, willDetachPage takes care of canceling the observation.)

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

LayoutTests:

* fast/events/touch/ios/content-observation/hover-while-loading-subframe-expected.txt: Added.
* fast/events/touch/ios/content-observation/hover-while-loading-subframe.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/events/touch/ios/content-observation/hover-while-loading-subframe-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/touch/ios/content-observation/hover-while-loading-subframe.html [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

index ae57ec3..5c03763 100644 (file)
@@ -1,3 +1,14 @@
+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>
+
+        Reviewed by Simon Fraser.
+
+        * fast/events/touch/ios/content-observation/hover-while-loading-subframe-expected.txt: Added.
+        * fast/events/touch/ios/content-observation/hover-while-loading-subframe.html: Added.
+
 2019-03-30  Antti Koivisto  <antti@apple.com>
 
         Hit-testing of boxes over scrollers should account for border-radius
diff --git a/LayoutTests/fast/events/touch/ios/content-observation/hover-while-loading-subframe-expected.txt b/LayoutTests/fast/events/touch/ios/content-observation/hover-while-loading-subframe-expected.txt
new file mode 100644 (file)
index 0000000..66db4c9
--- /dev/null
@@ -0,0 +1,2 @@
+PASS if 'clicked' text is not shown below.
+
diff --git a/LayoutTests/fast/events/touch/ios/content-observation/hover-while-loading-subframe.html b/LayoutTests/fast/events/touch/ios/content-observation/hover-while-loading-subframe.html
new file mode 100644 (file)
index 0000000..78a24fa
--- /dev/null
@@ -0,0 +1,62 @@
+<html>
+<head>
+<title>This tests the case when a subframe is getting loaded while hovering.</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>
+<div id=becomesVisible></div>
+<pre id=result></pre>
+<iframe id=iframe src="foobar.html"></iframe>
+<script>
+tapthis.addEventListener("mouseover", function( event ) {
+       iframe.src = "data:text/html;charset=utf-8,subframe content";
+    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 69661cd..1ffd48c 100644 (file)
@@ -1,3 +1,19 @@
+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>
+
+        Reviewed by Simon Fraser.
+
+        Hover intent fails when an unrelated frame commits a load the same time.
+        cancelPotentialTapInFrame is called from didCommitLoad, but what we are looking for here is the user initiated cancel of a tap (cancelPotentialTap).
+        (If the current frame navigates away, willDetachPage takes care of canceling the observation.)
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::cancelPotentialTap):
+        (WebKit::WebPage::cancelPotentialTapInFrame):
+
 2019-03-29  John Wilander  <wilander@apple.com>
 
         Move WebResourceLoadStatisticsStore IPC calls from the UI process to the network process
index df8ddc9..a96d2e7 100644 (file)
@@ -910,13 +910,14 @@ void WebPage::commitPotentialTapFailed()
 
 void WebPage::cancelPotentialTap()
 {
+    if (m_potentialTapNode)
+        m_potentialTapNode->document().contentChangeObserver().willNotProceedWithClick();
     cancelPotentialTapInFrame(*m_mainFrame);
 }
 
 void WebPage::cancelPotentialTapInFrame(WebFrame& frame)
 {
     if (m_potentialTapNode) {
-        m_potentialTapNode->document().contentChangeObserver().willNotProceedWithClick();
         auto* potentialTapFrame = m_potentialTapNode->document().frame();
         if (potentialTapFrame && !potentialTapFrame->tree().isDescendantOf(frame.coreFrame()))
             return;