Changeset 179885 in webkit


Ignore:
Timestamp:
Feb 10, 2015 3:02:22 PM (9 years ago)
Author:
enrica@apple.com
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):

Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r179874 r179885  
     12015-02-10  Enrica Casucci  <enrica@apple.com>
     2
     3        Hit testing is misplaced when selecting on wikipedia page.
     4        https://bugs.webkit.org/show_bug.cgi?id=141410
     5        rdar://problem/19768211
     6
     7        Reviewed by Simon Fraser.
     8
     9        When loading a new document into the same WebPage object, we need
     10        to clear the assisted node, since there is no guarantee that the
     11        node will be blurred. The bug was caused by the use of a stale
     12        assisted node to constrain the point where the gesture occurs.
     13        The node was still valid, since the previous page was in the cache.
     14        I've added a ASSERT to check that, when constraining the point to
     15        node rectangle, the node is in the same document as the one we
     16        are performing hit test on. When the frame is detached, we clear
     17        the assisted node if the node is part of the document is the frame
     18        being detached.
     19
     20        * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
     21        (WebKit::WebFrameLoaderClient::detachedFromParent2):
     22        * WebProcess/WebPage/WebPage.h:
     23        * WebProcess/WebPage/ios/WebPageIOS.mm:
     24        (WebKit::constrainPoint):
     25        (WebKit::WebPage::resetAssistedNodeForFrame):
     26
    1272015-02-10  Joseph Pecoraro  <pecoraro@apple.com>
    228
  • trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp

    r179409 r179885  
    143143        return;
    144144
     145#if PLATFORM(IOS)
     146    webPage->resetAssistedNodeForFrame(m_frame);
     147#endif
    145148    RefPtr<API::Object> userData;
    146149
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r178980 r179885  
    517517    void setAssistedNodeValueAsNumber(double);
    518518    void setAssistedNodeSelectedIndex(uint32_t index, bool allowMultipleSelection);
     519    void resetAssistedNodeForFrame(WebFrame*);
    519520    WebCore::IntRect rectForElementAtInteractionLocation();
    520521    void updateSelectionAppearance();
  • trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r179847 r179885  
    696696static IntPoint constrainPoint(const IntPoint& point, Frame* frame, Node* assistedNode)
    697697{
     698    ASSERT(!assistedNode || &assistedNode->document() == frame->document());
    698699    const int DEFAULT_CONSTRAIN_INSET = 2;
    699700    IntRect innerFrame = innerFrameQuad(frame, assistedNode).enclosingBoundingBox();
     
    22652266}
    22662267
     2268void WebPage::resetAssistedNodeForFrame(WebFrame* frame)
     2269{
     2270    if (!m_assistedNode)
     2271        return;
     2272    if (m_assistedNode->document().frame() == frame->coreFrame()) {
     2273        send(Messages::WebPageProxy::StopAssistingNode());
     2274        m_assistedNode = nullptr;
     2275    }
     2276}
     2277
    22672278void WebPage::elementDidFocus(WebCore::Node* node)
    22682279{
Note: See TracChangeset for help on using the changeset viewer.