<!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>[181660] 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/181660">181660</a></dd>
<dt>Author</dt> <dd>bdakin@apple.com</dd>
<dt>Date</dt> <dd>2015-03-17 13:20:48 -0700 (Tue, 17 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>DOM mouse events have weird timing for force clickable elements in Safari 8.0.3 on 
10.10.2
https://bugs.webkit.org/show_bug.cgi?id=142700
-and corresponding-
rdar://problem/20165168

Reviewed by Tim Horton.

Source/WebCore:

This patch adds a new enum and member variable so that EventHandler can keep track 
of the current immediate action state.
* page/EventHandler.cpp:
(WebCore::EventHandler::EventHandler):

A new mouse press even is starting. We can re-set m_immediateActionStage to none 
unless a Hit Test has already been performed.
(WebCore::EventHandler::handleMousePressEvent):

If an immediate action was completed, then send mouse to the DOM and return early. 
This will prevent us from doing our own normal mouseup behaviors such as 
navigating to a link that was clicked — we only want to do that if the click was 
not used to perform an immediate action.
(WebCore::EventHandler::handleMouseReleaseEvent):
* page/EventHandler.h:
(WebCore::EventHandler::setImmediateActionStage):

Source/WebKit2:

No need to tell the WKImmediateActionController about mouse down any more since we 
are expecting it at the beginning of an immediate action interaction.
* UIProcess/API/mac/WKView.mm:
(-[WKView mouseDown:]):

Set the delaysPrimaryMouseButtonEvents to NO for the 
_immediateActionGestureRecognizer. This will cause AppKit to send up the mouse 
events at the expected time.
(-[WKView initWithFrame:processPool:configuration:webView:]):

WebCore::EventHandler now needs to know if an immediate action cancelled or 
completed. This plumbs that information down.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::immediateActionDidCancel):
(WebKit::WebPageProxy::immediateActionDidComplete):
* UIProcess/WebPageProxy.h:
* UIProcess/mac/WKImmediateActionController.h:
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController immediateActionRecognizerDidCancelAnimation:]):
(-[WKImmediateActionController immediateActionRecognizerDidCompleteAnimation:]):
(-[WKImmediateActionController wkView:willHandleMouseDown:]): Deleted.
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:

