Title: [186785] branches/safari-600.1.4.17-branch/Source/WebKit2

Diff

Modified: branches/safari-600.1.4.17-branch/Source/WebKit2/ChangeLog (186784 => 186785)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/ChangeLog	2015-07-13 22:09:48 UTC (rev 186784)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/ChangeLog	2015-07-13 22:16:54 UTC (rev 186785)
@@ -1,5 +1,34 @@
 2015-07-13  David Kilzer  <[email protected]>
 
+        Merge r186531. rdar://problem/21708155
+
+    2015-07-07  Andy Estes  <[email protected]>
+
+        [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-13  David Kilzer  <[email protected]>
+
         Merge r186530. rdar://problem/21708151
 
     2015-07-08  Brady Eidson  <[email protected]>

Modified: branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp (186784 => 186785)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp	2015-07-13 22:09:48 UTC (rev 186784)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp	2015-07-13 22:16:54 UTC (rev 186785)
@@ -151,6 +151,9 @@
     , m_frameLoaderClient(WTF::move(frameLoaderClient))
     , m_loadListener(0)
     , m_frameID(generateFrameID())
+#if PLATFORM(IOS)
+    , m_firstLayerTreeTransactionIDAfterDidCommitLoad(0)
+#endif
 {
     m_frameLoaderClient->setWebFrame(this);
     WebProcess::shared().addWebFrame(m_frameID, this);

Modified: branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebPage/WebFrame.h (186784 => 186785)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebPage/WebFrame.h	2015-07-13 22:09:48 UTC (rev 186784)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebPage/WebFrame.h	2015-07-13 22:16:54 UTC (rev 186785)
@@ -149,6 +149,11 @@
     RetainPtr<CFDataRef> webArchiveData(FrameFilterFunction, void* context);
 #endif
 
+#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>);
@@ -163,6 +168,10 @@
     LoadListener* m_loadListener;
     
     uint64_t m_frameID;
+
+#if PLATFORM(IOS)
+    uint64_t m_firstLayerTreeTransactionIDAfterDidCommitLoad;
+#endif
 };
 
 } // namespace WebKit

Modified: branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (186784 => 186785)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-07-13 22:09:48 UTC (rev 186784)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-07-13 22:16:54 UTC (rev 186785)
@@ -298,7 +298,6 @@
     , m_isShowingContextMenu(false)
 #endif
 #if PLATFORM(IOS)
-    , m_firstLayerTreeTransactionIDAfterDidCommitLoad(0)
     , m_hasReceivedVisibleContentRectsAfterDidCommitLoad(false)
     , m_scaleWasSetByUIProcess(false)
     , m_userHasChangedPageScaleFactor(false)
@@ -4480,6 +4479,11 @@
 
 void WebPage::didCommitLoad(WebFrame* frame)
 {
+#if PLATFORM(IOS)
+    frame->setFirstLayerTreeTransactionIDAfterDidCommitLoad(toRemoteLayerTreeDrawingArea(*m_drawingArea).nextTransactionID());
+    cancelPotentialTapInFrame(*frame);
+#endif
+
     if (!frame->isMainFrame())
         return;
 
@@ -4503,10 +4507,8 @@
 #if PLATFORM(IOS)
     m_hasReceivedVisibleContentRectsAfterDidCommitLoad = false;
     m_scaleWasSetByUIProcess = false;
-    m_firstLayerTreeTransactionIDAfterDidCommitLoad = toRemoteLayerTreeDrawingArea(*m_drawingArea).nextTransactionID();
     m_userHasChangedPageScaleFactor = false;
     m_estimatedLatency = std::chrono::milliseconds(1000 / 60);
-    cancelPotentialTap();
 
     WebProcess::shared().eventDispatcher().clearQueuedTouchEventsForPage(*this);
 

Modified: branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h (186784 => 186785)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-07-13 22:09:48 UTC (rev 186784)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-07-13 22:16:54 UTC (rev 186785)
@@ -473,6 +473,7 @@
     void commitPotentialTap(uint64_t lastLayerTreeTranscationId);
     void commitPotentialTapFailed();
     void cancelPotentialTap();
+    void cancelPotentialTapInFrame(WebFrame&);
     void tapHighlightAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
 
     void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
@@ -1234,7 +1235,6 @@
     WebCore::FloatPoint m_potentialTapLocation;
 
     WebCore::ViewportConfiguration m_viewportConfiguration;
-    uint64_t m_firstLayerTreeTransactionIDAfterDidCommitLoad;
     bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad;
     bool m_scaleWasSetByUIProcess;
     bool m_userHasChangedPageScaleFactor;

Modified: branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (186784 => 186785)


--- branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2015-07-13 22:09:48 UTC (rev 186784)
+++ branches/safari-600.1.4.17-branch/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2015-07-13 22:16:54 UTC (rev 186785)
@@ -499,16 +499,16 @@
         send(Messages::WebPageProxy::DidNotHandleTapAsClick(roundedIntPoint(location)));
 }
 
-void WebPage::handleTap(const IntPoint& point, uint64_t lastLayerTreeTranscationId)
+void WebPage::handleTap(const IntPoint& point, uint64_t lastLayerTreeTransactionId)
 {
-    if (lastLayerTreeTranscationId < 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)
@@ -550,16 +550,22 @@
     sendTapHighlightForNodeIfNecessary(requestID, m_potentialTapNode.get());
 }
 
-void WebPage::commitPotentialTap(uint64_t lastLayerTreeTranscationId)
+void WebPage::commitPotentialTap(uint64_t lastLayerTreeTransactionId)
 {
-    if (!m_potentialTapNode || !m_potentialTapNode->renderer() || lastLayerTreeTranscationId < 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
@@ -577,6 +583,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();
 }
@@ -2534,7 +2551,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;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to