<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[242796] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/242796">242796</a></dd>
<dt>Author</dt> <dd>zalan@apple.com</dd>
<dt>Date</dt> <dd>2019-03-12 09:40:31 -0700 (Tue, 12 Mar 2019)</dd>
</dl>

<h3>Log Message</h3>
<pre>[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):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageiosContentChangeObservercpp">trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp</a></li>
<li><a href="#trunkSourceWebCorepageiosContentChangeObserverh">trunk/Source/WebCore/page/ios/ContentChangeObserver.h</a></li>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitUIProcessWebPageProxyh">trunk/Source/WebKit/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosWKContentViewInteractionmm">trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm</a></li>
<li><a href="#trunkSourceWebKitUIProcessiosWebPageProxyIOSmm">trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageWebPageh">trunk/Source/WebKit/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageWebPagemessagesin">trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (242795 => 242796)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2019-03-12  Zalan Bujtas  <zalan@apple.com>
+
+        [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:
+
</ins><span class="cx"> 2019-03-12  Antti Koivisto  <antti@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Compositing layer that renders two positioned elements should not hit test
</span></span></pre></div>
<a id="trunkSourceWebCorepageiosContentChangeObservercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ios/ContentChangeObserver.cpp (242795 => 242796)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -44,6 +44,15 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+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();
+    }
+}
+
</ins><span class="cx"> void ContentChangeObserver::startContentObservationForDuration(Seconds duration)
</span><span class="cx"> {
</span><span class="cx">     if (!m_document.settings().contentChangeObserverEnabled())
</span><span class="lines">@@ -92,7 +101,7 @@
</span><span class="cx"> {
</span><span class="cx">     LOG(ContentObservation, "willNotProceedWithClick: click will not happen.");
</span><span class="cx">     setIsBetweenTouchEndAndMouseMoved(false);
</span><del>-    // FIXME: Add support for preventDefault() and long press.
</del><ins>+    // FIXME: Add support for preventDefault().
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ContentChangeObserver::domTimerExecuteDidStart(const DOMTimer& timer)
</span></span></pre></div>
<a id="trunkSourceWebCorepageiosContentChangeObserverh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/ios/ContentChangeObserver.h (242795 => 242796)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx">     void didInstallDOMTimer(const DOMTimer&, Seconds timeout, bool singleShot);
</span><span class="cx">     void didRemoveDOMTimer(const DOMTimer&);
</span><span class="cx">     WEBCORE_EXPORT void willNotProceedWithClick();
</span><ins>+    WEBCORE_EXPORT static void didRecognizeLongPress(Frame& mainframe);
</ins><span class="cx">     void didSuspendActiveDOMObjects();
</span><span class="cx">     void willDetachPage();
</span><span class="cx"> 
</span><span class="lines">@@ -104,6 +105,8 @@
</span><span class="cx">     void mouseMovedDidStart();
</span><span class="cx">     void mouseMovedDidFinish();
</span><span class="cx"> 
</span><ins>+    void didRecognizeLongPress();
+
</ins><span class="cx">     void contentVisibilityDidChange();
</span><span class="cx"> 
</span><span class="cx">     void setShouldObserveDOMTimerScheduling(bool observe) { m_isObservingDOMTimerScheduling = observe; }
</span></span></pre></div>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (242795 => 242796)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2019-03-12  Zalan Bujtas  <zalan@apple.com>
+
+        [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):
+
</ins><span class="cx"> 2019-03-11  Andy Estes  <aestes@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [Mac] Ensure Apple Pay is unavailable when PassKit.framework is missing
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.h (242795 => 242796)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1188,6 +1188,7 @@
</span><span class="cx">     void cancelPotentialTap();
</span><span class="cx">     void tapHighlightAtPosition(const WebCore::FloatPoint&, uint64_t& requestID);
</span><span class="cx">     void handleTap(const WebCore::FloatPoint&, OptionSet<WebKit::WebEvent::Modifier>, uint64_t layerTreeTransactionIdAtLastTouchStart);
</span><ins>+    void didRecognizeLongPress();
</ins><span class="cx"> 
</span><span class="cx">     void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
</span><span class="cx">     void inspectorNodeSearchEndedAtPosition(const WebCore::FloatPoint&);
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWKContentViewInteractionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm (242795 => 242796)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -2175,6 +2175,7 @@
</span><span class="cx">     ASSERT(gestureRecognizer == _longPressGestureRecognizer);
</span><span class="cx">     [self _resetIsDoubleTapPending];
</span><span class="cx">     [self _cancelTouchEventGestureRecognizer];
</span><ins>+    _page->didRecognizeLongPress();
</ins><span class="cx"> 
</span><span class="cx">     _lastInteractionLocation = gestureRecognizer.startPoint;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitUIProcessiosWebPageProxyIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm (242795 => 242796)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -838,6 +838,11 @@
</span><span class="cx">     process().send(Messages::WebPage::HandleTap(roundedIntPoint(location), modifiers, layerTreeTransactionIdAtLastTouchStart), m_pageID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPageProxy::didRecognizeLongPress()
+{
+    process().send(Messages::WebPage::DidRecognizeLongPress(), m_pageID);
+}
+
</ins><span class="cx"> void WebPageProxy::inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint& position)
</span><span class="cx"> {
</span><span class="cx">     process().send(Messages::WebPage::InspectorNodeSearchMovedToPosition(position), m_pageID);
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.h (242795 => 242796)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -620,6 +620,7 @@
</span><span class="cx">     void cancelPotentialTap();
</span><span class="cx">     void cancelPotentialTapInFrame(WebFrame&);
</span><span class="cx">     void tapHighlightAtPosition(uint64_t requestID, const WebCore::FloatPoint&);
</span><ins>+    void didRecognizeLongPress();
</ins><span class="cx"> 
</span><span class="cx">     void inspectorNodeSearchMovedToPosition(const WebCore::FloatPoint&);
</span><span class="cx">     void inspectorNodeSearchEndedAtPosition(const WebCore::FloatPoint&);
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.messages.in (242795 => 242796)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx">     CommitPotentialTap(OptionSet<WebKit::WebEvent::Modifier> modifiers, uint64_t lastLayerTreeTransactionId)
</span><span class="cx">     CancelPotentialTap()
</span><span class="cx">     TapHighlightAtPosition(uint64_t requestID, WebCore::FloatPoint point)
</span><ins>+    DidRecognizeLongPress()
</ins><span class="cx">     InspectorNodeSearchMovedToPosition(WebCore::FloatPoint point)
</span><span class="cx">     InspectorNodeSearchEndedAtPosition(WebCore::FloatPoint point)
</span><span class="cx">     BlurFocusedElement()
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm (242795 => 242796)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -890,6 +890,11 @@
</span><span class="cx">     m_potentialTapSecurityOrigin = nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPage::didRecognizeLongPress()
+{
+    ContentChangeObserver::didRecognizeLongPress(m_page->mainFrame());
+}
+
</ins><span class="cx"> void WebPage::tapHighlightAtPosition(uint64_t requestID, const FloatPoint& position)
</span><span class="cx"> {
</span><span class="cx">     Frame& mainframe = m_page->mainFrame();
</span></span></pre>
</div>
</div>

</body>
</html>