- Revision
- 186531
- Author
- aes...@apple.com
- Date
- 2015-07-08 16:02:43 -0700 (Wed, 08 Jul 2015)
Log Message
[iOS][WK2] Ignore synthetic clicks in subframes initiated on a previous page
https://bugs.webkit.org/show_bug.cgi?id=146712
Reviewed by Benjamin Poulain.
r178980 fixed an issue where, if a main frame navigation occurs in response to a touch event, a synthetic click
event could fire on the navigated-to page. This change extends this fix to apply to subframes.
* WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::WebFrame):
* WebProcess/WebPage/WebFrame.h:
(WebKit::WebFrame::firstLayerTreeTransactionIDAfterDidCommitLoad):
(WebKit::WebFrame::setFirstLayerTreeTransactionIDAfterDidCommitLoad):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::didCommitLoad): Stored the next layer tree transaction ID, and called cancelPotentialTapInFrame(), for the committed frame.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::handleTap): Determined the first post-commit layer tree transaction ID from the tap target node's frame.
(WebKit::WebPage::commitPotentialTap): Ditto.
(WebKit::WebPage::cancelPotentialTap): Called cancelPotentialTapInFrame(), passing m_mainFrame.
(WebKit::WebPage::cancelPotentialTapInFrame): Taught to only cancel a potential tap whose target node is a descendant of the given frame.
(WebKit::WebPage::updateVisibleContentRects): Updated to use the main frame's first post-commit layer tree transaction ID.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (186530 => 186531)
--- trunk/Source/WebKit2/ChangeLog 2015-07-08 22:53:41 UTC (rev 186530)
+++ trunk/Source/WebKit2/ChangeLog 2015-07-08 23:02:43 UTC (rev 186531)
@@ -1,3 +1,28 @@
+2015-07-07 Andy Estes <aes...@apple.com>
+
+ [iOS][WK2] Ignore synthetic clicks in subframes initiated on a previous page
+ https://bugs.webkit.org/show_bug.cgi?id=146712
+
+ Reviewed by Benjamin Poulain.
+
+ r178980 fixed an issue where, if a main frame navigation occurs in response to a touch event, a synthetic click
+ event could fire on the navigated-to page. This change extends this fix to apply to subframes.
+
+ * WebProcess/WebPage/WebFrame.cpp:
+ (WebKit::WebFrame::WebFrame):
+ * WebProcess/WebPage/WebFrame.h:
+ (WebKit::WebFrame::firstLayerTreeTransactionIDAfterDidCommitLoad):
+ (WebKit::WebFrame::setFirstLayerTreeTransactionIDAfterDidCommitLoad):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::didCommitLoad): Stored the next layer tree transaction ID, and called cancelPotentialTapInFrame(), for the committed frame.
+ * WebProcess/WebPage/WebPage.h:
+ * WebProcess/WebPage/ios/WebPageIOS.mm:
+ (WebKit::WebPage::handleTap): Determined the first post-commit layer tree transaction ID from the tap target node's frame.
+ (WebKit::WebPage::commitPotentialTap): Ditto.
+ (WebKit::WebPage::cancelPotentialTap): Called cancelPotentialTapInFrame(), passing m_mainFrame.
+ (WebKit::WebPage::cancelPotentialTapInFrame): Taught to only cancel a potential tap whose target node is a descendant of the given frame.
+ (WebKit::WebPage::updateVisibleContentRects): Updated to use the main frame's first post-commit layer tree transaction ID.
+
2015-07-08 Brady Eidson <beid...@apple.com>
Move PingLoaders to the NetworkingProcess.
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp (186530 => 186531)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp 2015-07-08 22:53:41 UTC (rev 186530)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp 2015-07-08 23:02:43 UTC (rev 186531)
@@ -155,6 +155,9 @@
, m_frameLoaderClient(WTF::move(frameLoaderClient))
, m_loadListener(0)
, m_frameID(generateFrameID())
+#if PLATFORM(IOS)
+ , m_firstLayerTreeTransactionIDAfterDidCommitLoad(0)
+#endif
{
m_frameLoaderClient->setWebFrame(this);
WebProcess::singleton().addWebFrame(m_frameID, this);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h (186530 => 186531)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h 2015-07-08 22:53:41 UTC (rev 186530)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h 2015-07-08 23:02:43 UTC (rev 186531)
@@ -155,6 +155,11 @@
PassRefPtr<ShareableBitmap> createSelectionSnapshot() const;
+#if PLATFORM(IOS)
+ uint64_t firstLayerTreeTransactionIDAfterDidCommitLoad() const { return m_firstLayerTreeTransactionIDAfterDidCommitLoad; }
+ void setFirstLayerTreeTransactionIDAfterDidCommitLoad(uint64_t transactionID) { m_firstLayerTreeTransactionIDAfterDidCommitLoad = transactionID; }
+#endif
+
private:
static PassRefPtr<WebFrame> create(std::unique_ptr<WebFrameLoaderClient>);
WebFrame(std::unique_ptr<WebFrameLoaderClient>);
@@ -169,6 +174,10 @@
LoadListener* m_loadListener;
uint64_t m_frameID;
+
+#if PLATFORM(IOS)
+ uint64_t m_firstLayerTreeTransactionIDAfterDidCommitLoad;
+#endif
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (186530 => 186531)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2015-07-08 22:53:41 UTC (rev 186530)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp 2015-07-08 23:02:43 UTC (rev 186531)
@@ -317,7 +317,6 @@
#endif
#if PLATFORM(IOS)
, m_selectionAnchor(Start)
- , m_firstLayerTreeTransactionIDAfterDidCommitLoad(0)
, m_hasReceivedVisibleContentRectsAfterDidCommitLoad(false)
, m_scaleWasSetByUIProcess(false)
, m_userHasChangedPageScaleFactor(false)
@@ -4612,6 +4611,11 @@
void WebPage::didCommitLoad(WebFrame* frame)
{
+#if PLATFORM(IOS)
+ frame->setFirstLayerTreeTransactionIDAfterDidCommitLoad(downcast<RemoteLayerTreeDrawingArea>(*m_drawingArea).nextTransactionID());
+ cancelPotentialTapInFrame(*frame);
+#endif
+
if (!frame->isMainFrame())
return;
@@ -4630,10 +4634,8 @@
#if PLATFORM(IOS)
m_hasReceivedVisibleContentRectsAfterDidCommitLoad = false;
m_scaleWasSetByUIProcess = false;
- m_firstLayerTreeTransactionIDAfterDidCommitLoad = downcast<RemoteLayerTreeDrawingArea>(*m_drawingArea).nextTransactionID();
m_userHasChangedPageScaleFactor = false;
m_estimatedLatency = std::chrono::milliseconds(1000 / 60);
- cancelPotentialTap();
#if ENABLE(IOS_TOUCH_EVENTS)
WebProcess::singleton().eventDispatcher().clearQueuedTouchEventsForPage(*this);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (186530 => 186531)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2015-07-08 22:53:41 UTC (rev 186530)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h 2015-07-08 23:02:43 UTC (rev 186531)
@@ -489,6 +489,7 @@
void commitPotentialTap(uint64_t lastLayerTreeTransactionId);
void commitPotentialTapFailed();
void cancelPotentialTap();
+ void cancelPotentialTapInFrame(WebFrame&);
void tapHighlightAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
@@ -1330,7 +1331,6 @@
WebCore::FloatPoint m_potentialTapLocation;
WebCore::ViewportConfiguration m_viewportConfiguration;
- uint64_t m_firstLayerTreeTransactionIDAfterDidCommitLoad;
bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad;
bool m_scaleWasSetByUIProcess;
bool m_userHasChangedPageScaleFactor;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (186530 => 186531)
--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2015-07-08 22:53:41 UTC (rev 186530)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm 2015-07-08 23:02:43 UTC (rev 186531)
@@ -610,14 +610,14 @@
void WebPage::handleTap(const IntPoint& point, uint64_t lastLayerTreeTransactionId)
{
- if (lastLayerTreeTransactionId < m_firstLayerTreeTransactionIDAfterDidCommitLoad) {
- send(Messages::WebPageProxy::DidNotHandleTapAsClick(roundedIntPoint(m_potentialTapLocation)));
- return;
- }
-
FloatPoint adjustedPoint;
Node* nodeRespondingToClick = m_page->mainFrame().nodeRespondingToClickEvents(point, adjustedPoint);
- handleSyntheticClick(nodeRespondingToClick, adjustedPoint);
+ Frame* frameRespondingToClick = nodeRespondingToClick ? nodeRespondingToClick->document().frame() : nullptr;
+
+ if (!frameRespondingToClick || lastLayerTreeTransactionId < WebFrame::fromCoreFrame(*frameRespondingToClick)->firstLayerTreeTransactionIDAfterDidCommitLoad())
+ send(Messages::WebPageProxy::DidNotHandleTapAsClick(roundedIntPoint(m_potentialTapLocation)));
+ else
+ handleSyntheticClick(nodeRespondingToClick, adjustedPoint);
}
void WebPage::sendTapHighlightForNodeIfNecessary(uint64_t requestID, Node* node)
@@ -664,14 +664,20 @@
void WebPage::commitPotentialTap(uint64_t lastLayerTreeTransactionId)
{
- if (!m_potentialTapNode || !m_potentialTapNode->renderer() || lastLayerTreeTransactionId < m_firstLayerTreeTransactionIDAfterDidCommitLoad) {
+ if (!m_potentialTapNode || !m_potentialTapNode->renderer()) {
commitPotentialTapFailed();
return;
}
FloatPoint adjustedPoint;
Node* nodeRespondingToClick = m_page->mainFrame().nodeRespondingToClickEvents(m_potentialTapLocation, adjustedPoint);
+ Frame* frameRespondingToClick = nodeRespondingToClick ? nodeRespondingToClick->document().frame() : nullptr;
+ if (!frameRespondingToClick || lastLayerTreeTransactionId < WebFrame::fromCoreFrame(*frameRespondingToClick)->firstLayerTreeTransactionIDAfterDidCommitLoad()) {
+ commitPotentialTapFailed();
+ return;
+ }
+
if (m_potentialTapNode == nodeRespondingToClick)
handleSyntheticClick(nodeRespondingToClick, adjustedPoint);
else
@@ -689,6 +695,17 @@
void WebPage::cancelPotentialTap()
{
+ cancelPotentialTapInFrame(*m_mainFrame);
+}
+
+void WebPage::cancelPotentialTapInFrame(WebFrame& frame)
+{
+ if (m_potentialTapNode) {
+ Frame* potentialTapFrame = m_potentialTapNode->document().frame();
+ if (potentialTapFrame && !potentialTapFrame->tree().isDescendantOf(frame.coreFrame()))
+ return;
+ }
+
m_potentialTapNode = nullptr;
m_potentialTapLocation = FloatPoint();
}
@@ -2796,7 +2813,7 @@
void WebPage::updateVisibleContentRects(const VisibleContentRectUpdateInfo& visibleContentRectUpdateInfo, double oldestTimestamp)
{
// Skip any VisibleContentRectUpdate that have been queued before DidCommitLoad suppresses the updates in the UIProcess.
- if (visibleContentRectUpdateInfo.lastLayerTreeTransactionID() < m_firstLayerTreeTransactionIDAfterDidCommitLoad)
+ if (visibleContentRectUpdateInfo.lastLayerTreeTransactionID() < m_mainFrame->firstLayerTreeTransactionIDAfterDidCommitLoad())
return;
m_hasReceivedVisibleContentRectsAfterDidCommitLoad = true;