[iOS] Restrict synthetic clicks to the origin that handled the underlying touch event
https://bugs.webkit.org/show_bug.cgi?id=182252
<rdar://problem/21555881>
Reviewed by Tim Horton.
Source/WebCore:
Test: http/tests/events/touch/ios/cross-frame-single-tap-same-origin.https.html
* dom/Document.h:
(WebCore::Document::handlingTouchEvent const):
* page/EventHandler.h:
(WebCore::EventHandler::touchEventTargetSubframe const):
(WebCore::EventHandler::touches const):
Exposed some information needed by WebPage::updatePotentialTapSecurityOrigin().
* page/Frame.h:
* page/ios/FrameIOS.mm:
(WebCore::Frame::betterApproximateNode):
(WebCore::Frame::qualifyingNodeAtViewportLocation):
Changed NodeQualifier from a function pointer to a WTF::Function.
(WebCore::Frame::nodeRespondingToClickEvents):
Turned ancestorRespondingToClickEvents() into a lambda that captures originRestriction. In
the lambda, if there is an origin restriction, return nullptr if the hit test result's inner
Node is not in the restricted origin.
(WebCore::Frame::nodeRespondingToScrollWheelEvents):
Turned ancestorRespondingToScrollWheelEvents() into a lambda.
(WebCore::ancestorRespondingToScrollWheelEvents):
Moved to lambda in nodeRespondingToScrollWheelEvents().
(WebCore::ancestorRespondingToClickEvents):
Moved to lambda in nodeRespondingToClickEvents().
Source/WebKit:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::dispatchTouchEvent):
(WebKit::WebPage::updatePotentialTapSecurityOrigin):
Record the target frame origin of touch events that are potential taps, are
TouchStart events, are targeted in frames that have touch event listeners, and are not
handled by those listeners.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::potentialTapAtPosition):
(WebKit::WebPage::commitPotentialTap):
(WebKit::WebPage::cancelPotentialTapInFrame):
Passed the target frame origin to Frame::nodeRespondingToClickEvents() then cleared it.
LayoutTests:
* TestExpectations:
* http/tests/events/touch/ios/cross-frame-single-tap-same-origin.https-expected.txt: Added.
* http/tests/events/touch/ios/cross-frame-single-tap-same-origin.https.html: Added.
* http/tests/events/touch/ios/resources/click-target.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@227759 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/TestExpectations b/LayoutTests/TestExpectations
index 099289c..2b71e4f 100644
--- a/LayoutTests/TestExpectations
+++ b/LayoutTests/TestExpectations
@@ -36,6 +36,7 @@
media/controls/ipad [ Skip ]
fast/text-autosizing [ Skip ]
fast/css/variables/env/ios [ Skip ]
+http/tests/events/touch/ios [ Skip ]
http/tests/preload/viewport [ Skip ]
http/tests/gzip-content-encoding [ Skip ]