Title: [179885] trunk/Source/WebKit2
Revision
179885
Author
enr...@apple.com
Date
2015-02-10 15:02:22 -0800 (Tue, 10 Feb 2015)

Log Message

Hit testing is misplaced when selecting on wikipedia page.
https://bugs.webkit.org/show_bug.cgi?id=141410
rdar://problem/19768211

Reviewed by Simon Fraser.

When loading a new document into the same WebPage object, we need
to clear the assisted node, since there is no guarantee that the
node will be blurred. The bug was caused by the use of a stale
assisted node to constrain the point where the gesture occurs.
The node was still valid, since the previous page was in the cache.
I've added a ASSERT to check that, when constraining the point to
node rectangle, the node is in the same document as the one we
are performing hit test on. When the frame is detached, we clear
the assisted node if the node is part of the document is the frame
being detached.

* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::detachedFromParent2):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::constrainPoint):
(WebKit::WebPage::resetAssistedNodeForFrame):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (179884 => 179885)


--- trunk/Source/WebKit2/ChangeLog	2015-02-10 22:40:00 UTC (rev 179884)
+++ trunk/Source/WebKit2/ChangeLog	2015-02-10 23:02:22 UTC (rev 179885)
@@ -1,3 +1,29 @@
+2015-02-10  Enrica Casucci  <enr...@apple.com>
+
+        Hit testing is misplaced when selecting on wikipedia page.
+        https://bugs.webkit.org/show_bug.cgi?id=141410
+        rdar://problem/19768211
+
+        Reviewed by Simon Fraser.
+
+        When loading a new document into the same WebPage object, we need
+        to clear the assisted node, since there is no guarantee that the
+        node will be blurred. The bug was caused by the use of a stale
+        assisted node to constrain the point where the gesture occurs.
+        The node was still valid, since the previous page was in the cache.
+        I've added a ASSERT to check that, when constraining the point to
+        node rectangle, the node is in the same document as the one we
+        are performing hit test on. When the frame is detached, we clear
+        the assisted node if the node is part of the document is the frame
+        being detached.
+
+        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+        (WebKit::WebFrameLoaderClient::detachedFromParent2):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::constrainPoint):
+        (WebKit::WebPage::resetAssistedNodeForFrame):
+
 2015-02-10  Joseph Pecoraro  <pecor...@apple.com>
 
         [Cocoa] NSData over retain in WKBrowsingContextController loadData

Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (179884 => 179885)


--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2015-02-10 22:40:00 UTC (rev 179884)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp	2015-02-10 23:02:22 UTC (rev 179885)
@@ -142,6 +142,9 @@
     if (!webPage)
         return;
 
+#if PLATFORM(IOS)
+    webPage->resetAssistedNodeForFrame(m_frame);
+#endif
     RefPtr<API::Object> userData;
 
     // Notify the bundle client.

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (179884 => 179885)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-02-10 22:40:00 UTC (rev 179884)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2015-02-10 23:02:22 UTC (rev 179885)
@@ -516,6 +516,7 @@
     void setAssistedNodeValue(const String&);
     void setAssistedNodeValueAsNumber(double);
     void setAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection);
+    void resetAssistedNodeForFrame(WebFrame*);
     WebCore::IntRect rectForElementAtInteractionLocation();
     void updateSelectionAppearance();
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (179884 => 179885)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2015-02-10 22:40:00 UTC (rev 179884)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2015-02-10 23:02:22 UTC (rev 179885)
@@ -695,6 +695,7 @@
 
 static IntPoint constrainPoint(const IntPoint& point, Frame* frame, Node* assistedNode)
 {
+    ASSERT(!assistedNode || &assistedNode->document() == frame->document());
     const int DEFAULT_CONSTRAIN_INSET = 2;
     IntRect innerFrame = innerFrameQuad(frame, assistedNode).enclosingBoundingBox();
     IntPoint constrainedPoint = point;
@@ -2264,6 +2265,16 @@
     }
 }
 
+void WebPage::resetAssistedNodeForFrame(WebFrame* frame)
+{
+    if (!m_assistedNode)
+        return;
+    if (m_assistedNode->document().frame() == frame->coreFrame()) {
+        send(Messages::WebPageProxy::StopAssistingNode());
+        m_assistedNode = nullptr;
+    }
+}
+
 void WebPage::elementDidFocus(WebCore::Node* node)
 {
     if (node->hasTagName(WebCore::HTMLNames::selectTag) || node->hasTagName(WebCore::HTMLNames::inputTag) || node->hasTagName(WebCore::HTMLNames::textareaTag) || node->hasEditableStyle()) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to