Diff
Modified: trunk/LayoutTests/ChangeLog (242797 => 242798)
--- trunk/LayoutTests/ChangeLog 2019-03-12 16:50:46 UTC (rev 242797)
+++ trunk/LayoutTests/ChangeLog 2019-03-12 17:15:52 UTC (rev 242798)
@@ -1,3 +1,14 @@
+2019-03-12 Zalan Bujtas <[email protected]>
+
+ [Synthetic Click] Dispatch mouseout soon after mouseup
+ https://bugs.webkit.org/show_bug.cgi?id=195575
+ <rdar://problem/47093049>
+
+ Reviewed by Simon Fraser.
+
+ * fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click-expected.txt: Added.
+ * fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click.html: Added.
+
2019-03-12 Antti Koivisto <[email protected]>
Compositing layer that renders two positioned elements should not hit test
Added: trunk/LayoutTests/fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click-expected.txt (0 => 242798)
--- trunk/LayoutTests/fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click-expected.txt 2019-03-12 17:15:52 UTC (rev 242798)
@@ -0,0 +1,2 @@
+PASS if 'mouseout' text is shown below.
+ clicked mouseout triggered
Copied: trunk/LayoutTests/fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click.html (from rev 242797, trunk/LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved.html) (0 => 242798)
--- trunk/LayoutTests/fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click.html (rev 0)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click.html 2019-03-12 17:15:52 UTC (rev 242798)
@@ -0,0 +1,57 @@
+<html>
+<head>
+<title>This tests that we fire mouseout on synthetic click</title>
+<script src=""
+<style>
+#tapthis {
+ width: 400px;
+ height: 400px;
+ border: 1px solid green;
+}
+
+#becomesVisible {
+ width: 100px;
+ height: 100px;
+ background-color: green;
+}
+</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 shown below.</div>
+<div id=becomesVisible></div>
+<pre id=result></pre>
+<script>
+
+becomesVisible.addEventListener("click", function( event ) {
+ result.innerHTML = "clicked hidden";
+}, false);
+
+tapthis.addEventListener("mouseout", function( event ) {
+ result.innerHTML = result.innerHTML + " mouseout triggered ";
+ if (window.testRunner)
+ testRunner.notifyDone();
+}, false);
+
+tapthis.addEventListener("click", function( event ) {
+ result.innerHTML = result.innerHTML + " clicked ";
+}, false);
+</script>
+</body>
+</html>
Modified: trunk/LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved.html (242797 => 242798)
--- trunk/LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved.html 2019-03-12 16:50:46 UTC (rev 242797)
+++ trunk/LayoutTests/fast/events/touch/ios/content-observation/visibility-change-happens-while-in-mousemoved.html 2019-03-12 17:15:52 UTC (rev 242798)
@@ -45,7 +45,11 @@
testRunner.notifyDone();
}, false);
-becomesVisible.addEventListener("click", function( event ) {
+tapthis.addEventListener("mouseout", function( event ) {
+ result.innerHTML = result.innerHTML + " mouseout should NOT be triggered ";
+}, false);
+
+becomesVisible.addEventListener("click", function( event ) {
result.innerHTML = "clicked hidden";
}, false);
Modified: trunk/Source/WebCore/ChangeLog (242797 => 242798)
--- trunk/Source/WebCore/ChangeLog 2019-03-12 16:50:46 UTC (rev 242797)
+++ trunk/Source/WebCore/ChangeLog 2019-03-12 17:15:52 UTC (rev 242798)
@@ -1,3 +1,19 @@
+2019-03-12 Zalan Bujtas <[email protected]>
+
+ [Synthetic Click] Dispatch mouseout soon after mouseup
+ https://bugs.webkit.org/show_bug.cgi?id=195575
+ <rdar://problem/47093049>
+
+ Reviewed by Simon Fraser.
+
+ Let's fire a mouseout event when a click is submitted as the result of a tap. It helps to dismiss content which would otherwise require you to move the mouse (cases like control bar on youtube.com).
+
+ Test: fast/events/touch/ios/content-observation/mouse-out-event-should-fire-on-click.html
+
+ * page/EventHandler.h:
+ * page/ios/EventHandlerIOS.mm:
+ (WebCore::EventHandler::dispatchFakeMouseOut):
+
2019-03-12 Ryosuke Niwa <[email protected]>
In CachedFrame's constructor, release-assert that DOMWindow still has a frame after page-caching subframes
Modified: trunk/Source/WebCore/page/EventHandler.cpp (242797 => 242798)
--- trunk/Source/WebCore/page/EventHandler.cpp 2019-03-12 16:50:46 UTC (rev 242797)
+++ trunk/Source/WebCore/page/EventHandler.cpp 2019-03-12 17:15:52 UTC (rev 242798)
@@ -1978,7 +1978,7 @@
#endif
if (onlyUpdateScrollbars) {
if (shouldSendMouseEventsToInactiveWindows())
- updateMouseEventTargetNode(mouseEvent.targetNode(), platformMouseEvent, true);
+ updateMouseEventTargetNode(mouseEvent.targetNode(), platformMouseEvent, FireMouseOverOut::Yes);
return true;
}
@@ -1993,7 +1993,7 @@
if (newSubframe) {
// Update over/out state before passing the event to the subframe.
- updateMouseEventTargetNode(mouseEvent.targetNode(), platformMouseEvent, true);
+ updateMouseEventTargetNode(mouseEvent.targetNode(), platformMouseEvent, FireMouseOverOut::Yes);
// Event dispatch in updateMouseEventTargetNode may have caused the subframe of the target
// node to be detached from its FrameView, in which case the event should not be passed.
@@ -2476,7 +2476,7 @@
return false;
}
-void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMouseEvent& platformMouseEvent, bool fireMouseOverOut)
+void EventHandler::updateMouseEventTargetNode(Node* targetNode, const PlatformMouseEvent& platformMouseEvent, FireMouseOverOut fireMouseOverOut)
{
Ref<Frame> protectedFrame(m_frame);
Element* targetElement = nullptr;
@@ -2494,7 +2494,7 @@
m_elementUnderMouse = targetElement;
// Fire mouseout/mouseover if the mouse has shifted to a different node.
- if (fireMouseOverOut) {
+ if (fireMouseOverOut == FireMouseOverOut::Yes) {
auto scrollableAreaForLastNode = enclosingScrollableArea(m_lastElementUnderMouse.get());
auto scrollableAreaForNodeUnderMouse = enclosingScrollableArea(m_elementUnderMouse.get());
Page* page = m_frame.page();
@@ -2588,7 +2588,7 @@
if (auto* view = m_frame.view())
view->disableLayerFlushThrottlingTemporarilyForInteraction();
- updateMouseEventTargetNode(targetNode, platformMouseEvent, setUnder);
+ updateMouseEventTargetNode(targetNode, platformMouseEvent, setUnder ? FireMouseOverOut::Yes : FireMouseOverOut::No);
if (m_elementUnderMouse && !m_elementUnderMouse->dispatchMouseEvent(platformMouseEvent, eventType, clickCount))
return false;
Modified: trunk/Source/WebCore/page/EventHandler.h (242797 => 242798)
--- trunk/Source/WebCore/page/EventHandler.h 2019-03-12 16:50:46 UTC (rev 242797)
+++ trunk/Source/WebCore/page/EventHandler.h 2019-03-12 17:15:52 UTC (rev 242798)
@@ -241,6 +241,7 @@
#if PLATFORM(IOS_FAMILY)
void defaultTouchEventHandler(Node&, TouchEvent&);
+ WEBCORE_EXPORT void dispatchSyntheticMouseOut(const PlatformMouseEvent&);
#endif
#if ENABLE(CONTEXT_MENUS)
@@ -404,9 +405,9 @@
Node* nodeUnderMouse() const;
- void updateMouseEventTargetNode(Node*, const PlatformMouseEvent&, bool fireMouseOverOut);
- void fireMouseOverOut(bool fireMouseOver = true, bool fireMouseOut = true, bool updateLastNodeUnderMouse = true);
-
+ enum class FireMouseOverOut { No, Yes };
+ void updateMouseEventTargetNode(Node*, const PlatformMouseEvent&, FireMouseOverOut);
+
MouseEventWithHitTestResults prepareMouseEvent(const HitTestRequest&, const PlatformMouseEvent&);
bool dispatchMouseEvent(const AtomicString& eventType, Node* target, bool cancelable, int clickCount, const PlatformMouseEvent&, bool setUnder);
Modified: trunk/Source/WebCore/page/ios/EventHandlerIOS.mm (242797 => 242798)
--- trunk/Source/WebCore/page/ios/EventHandlerIOS.mm 2019-03-12 16:50:46 UTC (rev 242797)
+++ trunk/Source/WebCore/page/ios/EventHandlerIOS.mm 2019-03-12 17:15:52 UTC (rev 242798)
@@ -515,6 +515,11 @@
return false;
}
+void EventHandler::dispatchSyntheticMouseOut(const PlatformMouseEvent& platformMouseEvent)
+{
+ updateMouseEventTargetNode(nullptr, platformMouseEvent, FireMouseOverOut::Yes);
+}
+
bool EventHandler::passMousePressEventToSubframe(MouseEventWithHitTestResults& mev, Frame* subframe)
{
// WebKit1 code path.
Modified: trunk/Source/WebKit/ChangeLog (242797 => 242798)
--- trunk/Source/WebKit/ChangeLog 2019-03-12 16:50:46 UTC (rev 242797)
+++ trunk/Source/WebKit/ChangeLog 2019-03-12 17:15:52 UTC (rev 242798)
@@ -1,5 +1,16 @@
2019-03-12 Zalan Bujtas <[email protected]>
+ [Synthetic Click] Dispatch mouseout soon after mouseup
+ https://bugs.webkit.org/show_bug.cgi?id=195575
+ <rdar://problem/47093049>
+
+ Reviewed by Simon Fraser.
+
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::completeSyntheticClick):
+
+2019-03-12 Zalan Bujtas <[email protected]>
+
[ContentChangeObserver] Stop content change observation when the touch event turns into long press
https://bugs.webkit.org/show_bug.cgi?id=195601
<rdar://problem/48796324>
Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (242797 => 242798)
--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-03-12 16:50:46 UTC (rev 242797)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm 2019-03-12 17:15:52 UTC (rev 242798)
@@ -640,6 +640,11 @@
if (newFocusedElement && newFocusedElement == oldFocusedElement)
elementDidRefocus(*newFocusedElement);
+ if (nodeRespondingToClick.document().frame())
+ nodeRespondingToClick.document().frame()->eventHandler().dispatchSyntheticMouseOut(PlatformMouseEvent(roundedAdjustedPoint, roundedAdjustedPoint, LeftButton, PlatformEvent::NoType, 0, shiftKey, ctrlKey, altKey, metaKey, WallTime::now(), 0, WebCore::NoTap));
+ if (m_isClosed)
+ return;
+
if (!tapWasHandled || !nodeRespondingToClick.isElementNode())
send(Messages::WebPageProxy::DidNotHandleTapAsClick(roundedIntPoint(location)));