Title: [243043] trunk
Revision
243043
Author
za...@apple.com
Date
2019-03-16 12:54:18 -0700 (Sat, 16 Mar 2019)

Log Message

Source/WebCore:
[iOS] Unable to close trending window on naver.com.
https://bugs.webkit.org/show_bug.cgi?id=195842
<rdar://problem/48067338>

This patch issues a synthetic mouse move to the tap location after we decided to hover.
It ensures that the node under the mouse is up-to-date and when a new tap comes in we can
send the mouseout event to the correct node. It fixes the case when the hover content is positioned over
the tap target so that the tap target is no longer "under the mouse".
On desktop this "transition" happens automatically since the mouse is always present.

Reviewed by Simon Fraser.

Tests: fast/events/touch/ios/content-observation/new-content-covers-tap-target.html
       fast/events/touch/ios/content-observation/prevent-default-on-touch-start.html

* page/EventHandler.h:
* page/ios/EventHandlerIOS.mm:
(WebCore::EventHandler::dispatchSyntheticMouseMove):

Source/WebKit:
Unable to close trending window on naver.com.
https://bugs.webkit.org/show_bug.cgi?id=195842
<rdar://problem/48067338>

Reviewed by Simon Fraser.

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

LayoutTests:
[iOS] Unable to close trending window on naver.com.
https://bugs.webkit.org/show_bug.cgi?id=195842
<rdar://problem/48067338>

Reviewed by Simon Fraser.

* fast/events/touch/ios/content-observation/new-content-covers-tap-target-expected.txt: Added.
* fast/events/touch/ios/content-observation/new-content-covers-tap-target.html: Added.
* fast/events/touch/ios/content-observation/prevent-default-on-touch-start.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (243042 => 243043)


--- trunk/LayoutTests/ChangeLog	2019-03-16 18:38:45 UTC (rev 243042)
+++ trunk/LayoutTests/ChangeLog	2019-03-16 19:54:18 UTC (rev 243043)
@@ -1,3 +1,15 @@
+2019-03-16  Zalan Bujtas  <za...@apple.com>
+
+        [iOS] Unable to close trending window on naver.com.
+        https://bugs.webkit.org/show_bug.cgi?id=195842
+        <rdar://problem/48067338>
+
+        Reviewed by Simon Fraser.
+
+        * fast/events/touch/ios/content-observation/new-content-covers-tap-target-expected.txt: Added.
+        * fast/events/touch/ios/content-observation/new-content-covers-tap-target.html: Added.
+        * fast/events/touch/ios/content-observation/prevent-default-on-touch-start.html: Added.
+
 2019-03-16  Youenn Fablet  <you...@apple.com>
 
         Update WPT WebRTC tests up to a22a149

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/new-content-covers-tap-target-expected.txt (0 => 243043)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/new-content-covers-tap-target-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/new-content-covers-tap-target-expected.txt	2019-03-16 19:54:18 UTC (rev 243043)
@@ -0,0 +1,2 @@
+PASS if 'mouseout' text is not shown below.
+mouseout

Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/new-content-covers-tap-target.html (0 => 243043)


--- trunk/LayoutTests/fast/events/touch/ios/content-observation/new-content-covers-tap-target.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/new-content-covers-tap-target.html	2019-03-16 19:54:18 UTC (rev 243043)
@@ -0,0 +1,59 @@
+<html>
+<head>
+<title>This tests the case when the new hover content comes on top of the tap target, we update the "node under the mouse" state.</title>
+<script src=""
+<style>
+#tapthis {
+    width: 400px;
+    height: 400px;
+    border: 1px solid green;
+}
+
+#becomesVisible {
+    visibility: hidden;
+    position: absolute;
+    left: 40px;
+    top: 40px;
+    width: 320px;
+    height: 320px;
+    background-color: blue;
+}
+</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>
+// 1. Tap -> hover 
+// 2. hover content comes on top of the tap target
+// 3. Check if tap target gets mouseout
+tapthis.addEventListener("mousemove", function( event ) {
+    becomesVisible.style.visibility = "visible";
+}, false);
+
+tapthis.addEventListener("mouseout", function( event ) {   
+    result.innerHTML = "mouseout";
+    if (window.testRunner)
+        testRunner.notifyDone();
+}, false);
+</script>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (243042 => 243043)


