Changeset 186531 in webkit


Ignore:
Timestamp:
Jul 8, 2015, 4:02:43 PM (10 years ago)
Author:
aestes@apple.com
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.

Location:
trunk/Source/WebKit2
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r186530 r186531  
     12015-07-07  Andy Estes  <aestes@apple.com>
     2
     3        [iOS][WK2] Ignore synthetic clicks in subframes initiated on a previous page
     4        https://bugs.webkit.org/show_bug.cgi?id=146712
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        r178980 fixed an issue where, if a main frame navigation occurs in response to a touch event, a synthetic click
     9        event could fire on the navigated-to page. This change extends this fix to apply to subframes.
     10
     11        * WebProcess/WebPage/WebFrame.cpp:
     12        (WebKit::WebFrame::WebFrame):
     13        * WebProcess/WebPage/WebFrame.h:
     14        (WebKit::WebFrame::firstLayerTreeTransactionIDAfterDidCommitLoad):
     15        (WebKit::WebFrame::setFirstLayerTreeTransactionIDAfterDidCommitLoad):
     16        * WebProcess/WebPage/WebPage.cpp:
     17        (WebKit::WebPage::didCommitLoad): Stored the next layer tree transaction ID, and called cancelPotentialTapInFrame(), for the committed frame.
     18        * WebProcess/WebPage/WebPage.h:
     19        * WebProcess/WebPage/ios/WebPageIOS.mm:
     20        (WebKit::WebPage::handleTap): Determined the first post-commit layer tree transaction ID from the tap target node's frame.
     21        (WebKit::WebPage::commitPotentialTap): Ditto.
     22        (WebKit::WebPage::cancelPotentialTap): Called cancelPotentialTapInFrame(), passing m_mainFrame.
     23        (WebKit::WebPage::cancelPotentialTapInFrame): Taught to only cancel a potential tap whose target node is a descendant of the given frame.
     24        (WebKit::WebPage::updateVisibleContentRects): Updated to use the main frame's first post-commit layer tree transaction ID.
     25
    1262015-07-08  Brady Eidson  <beidson@apple.com>
    227
  • trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp

    r183105 r186531  
    156156    , m_loadListener(0)
    157157    , m_frameID(generateFrameID())
     158#if PLATFORM(IOS)
     159    , m_firstLayerTreeTransactionIDAfterDidCommitLoad(0)
     160#endif
    158161{
    159162    m_frameLoaderClient->setWebFrame(this);
  • trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h

    r183105 r186531  
    156156    PassRefPtr<ShareableBitmap> createSelectionSnapshot() const;
    157157
     158#if PLATFORM(IOS)
     159    uint64_t firstLayerTreeTransactionIDAfterDidCommitLoad() const { return m_firstLayerTreeTransactionIDAfterDidCommitLoad; }
     160    void setFirstLayerTreeTransactionIDAfterDidCommitLoad(uint64_t transactionID) { m_firstLayerTreeTransactionIDAfterDidCommitLoad = transactionID; }
     161#endif
     162
    158163private:
    159164    static PassRefPtr<WebFrame> create(std::unique_ptr<WebFrameLoaderClient>);
     
    170175   
    171176    uint64_t m_frameID;
     177
     178#if PLATFORM(IOS)
     179    uint64_t m_firstLayerTreeTransactionIDAfterDidCommitLoad;
     180#endif
    172181};
    173182
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r186304 r186531  
    318318#if PLATFORM(IOS)
    319319    , m_selectionAnchor(Start)
    320     , m_firstLayerTreeTransactionIDAfterDidCommitLoad(0)
    321320    , m_hasReceivedVisibleContentRectsAfterDidCommitLoad(false)
    322321    , m_scaleWasSetByUIProcess(false)
     
    46134612void WebPage::didCommitLoad(WebFrame* frame)
    46144613{
     4614#if PLATFORM(IOS)
     4615    frame->setFirstLayerTreeTransactionIDAfterDidCommitLoad(downcast<RemoteLayerTreeDrawingArea>(*m_drawingArea).nextTransactionID());
     4616    cancelPotentialTapInFrame(*frame);
     4617#endif
     4618
    46154619    if (!frame->isMainFrame())
    46164620        return;
     
    46314635    m_hasReceivedVisibleContentRectsAfterDidCommitLoad = false;
    46324636    m_scaleWasSetByUIProcess = false;
    4633     m_firstLayerTreeTransactionIDAfterDidCommitLoad = downcast<RemoteLayerTreeDrawingArea>(*m_drawingArea).nextTransactionID();
    46344637    m_userHasChangedPageScaleFactor = false;
    46354638    m_estimatedLatency = std::chrono::milliseconds(1000 / 60);
    4636     cancelPotentialTap();
    46374639
    46384640#if ENABLE(IOS_TOUCH_EVENTS)
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h

    r186304 r186531  
    490490    void commitPotentialTapFailed();
    491491    void cancelPotentialTap();
     492    void cancelPotentialTapInFrame(WebFrame&);
    492493    void tapHighlightAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
    493494
     
    13311332
    13321333    WebCore::ViewportConfiguration m_viewportConfiguration;
    1333     uint64_t m_firstLayerTreeTransactionIDAfterDidCommitLoad;
    13341334    bool m_hasReceivedVisibleContentRectsAfterDidCommitLoad;
    13351335    bool m_scaleWasSetByUIProcess;
  • trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm

    r186522 r186531  
    611611void WebPage::handleTap(const IntPoint& point, uint64_t lastLayerTreeTransactionId)
    612612{
    613     if (lastLayerTreeTransactionId < m_firstLayerTreeTransactionIDAfterDidCommitLoad) {
    614         send(Messages::WebPageProxy::DidNotHandleTapAsClick(roundedIntPoint(m_potentialTapLocation)));
    615         return;
    616     }
    617 
    618613    FloatPoint adjustedPoint;
    619614    Node* nodeRespondingToClick = m_page->mainFrame().nodeRespondingToClickEvents(point, adjustedPoint);
    620     handleSyntheticClick(nodeRespondingToClick, adjustedPoint);
     615    Frame* frameRespondingToClick = nodeRespondingToClick ? nodeRespondingToClick->document().frame() : nullptr;
     616
     617    if (!frameRespondingToClick || lastLayerTreeTransactionId < WebFrame::fromCoreFrame(*frameRespondingToClick)->firstLayerTreeTransactionIDAfterDidCommitLoad())
     618        send(Messages::WebPageProxy::DidNotHandleTapAsClick(roundedIntPoint(m_potentialTapLocation)));
     619    else
     620        handleSyntheticClick(nodeRespondingToClick, adjustedPoint);
    621621}
    622622
     
    665665void WebPage::commitPotentialTap(uint64_t lastLayerTreeTransactionId)
    666666{
    667     if (!m_potentialTapNode || !m_potentialTapNode->renderer() || lastLayerTreeTransactionId < m_firstLayerTreeTransactionIDAfterDidCommitLoad) {
     667    if (!m_potentialTapNode || !m_potentialTapNode->renderer()) {
    668668        commitPotentialTapFailed();
    669669        return;
     
    672672    FloatPoint adjustedPoint;
    673673    Node* nodeRespondingToClick = m_page->mainFrame().nodeRespondingToClickEvents(m_potentialTapLocation, adjustedPoint);
     674    Frame* frameRespondingToClick = nodeRespondingToClick ? nodeRespondingToClick->document().frame() : nullptr;
     675
     676    if (!frameRespondingToClick || lastLayerTreeTransactionId < WebFrame::fromCoreFrame(*frameRespondingToClick)->firstLayerTreeTransactionIDAfterDidCommitLoad()) {
     677        commitPotentialTapFailed();
     678        return;
     679    }
    674680
    675681    if (m_potentialTapNode == nodeRespondingToClick)
     
    690696void WebPage::cancelPotentialTap()
    691697{
     698    cancelPotentialTapInFrame(*m_mainFrame);
     699}
     700
     701void WebPage::cancelPotentialTapInFrame(WebFrame& frame)
     702{
     703    if (m_potentialTapNode) {
     704        Frame* potentialTapFrame = m_potentialTapNode->document().frame();
     705        if (potentialTapFrame && !potentialTapFrame->tree().isDescendantOf(frame.coreFrame()))
     706            return;
     707    }
     708
    692709    m_potentialTapNode = nullptr;
    693710    m_potentialTapLocation = FloatPoint();
     
    27972814{
    27982815    // Skip any VisibleContentRectUpdate that have been queued before DidCommitLoad suppresses the updates in the UIProcess.
    2799     if (visibleContentRectUpdateInfo.lastLayerTreeTransactionID() < m_firstLayerTreeTransactionIDAfterDidCommitLoad)
     2816    if (visibleContentRectUpdateInfo.lastLayerTreeTransactionID() < m_mainFrame->firstLayerTreeTransactionIDAfterDidCommitLoad())
    28002817        return;
    28012818
Note: See TracChangeset for help on using the changeset viewer.