Call EventHandler::setImmediateActionStage() with the appropriate stage.
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::performActionMenuHitTestAtLocation):
(WebKit::WebPage::immediateActionDidCancel):
(WebKit::WebPage::immediateActionDidComplete):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepageEventHandlercpp">trunk/Source/WebCore/page/EventHandler.cpp</a></li>
<li><a href="#trunkSourceWebCorepageEventHandlerh">trunk/Source/WebCore/page/EventHandler.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPImacWKViewmm">trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWKImmediateActionControllerh">trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWKImmediateActionControllermm">trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagemessagesin">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacWebPageMacmm">trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (181659 => 181660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-17 20:11:53 UTC (rev 181659)
+++ trunk/Source/WebCore/ChangeLog        2015-03-17 20:20:48 UTC (rev 181660)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2015-03-17  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+        DOM mouse events have weird timing for force clickable elements in Safari 8.0.3 on 
+        10.10.2
+        https://bugs.webkit.org/show_bug.cgi?id=142700
+        -and corresponding-
+        rdar://problem/20165168
+
+        Reviewed by Tim Horton.
+
+        This patch adds a new enum and member variable so that EventHandler can keep track 
+        of the current immediate action state.
+        * page/EventHandler.cpp:
+        (WebCore::EventHandler::EventHandler):
+
+        A new mouse press even is starting. We can re-set m_immediateActionStage to none 
+        unless a Hit Test has already been performed.
+        (WebCore::EventHandler::handleMousePressEvent):
+
+        If an immediate action was completed, then send mouse to the DOM and return early. 
+        This will prevent us from doing our own normal mouseup behaviors such as 
+        navigating to a link that was clicked — we only want to do that if the click was 
+        not used to perform an immediate action.
+        (WebCore::EventHandler::handleMouseReleaseEvent):
+        * page/EventHandler.h:
+        (WebCore::EventHandler::setImmediateActionStage):
+
</ins><span class="cx"> 2015-03-17  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use a better parameter name for Document.getElementsByClassName
</span></span></pre></div>
<a id="trunkSourceWebCorepageEventHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EventHandler.cpp (181659 => 181660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EventHandler.cpp        2015-03-17 20:11:53 UTC (rev 181659)
+++ trunk/Source/WebCore/page/EventHandler.cpp        2015-03-17 20:20:48 UTC (rev 181660)
</span><span class="lines">@@ -423,6 +423,7 @@
</span><span class="cx"> #if ENABLE(CURSOR_VISIBILITY)
</span><span class="cx">     , m_autoHideCursorTimer(*this, &amp;EventHandler::autoHideCursorTimerFired)
</span><span class="cx"> #endif
</span><ins>+    , m_immediateActionStage(ImmediateActionStage::None)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -764,6 +765,9 @@
</span><span class="cx"> 
</span><span class="cx">     m_mouseDown = event.event();
</span><span class="cx"> 
</span><ins>+    if (m_immediateActionStage != ImmediateActionStage::PerformedHitTest)
+        m_immediateActionStage = ImmediateActionStage::None;
+
</ins><span class="cx">     if (event.isOverWidget() &amp;&amp; passWidgetMouseDownEventToWidget(event))
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="lines">@@ -2057,6 +2061,14 @@
</span><span class="cx">     if (m_frameSetBeingResized)
</span><span class="cx">         return !dispatchMouseEvent(eventNames().mouseupEvent, m_frameSetBeingResized.get(), true, m_clickCount, platformMouseEvent, false);
</span><span class="cx"> 
</span><ins>+    // If an immediate action was completed using this series of mouse events, then we should send mouseup to
+    // the DOM and return now so that we don't perform our own default behaviors.
+    if (m_immediateActionStage == ImmediateActionStage::ActionCompleted) {
+        m_immediateActionStage = ImmediateActionStage::None;
+        return !dispatchMouseEvent(eventNames().mouseupEvent, m_lastElementUnderMouse.get(), true, m_clickCount, platformMouseEvent, false);
+    }
+    m_immediateActionStage = ImmediateActionStage::None;
+
</ins><span class="cx">     if (m_lastScrollbarUnderMouse) {
</span><span class="cx">         invalidateClick();
</span><span class="cx">         m_lastScrollbarUnderMouse-&gt;mouseUp(platformMouseEvent);
</span></span></pre></div>
<a id="trunkSourceWebCorepageEventHandlerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/EventHandler.h (181659 => 181660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/EventHandler.h        2015-03-17 20:11:53 UTC (rev 181659)
+++ trunk/Source/WebCore/page/EventHandler.h        2015-03-17 20:20:48 UTC (rev 181660)
</span><span class="lines">@@ -117,6 +117,13 @@
</span><span class="cx"> enum AppendTrailingWhitespace { ShouldAppendTrailingWhitespace, DontAppendTrailingWhitespace };
</span><span class="cx"> enum CheckDragHysteresis { ShouldCheckDragHysteresis, DontCheckDragHysteresis };
</span><span class="cx"> 
</span><ins>+enum class ImmediateActionStage {
+    None,
+    PerformedHitTest,
+    ActionCancelled,
+    ActionCompleted
+};
+
</ins><span class="cx"> class EventHandler {
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(EventHandler);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="lines">@@ -305,6 +312,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool isHandlingWheelEvent() const { return m_isHandlingWheelEvent; }
</span><span class="cx"> 
</span><ins>+    WEBCORE_EXPORT void setImmediateActionStage(ImmediateActionStage stage) { m_immediateActionStage = stage; }
+
</ins><span class="cx"> private:
</span><span class="cx"> #if ENABLE(DRAG_SUPPORT)
</span><span class="cx">     static DragState&amp; dragState();
</span><span class="lines">@@ -564,6 +573,8 @@
</span><span class="cx"> #if ENABLE(CURSOR_VISIBILITY)
</span><span class="cx">     Timer m_autoHideCursorTimer;
</span><span class="cx"> #endif
</span><ins>+
+    ImmediateActionStage m_immediateActionStage;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (181659 => 181660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-03-17 20:11:53 UTC (rev 181659)
+++ trunk/Source/WebKit2/ChangeLog        2015-03-17 20:20:48 UTC (rev 181660)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2015-03-17  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+        DOM mouse events have weird timing for force clickable elements in Safari 8.0.3 on 
+        10.10.2
+        https://bugs.webkit.org/show_bug.cgi?id=142700
+        -and corresponding-
+        rdar://problem/20165168
+
+        Reviewed by Tim Horton.
+
+        No need to tell the WKImmediateActionController about mouse down any more since we 
+        are expecting it at the beginning of an immediate action interaction.
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView mouseDown:]):
+
+        Set the delaysPrimaryMouseButtonEvents to NO for the 
+        _immediateActionGestureRecognizer. This will cause AppKit to send up the mouse 
+        events at the expected time.
+        (-[WKView initWithFrame:processPool:configuration:webView:]):
+
+        WebCore::EventHandler now needs to know if an immediate action cancelled or 
+        completed. This plumbs that information down.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::immediateActionDidCancel):
+        (WebKit::WebPageProxy::immediateActionDidComplete):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/mac/WKImmediateActionController.h:
+        * UIProcess/mac/WKImmediateActionController.mm:
+        (-[WKImmediateActionController immediateActionRecognizerDidCancelAnimation:]):
+        (-[WKImmediateActionController immediateActionRecognizerDidCompleteAnimation:]):
+        (-[WKImmediateActionController wkView:willHandleMouseDown:]): Deleted.
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+
+        Call EventHandler::setImmediateActionStage() with the appropriate stage.
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::performActionMenuHitTestAtLocation):
+        (WebKit::WebPage::immediateActionDidCancel):
+        (WebKit::WebPage::immediateActionDidComplete):
+
</ins><span class="cx"> 2015-03-17  Timothy Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Reproducible null deref under ScriptedAnimationController::createDisplayRefreshMonitor
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (181659 => 181660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-03-17 20:11:53 UTC (rev 181659)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2015-03-17 20:20:48 UTC (rev 181660)
</span><span class="lines">@@ -1274,7 +1274,6 @@
</span><span class="cx">     [self _dismissContentRelativeChildWindows];
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
</span><span class="cx">     [_data-&gt;_actionMenuController wkView:self willHandleMouseDown:event];
</span><del>-    [_data-&gt;_immediateActionController wkView:self willHandleMouseDown:event];
</del><span class="cx"> #endif
</span><span class="cx">     [self mouseDownInternal:event];
</span><span class="cx"> }
</span><span class="lines">@@ -3666,6 +3665,7 @@
</span><span class="cx">         _data-&gt;_immediateActionGestureRecognizer = adoptNS([(NSImmediateActionGestureRecognizer *)[gestureClass alloc] initWithTarget:nil action:NULL]);
</span><span class="cx">         _data-&gt;_immediateActionController = adoptNS([[WKImmediateActionController alloc] initWithPage:*_data-&gt;_page view:self recognizer:_data-&gt;_immediateActionGestureRecognizer.get()]);
</span><span class="cx">         [_data-&gt;_immediateActionGestureRecognizer setDelegate:_data-&gt;_immediateActionController.get()];
</span><ins>+        [_data-&gt;_immediateActionGestureRecognizer setDelaysPrimaryMouseButtonEvents:NO];
</ins><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (181659 => 181660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-03-17 20:11:53 UTC (rev 181659)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-03-17 20:20:48 UTC (rev 181660)
</span><span class="lines">@@ -5565,6 +5565,16 @@
</span><span class="cx">     m_process-&gt;send(Messages::WebPage::FocusAndSelectLastActionMenuHitTestResult(), m_pageID);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPageProxy::immediateActionDidCancel()
+{
+    m_process-&gt;send(Messages::WebPage::ImmediateActionDidCancel(), m_pageID);
+}
+
+void WebPageProxy::immediateActionDidComplete()
+{
+    m_process-&gt;send(Messages::WebPage::ImmediateActionDidComplete(), m_pageID);
+}
+
</ins><span class="cx"> void WebPageProxy::didPerformActionMenuHitTest(const ActionMenuHitTestResult&amp; result, bool forImmediateAction, const UserData&amp; userData)
</span><span class="cx"> {
</span><span class="cx">     m_pageClient.didPerformActionMenuHitTest(result, forImmediateAction, m_process-&gt;transformHandlesToObjects(userData.object()).get());
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (181659 => 181660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2015-03-17 20:11:53 UTC (rev 181659)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2015-03-17 20:20:48 UTC (rev 181660)
</span><span class="lines">@@ -985,6 +985,9 @@
</span><span class="cx">     void selectLastActionMenuRange();
</span><span class="cx">     void focusAndSelectLastActionMenuHitTestResult();
</span><span class="cx"> 
</span><ins>+    void immediateActionDidCancel();
+    void immediateActionDidComplete();
+
</ins><span class="cx">     void installViewStateChangeCompletionHandler(void(^completionHandler)());
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWKImmediateActionControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.h (181659 => 181660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.h        2015-03-17 20:11:53 UTC (rev 181659)
+++ trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.h        2015-03-17 20:20:48 UTC (rev 181660)
</span><span class="lines">@@ -69,7 +69,6 @@
</span><span class="cx"> - (instancetype)initWithPage:(WebKit::WebPageProxy&amp;)page view:(WKView *)wkView recognizer:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer;
</span><span class="cx"> - (void)willDestroyView:(WKView *)view;
</span><span class="cx"> - (void)didPerformActionMenuHitTest:(const WebKit::ActionMenuHitTestResult&amp;)hitTestResult userData:(API::Object*)userData;
</span><del>-- (void)wkView:(WKView *)wkView willHandleMouseDown:(NSEvent *)event;
</del><span class="cx"> - (void)dismissContentRelativeChildWindows;
</span><span class="cx"> - (BOOL)hasActiveImmediateAction;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWKImmediateActionControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm (181659 => 181660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm        2015-03-17 20:11:53 UTC (rev 181659)
+++ trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm        2015-03-17 20:20:48 UTC (rev 181660)
</span><span class="lines">@@ -88,11 +88,6 @@
</span><span class="cx">     _hasActiveImmediateAction = NO;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)wkView:(WKView *)wkView willHandleMouseDown:(NSEvent *)event
-{
-    [self _clearImmediateActionState];
-}
-
</del><span class="cx"> - (void)_cancelImmediateAction
</span><span class="cx"> {
</span><span class="cx">     // Reset the recognizer by turning it off and on again.
</span><span class="lines">@@ -218,6 +213,8 @@
</span><span class="cx">     if (immediateActionRecognizer != _immediateActionRecognizer)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    _page-&gt;immediateActionDidCancel();
+
</ins><span class="cx">     [_wkView _cancelImmediateActionAnimation];
</span><span class="cx"> 
</span><span class="cx">     _page-&gt;setTextIndicatorAnimationProgress(0);
</span><span class="lines">@@ -230,6 +227,8 @@
</span><span class="cx">     if (immediateActionRecognizer != _immediateActionRecognizer)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    _page-&gt;immediateActionDidComplete();
+
</ins><span class="cx">     [_wkView _completeImmediateActionAnimation];
</span><span class="cx"> 
</span><span class="cx">     _page-&gt;setTextIndicatorAnimationProgress(1);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (181659 => 181660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2015-03-17 20:11:53 UTC (rev 181659)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2015-03-17 20:20:48 UTC (rev 181660)
</span><span class="lines">@@ -1084,6 +1084,8 @@
</span><span class="cx">     PassRefPtr&lt;WebCore::Range&gt; lookupTextAtLocation(WebCore::FloatPoint, NSDictionary **options);
</span><span class="cx">     void selectLastActionMenuRange();
</span><span class="cx">     void focusAndSelectLastActionMenuHitTestResult();
</span><ins>+    void immediateActionDidCancel();
+    void immediateActionDidComplete();
</ins><span class="cx">     void setFont(const String&amp; fontFamily, double fontSize, uint64_t fontTraits);
</span><span class="cx"> 
</span><span class="cx">     void dataDetectorsDidPresentUI(WebCore::PageOverlay::PageOverlayID);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (181659 => 181660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2015-03-17 20:11:53 UTC (rev 181659)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2015-03-17 20:20:48 UTC (rev 181660)
</span><span class="lines">@@ -405,6 +405,8 @@
</span><span class="cx">     PerformActionMenuHitTestAtLocation(WebCore::FloatPoint location, bool forImmediateAction)
</span><span class="cx">     SelectLastActionMenuRange()
</span><span class="cx">     FocusAndSelectLastActionMenuHitTestResult()
</span><ins>+    ImmediateActionDidCancel()
+    ImmediateActionDidComplete()
</ins><span class="cx">     DataDetectorsDidPresentUI(WebCore::PageOverlay::PageOverlayID pageOverlay)
</span><span class="cx">     DataDetectorsDidChangeUI(WebCore::PageOverlay::PageOverlayID pageOverlay)
</span><span class="cx">     DataDetectorsDidHideUI(WebCore::PageOverlay::PageOverlayID pageOverlay)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacWebPageMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (181659 => 181660)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2015-03-17 20:11:53 UTC (rev 181659)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2015-03-17 20:20:48 UTC (rev 181660)
</span><span class="lines">@@ -1024,6 +1024,9 @@
</span><span class="cx">     IntPoint locationInContentCoordinates = mainFrame.view()-&gt;rootViewToContents(roundedIntPoint(locationInViewCooordinates));
</span><span class="cx">     HitTestResult hitTestResult = mainFrame.eventHandler().hitTestResultAtPoint(locationInContentCoordinates);
</span><span class="cx"> 
</span><ins>+    if (forImmediateAction)
+        mainFrame.eventHandler().setImmediateActionStage(ImmediateActionStage::PerformedHitTest);
+
</ins><span class="cx">     ActionMenuHitTestResult actionMenuResult;
</span><span class="cx">     actionMenuResult.hitTestLocationInViewCooordinates = locationInViewCooordinates;
</span><span class="cx">     actionMenuResult.hitTestResult = WebHitTestResult::Data(hitTestResult);
</span><span class="lines">@@ -1145,6 +1148,16 @@
</span><span class="cx">     frame-&gt;selection().setSelection(position);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPage::immediateActionDidCancel()
+{
+    m_page-&gt;mainFrame().eventHandler().setImmediateActionStage(ImmediateActionStage::ActionCancelled);
+}
+
+void WebPage::immediateActionDidComplete()
+{
+    m_page-&gt;mainFrame().eventHandler().setImmediateActionStage(ImmediateActionStage::ActionCompleted);
+}
+
</ins><span class="cx"> void WebPage::dataDetectorsDidPresentUI(PageOverlay::PageOverlayID overlayID)
</span><span class="cx"> {
</span><span class="cx">     MainFrame&amp; mainFrame = corePage()-&gt;mainFrame();
</span></span></pre>
</div>
</div>

</body>
</html>