Title: [242796] trunk/Source
Revision
242796
Author
[email protected]
Date
2019-03-12 09:40:31 -0700 (Tue, 12 Mar 2019)

Log 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (242795 => 242796)


--- trunk/Source/WebCore/ChangeLog	2019-03-12 15:07:13 UTC (rev 242795)
+++ trunk/Source/WebCore/ChangeLog	2019-03-12 16:40:31 UTC (rev 242796)
@@ -1,3 +1,20 @@
+2019-03-12  Zalan Bujtas  <[email protected]>
+
+        [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.
+
+        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:
+
 2019-03-12  Antti Koivisto  <[email protected]>
 
         Compositing layer that renders two positioned elements should not hit test

Modified: trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp (242795 => 242796)


--- trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-03-12 15:07:13 UTC (rev 242795)
+++ trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp	2019-03-12 16:40:31 UTC (rev 242796)
@@ -44,6 +44,15 @@
 {
 }
 
+void ContentChangeObserver::didRecognizeLongPress(Frame& mainframe)
+{
+    LOG(ContentObservation, "didRecognizeLongPress: cancel ongoing content change observing.");
+    for (auto* frame = &mainframe; frame; frame = frame->tree().traverseNext()) {
+        if (auto* document = frame->document())
+            document->contentChangeObserver().willNotProceedWithClick();
+    }
+}
+
 void ContentChangeObserver::startContentObservationForDuration(Seconds duration)
 {
     if (!m_document.settings().contentChangeObserverEnabled())
@@ -92,7 +101,7 @@
 {
     LOG(ContentObservation, "willNotProceedWithClick: click will not happen.");
     setIsBetweenTouchEndAndMouseMoved(false);
-    // FIXME: Add support for preventDefault() and long press.
+    // FIXME: Add support for preventDefault().
 }
 
 void ContentChangeObserver::domTimerExecuteDidStart(const DOMTimer& timer)

Modified: trunk/Source/WebCore/page/ios/ContentChangeObserver.h (242795 => 242796)


--- trunk/Source/WebCore/page/ios/ContentChangeObserver.h	2019-03-12 15:07:13 UTC (rev 242795)
+++ trunk/Source/WebCore/page/ios/ContentChangeObserver.h	2019-03-12 16:40:31 UTC (rev 242796)
@@ -46,6 +46,7 @@
     void didInstallDOMTimer(const DOMTimer&, Seconds timeout, bool singleShot);
     void didRemoveDOMTimer(const DOMTimer&);
     WEBCORE_EXPORT void willNotProceedWithClick();
+    WEBCORE_EXPORT static void didRecognizeLongPress(Frame& mainframe);
     void didSuspendActiveDOMObjects();
     void willDetachPage();
 
@@ -104,6 +105,8 @@
     void mouseMovedDidStart();
     void mouseMovedDidFinish();
 
+    void didRecognizeLongPress();
+
     void contentVisibilityDidChange();
 
     void setShouldObserveDOMTimerScheduling(bool observe) { m_isObservingDOMTimerScheduling = observe; }

Modified: trunk/Source/WebKit/ChangeLog (242795 => 242796)


--- trunk/Source/WebKit/ChangeLog	2019-03-12 15:07:13 UTC (rev 242795)
+++ trunk/Source/WebKit/ChangeLog	2019-03-12 16:40:31 UTC (rev 242796)
@@ -1,3 +1,23 @@
+2019-03-12  Zalan Bujtas  <[email protected]>
+
+        [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.
+
+        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):
+
 2019-03-11  Andy Estes  <[email protected]>
 
         [Mac] Ensure Apple Pay is unavailable when PassKit.framework is missing

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (242795 => 242796)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-03-12 15:07:13 UTC (rev 242795)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.h	2019-03-12 16:40:31 UTC (rev 242796)
@@ -1188,6 +1188,7 @@
     void cancelPotentialTap();
     void tapHighlightAtPosition(const WebCore::FloatPoint&, uint64_t& requestID);
     void handleTap(const WebCore::FloatPoint&, OptionSet<WebKit::WebEvent::Modifier>, uint64_t layerTreeTransactionIdAtLastTouchStart);
+    void didRecognizeLongPress();
 
     void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
     void inspectorNodeSearchEndedAtPosition(const WebCore::FloatPoint&);

Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (242795 => 242796)


--- trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-03-12 15:07:13 UTC (rev 242795)
+++ trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm	2019-03-12 16:40:31 UTC (rev 242796)
@@ -2175,6 +2175,7 @@
     ASSERT(gestureRecognizer == _longPressGestureRecognizer);
     [self _resetIsDoubleTapPending];
     [self _cancelTouchEventGestureRecognizer];
+    _page->didRecognizeLongPress();
 
     _lastInteractionLocation = gestureRecognizer.startPoint;
 

Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (242795 => 242796)


--- trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-03-12 15:07:13 UTC (rev 242795)
+++ trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm	2019-03-12 16:40:31 UTC (rev 242796)
@@ -838,6 +838,11 @@
     process().send(Messages::WebPage::HandleTap(roundedIntPoint(location), modifiers, layerTreeTransactionIdAtLastTouchStart), m_pageID);
 }
 
+void WebPageProxy::didRecognizeLongPress()
+{
+    process().send(Messages::WebPage::DidRecognizeLongPress(), m_pageID);
+}
+
 void WebPageProxy::inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint& position)
 {
     process().send(Messages::WebPage::InspectorNodeSearchMovedToPosition(position), m_pageID);

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (242795 => 242796)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-03-12 15:07:13 UTC (rev 242795)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.h	2019-03-12 16:40:31 UTC (rev 242796)
@@ -620,6 +620,7 @@
     void cancelPotentialTap();
     void cancelPotentialTapInFrame(WebFrame&);
     void tapHighlightAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
+    void didRecognizeLongPress();
 
     void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
     void inspectorNodeSearchEndedAtPosition(const WebCore::FloatPoint&);

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (242795 => 242796)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2019-03-12 15:07:13 UTC (rev 242795)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in	2019-03-12 16:40:31 UTC (rev 242796)
@@ -56,6 +56,7 @@
     CommitPotentialTap(OptionSet<WebKit::WebEvent::Modifier> modifiers, uint64_t lastLayerTreeTransactionId)
     CancelPotentialTap()
     TapHighlightAtPosition(uint64_t requestID, WebCore::FloatPoint point)
+    DidRecognizeLongPress()
     InspectorNodeSearchMovedToPosition(WebCore::FloatPoint point)
     InspectorNodeSearchEndedAtPosition(WebCore::FloatPoint point)
     BlurFocusedElement()

Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (242795 => 242796)


--- trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-03-12 15:07:13 UTC (rev 242795)
+++ trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm	2019-03-12 16:40:31 UTC (rev 242796)
@@ -890,6 +890,11 @@
     m_potentialTapSecurityOrigin = nullptr;
 }
 
+void WebPage::didRecognizeLongPress()
+{
+    ContentChangeObserver::didRecognizeLongPress(m_page->mainFrame());
+}
+
 void WebPage::tapHighlightAtPosition(uint64_t requestID, const FloatPoint& position)
 {
     Frame& mainframe = m_page->mainFrame();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to