--- trunk/Source/WebCore/ChangeLog	2019-03-16 18:38:45 UTC (rev 243042)
+++ trunk/Source/WebCore/ChangeLog	2019-03-16 19:54:18 UTC (rev 243043)
@@ -1,3 +1,24 @@
+2019-03-16  Zalan Bujtas  <za...@apple.com>
+
+        [iOS] Unable to close trending window on naver.com.
+        https://bugs.webkit.org/show_bug.cgi?id=195842
+        <rdar://problem/48067338>
+
+        This patch issues a synthetic mouse move to the tap location after we decided to hover.
+        It ensures that the node under the mouse is up-to-date and when a new tap comes in we can
+        send the mouseout event to the correct node. It fixes the case when the hover content is positioned over
+        the tap target so that the tap target is no longer "under the mouse".
+        On desktop this "transition" happens automatically since the mouse is always present. 
+
+        Reviewed by Simon Fraser.
+
+        Tests: fast/events/touch/ios/content-observation/new-content-covers-tap-target.html
+               fast/events/touch/ios/content-observation/prevent-default-on-touch-start.html
+
+        * page/EventHandler.h:
+        * page/ios/EventHandlerIOS.mm:
+        (WebCore::EventHandler::dispatchSyntheticMouseMove):
+
 2019-03-16  Sihui Liu  <sihui_...@apple.com>
 
         Layout tests imported/w3c/web-platform-tests/IndexedDB/*-exception-order.html are failing

Modified: trunk/Source/WebCore/page/EventHandler.h (243042 => 243043)


--- trunk/Source/WebCore/page/EventHandler.h	2019-03-16 18:38:45 UTC (rev 243042)
+++ trunk/Source/WebCore/page/EventHandler.h	2019-03-16 19:54:18 UTC (rev 243043)
@@ -242,6 +242,7 @@
 #if PLATFORM(IOS_FAMILY)
     void defaultTouchEventHandler(Node&, TouchEvent&);
     WEBCORE_EXPORT void dispatchSyntheticMouseOut(const PlatformMouseEvent&);
+    WEBCORE_EXPORT void dispatchSyntheticMouseMove(const PlatformMouseEvent&);
 #endif
 
 #if ENABLE(CONTEXT_MENUS)

Modified: trunk/Source/WebCore/page/ios/EventHandlerIOS.mm (243042 => 243043)


--- trunk/Source/WebCore/page/ios/EventHandlerIOS.mm	2019-03-16 18:38:45 UTC (rev 243042)
+++ trunk/Source/WebCore/page/ios/EventHandlerIOS.mm	2019-03-16 19:54:18 UTC (rev 243043)
@@ -520,6 +520,11 @@
     updateMouseEventTargetNode(nullptr, platformMouseEvent, FireMouseOverOut::Yes);
 }
 
+void EventHandler::dispatchSyntheticMouseMove(const PlatformMouseEvent& platformMouseEvent)
+{
+    mouseMoved(platformMouseEvent);
+}
+
 bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
 {
     // WebKit1 code path.

Modified: trunk/Source/WebKit/ChangeLog (243042 => 243043)


--- trunk/Source/WebKit/ChangeLog	2019-03-16 18:38:45 UTC (rev 243042)
+++ trunk/Source/WebKit/ChangeLog	2019-03-16 19:54:18 UTC (rev 243043)
@@ -1,3 +1,16 @@
+2019-03-16  Zalan Bujtas  <za...@apple.com>
+
+        Unable to close trending window on naver.com.
+        https://bugs.webkit.org/show_bug.cgi?id=195842
+        <rdar://problem/48067338>
+
+        Reviewed by Simon Fraser.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::dispatchSyntheticMouseMove):
+        (WebKit::WebPage::handleSyntheticClick):
+        (WebKit::WebPage::completePendingSyntheticClickForContentChangeObserver):
+
 2019-03-16  Timothy Hatcher  <timo...@apple.com>
 
         REGRESSION (r242807): Unified sources build failure from missing imports.

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


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-03-16 18:38:45 UTC (rev 243042)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-03-16 19:54:18 UTC (rev 243043)
@@ -543,21 +543,27 @@
         didChangeSelection();
 }
 
+static void dispatchSyntheticMouseMove(Frame& mainFrame, const WebCore::FloatPoint& location, OptionSet<WebEvent::Modifier> modifiers)
+{
+    IntPoint roundedAdjustedPoint = roundedIntPoint(location);
+    auto shiftKey = modifiers.contains(WebEvent::Modifier::ShiftKey);
+    auto ctrlKey = modifiers.contains(WebEvent::Modifier::ControlKey);
+    auto altKey = modifiers.contains(WebEvent::Modifier::AltKey);
+    auto metaKey = modifiers.contains(WebEvent::Modifier::MetaKey);
+    auto mouseEvent = PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, NoButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, altKey, metaKey, WallTime::now(), WebCore::ForceAtClick, WebCore::NoTap);
+    mainFrame.eventHandler().dispatchSyntheticMouseMove(mouseEvent);
+}
+
 void WebPage::handleSyntheticClick(Node& nodeRespondingToClick, const WebCore::FloatPoint& location, OptionSet<WebEvent::Modifier> modifiers)
 {
-    IntPoint roundedAdjustedPoint = roundedIntPoint(location);
     auto& respondingDocument = nodeRespondingToClick.document();
+    auto& mainFrame = m_page->mainFrame();
     // FIXME: Pass caps lock state.
-    bool shiftKey = modifiers.contains(WebEvent::Modifier::ShiftKey);
-    bool ctrlKey = modifiers.contains(WebEvent::Modifier::ControlKey);
-    bool altKey = modifiers.contains(WebEvent::Modifier::AltKey);
-    bool metaKey = modifiers.contains(WebEvent::Modifier::MetaKey);
     {
         LOG_WITH_STREAM(ContentObservation, stream << "handleSyntheticClick: node(" << &nodeRespondingToClick << ") " << location);
         ContentChangeObserver::MouseMovedScope observingScope(respondingDocument);
-        auto& mainframe = m_page->mainFrame();
-        mainframe.eventHandler().mouseMoved(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, NoButton, PlatformEvent::MouseMoved, 0, shiftKey, ctrlKey, altKey, metaKey, WallTime::now(), WebCore::ForceAtClick, WebCore::NoTap));
-        mainframe.document()->updateStyleIfNeeded();
+        dispatchSyntheticMouseMove(mainFrame, location, modifiers);
+        mainFrame.document()->updateStyleIfNeeded();
     }
 
     if (m_isClosed)
@@ -566,7 +572,8 @@
     auto& contentChangeObserver = respondingDocument.contentChangeObserver();
     auto observedContentChange = contentChangeObserver.observedContentChange();
     if (observedContentChange == WKContentVisibilityChange) {
-        // The move event caused new contents to appear. Don't send the click event.
+        // The move event caused new contents to appear. Don't send the click event, but just ensure that the mouse is on the most recent content.
+        dispatchSyntheticMouseMove(mainFrame, location, modifiers);
         LOG(ContentObservation, "handleSyntheticClick: Observed meaningful visible change -> hover.");
         return;
     }
@@ -595,8 +602,11 @@
     if (observedContentChange == WKContentNoChange) {
         LOG(ContentObservation, "No chage was observed -> click.");
         completeSyntheticClick(*m_pendingSyntheticClickNode, m_pendingSyntheticClickLocation, m_pendingSyntheticClickModifiers, WebCore::OneFingerTap);
-    } else
+    } else {
+        // Ensure that the mouse is on the most recent content.
+        dispatchSyntheticMouseMove(m_page->mainFrame(), m_pendingSyntheticClickLocation, m_pendingSyntheticClickModifiers);
         LOG(ContentObservation, "Observed meaningful visible change -> hover.");
+    }
 
     m_pendingSyntheticClickNode = nullptr;
     m_pendingSyntheticClickLocation = FloatPoint();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to