⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 242796 in webkit


Ignore:
Timestamp:
Mar 12, 2019, 9:40:31 AM (7 years ago)
Author:
Alan Bujtas
Message:

[ContentChangeObserver] Stop content change observation when the touch event turns into long press
https://bugs.webkit.org/show_bug.cgi?id=195601
<rdar://problem/48796324>

Reviewed by Wenson Hsieh.

Source/WebCore:

Cancel the ongoing content observation (started at touchStart) when the touch event does not turn into a tap gesture.

Not testable because any subsequent tap would reset the state anyway (though it might be measurable through some code triggering heavy content change).

  • page/ios/ContentChangeObserver.cpp:

(WebCore::ContentChangeObserver::didRecognizeLongPress):
(WebCore::ContentChangeObserver::willNotProceedWithClick):

  • page/ios/ContentChangeObserver.h:

Source/WebKit:

Add didRecognizeLongPress() message to be able to cancel content observation (started at touchStart).

  • UIProcess/WebPageProxy.h:
  • UIProcess/ios/WKContentViewInteraction.mm:

(-[WKContentView _longPressRecognized:]):

  • UIProcess/ios/WebPageProxyIOS.mm:

(WebKit::WebPageProxy::didRecognizeLongPress):

  • WebProcess/WebPage/WebPage.h:
  • WebProcess/WebPage/WebPage.messages.in:
  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::didRecognizeLongPress):

Location:
trunk/Source
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r242794 r242796  
     12019-03-12  Zalan Bujtas  <zalan@apple.com>
     2
     3        [ContentChangeObserver] Stop content change observation when the touch event turns into long press
     4        https://bugs.webkit.org/show_bug.cgi?id=195601
     5        <rdar://problem/48796324>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        Cancel the ongoing content observation (started at touchStart) when the touch event does not turn into a tap gesture.
     10
     11        Not testable because any subsequent tap would reset the state anyway (though it might be measurable through some code triggering heavy content change).
     12
     13        * page/ios/ContentChangeObserver.cpp:
     14        (WebCore::ContentChangeObserver::didRecognizeLongPress):
     15        (WebCore::ContentChangeObserver::willNotProceedWithClick):
     16        * page/ios/ContentChangeObserver.h:
     17
    1182019-03-12  Antti Koivisto  <antti@apple.com>
    219
  • trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp

    r242689 r242796  
    4545}
    4646
     47void ContentChangeObserver::didRecognizeLongPress(Frame& mainframe)
     48{
     49    LOG(ContentObservation, "didRecognizeLongPress: cancel ongoing content change observing.");
     50    for (auto* frame = &mainframe; frame; frame = frame->tree().traverseNext()) {
     51        if (auto* document = frame->document())
     52            document->contentChangeObserver().willNotProceedWithClick();
     53    }
     54}
     55
    4756void ContentChangeObserver::startContentObservationForDuration(Seconds duration)
    4857{
     
    93102    LOG(ContentObservation, "willNotProceedWithClick: click will not happen.");
    94103    setIsBetweenTouchEndAndMouseMoved(false);
    95     // FIXME: Add support for preventDefault() and long press.
     104    // FIXME: Add support for preventDefault().
    96105}
    97106
  • trunk/Source/WebCore/page/ios/ContentChangeObserver.h

    r242714 r242796  
    4747    void didRemoveDOMTimer(const DOMTimer&);
    4848    WEBCORE_EXPORT void willNotProceedWithClick();
     49    WEBCORE_EXPORT static void didRecognizeLongPress(Frame& mainframe);
    4950    void didSuspendActiveDOMObjects();
    5051    void willDetachPage();
     
    104105    void mouseMovedDidStart();
    105106    void mouseMovedDidFinish();
     107
     108    void didRecognizeLongPress();
    106109
    107110    void contentVisibilityDidChange();
  • trunk/Source/WebKit/ChangeLog

    r242795 r242796  
     12019-03-12  Zalan Bujtas  <zalan@apple.com>
     2
     3        [ContentChangeObserver] Stop content change observation when the touch event turns into long press
     4        https://bugs.webkit.org/show_bug.cgi?id=195601
     5        <rdar://problem/48796324>
     6
     7        Reviewed by Wenson Hsieh.
     8
     9        Add didRecognizeLongPress() message to be able to cancel content observation (started at touchStart).
     10
     11        * UIProcess/WebPageProxy.h:
     12        * UIProcess/ios/WKContentViewInteraction.mm:
     13        (-[WKContentView _longPressRecognized:]):
     14        * UIProcess/ios/WebPageProxyIOS.mm:
     15        (WebKit::WebPageProxy::didRecognizeLongPress):
     16        * WebProcess/WebPage/WebPage.h:
     17        * WebProcess/WebPage/WebPage.messages.in:
     18        * WebProcess/WebPage/ios/WebPageIOS.mm:
     19        (WebKit::WebPage::didRecognizeLongPress):
     20
    1212019-03-11  Andy Estes  <aestes@apple.com>
    222
  • trunk/Source/WebKit/UIProcess/WebPageProxy.h

    r242760 r242796  
    11891189    void tapHighlightAtPosition(const WebCore::FloatPoint&, uint64_t& requestID);
    11901190    void handleTap(const WebCore::FloatPoint&, OptionSet<WebKit::WebEvent::Modifier>, uint64_t layerTreeTransactionIdAtLastTouchStart);
     1191    void didRecognizeLongPress();
    11911192
    11921193    void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
  • trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm

    r242757 r242796  
    21762176    [self _resetIsDoubleTapPending];
    21772177    [self _cancelTouchEventGestureRecognizer];
     2178    _page->didRecognizeLongPress();
    21782179
    21792180    _lastInteractionLocation = gestureRecognizer.startPoint;
  • trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm

    r242757 r242796  
    839839}
    840840
     841void WebPageProxy::didRecognizeLongPress()
     842{
     843    process().send(Messages::WebPage::DidRecognizeLongPress(), m_pageID);
     844}
     845
    841846void WebPageProxy::inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint& position)
    842847{
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.h

    r242757 r242796  
    621621    void cancelPotentialTapInFrame(WebFrame&);
    622622    void tapHighlightAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
     623    void didRecognizeLongPress();
    623624
    624625    void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
  • trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in

    r242757 r242796  
    5757    CancelPotentialTap()
    5858    TapHighlightAtPosition(uint64_t requestID, WebCore::FloatPoint point)
     59    DidRecognizeLongPress()
    5960    InspectorNodeSearchMovedToPosition(WebCore::FloatPoint point)
    6061    InspectorNodeSearchEndedAtPosition(WebCore::FloatPoint point)
  • trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm

    r242777 r242796  
    891891}
    892892
     893void WebPage::didRecognizeLongPress()
     894{
     895    ContentChangeObserver::didRecognizeLongPress(m_page->mainFrame());
     896}
     897
    893898void WebPage::tapHighlightAtPosition(uint64_t requestID, const FloatPoint& position)
    894899{
Note: See TracChangeset for help on using the changeset viewer.