<!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>[177427] 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/177427">177427</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2014-12-16 19:02:41 -0800 (Tue, 16 Dec 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Implement and adopt two new TextIndicator presentation animations
https://bugs.webkit.org/show_bug.cgi?id=139715
&lt;rdar://problem/19237945&gt;

Reviewed by Anders Carlsson.

* WebCore.exp.in:
Adjust one symbol and export another.

* page/TextIndicator.cpp:
(WebCore::TextIndicator::createWithSelectionInFrame):
Take a blue-highlight snapshot if we're doing a crossfade without a bounce.

* page/TextIndicator.h:
(WebCore::TextIndicator::presentationTransition):
Add FadeIn and Crossfade transition types.

* page/mac/TextIndicatorWindow.h:
* page/mac/TextIndicatorWindow.mm:
(-[WebTextIndicatorView initWithFrame:textIndicator:margin:]):
(createBounceAnimation):
(createContentCrossfadeAnimation):
(createShadowFadeAnimation):
(createFadeInAnimation):
(-[WebTextIndicatorView _textIndicatorWantsBounce]):
(-[WebTextIndicatorView _textIndicatorWantsContentCrossfade]):
(-[WebTextIndicatorView _textIndicatorWantsFadeIn]):
Factor out the animation construction.

(-[WebTextIndicatorView _animationDuration]):
Factor out the duration computation.

(-[WebTextIndicatorView present]):
(-[WebTextIndicatorView setAnimationProgress:]):
Implement FadeIn and Crossfade transitions.
They can be driven externally and then continue from where they
left off when the progress reaches 100%.
FadeIn changes the opacity of the whole bubble, Crossfade
crossfades the content (from blue to yellow).

(WebCore::TextIndicatorWindow::TextIndicatorWindow):
(WebCore::TextIndicatorWindow::~TextIndicatorWindow):
Don't immediately destroy the window if it is crossfades or fades in.
Fade it out, instead.

(WebCore::TextIndicatorWindow::setAnimationProgress):
Drive the paused animation manually. If progress hits 100%,
start running it automatically from where it last left off.

(WebCore::TextIndicatorWindow::setTextIndicator):
(WebCore::TextIndicatorWindow::startFadeOut):
(-[WebTextIndicatorView presentWithCompletionHandler:]): Deleted.
(WebCore::TextIndicatorWindow::startFadeOutTimerFired): Deleted.
Remove the completion block from -present.

* platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h:
Add some SPI.

* WebView/WebActionMenuController.mm:
(-[WebActionMenuController _showTextIndicator]):
* WebView/WebHTMLView.mm:
(-[WebHTMLView quickLookWithEvent:]):
Remove the completionHandler from text indicator presentation.

* WebView/WebImmediateActionController.mm:
(-[WebImmediateActionController immediateActionRecognizerWillPrepare:]):
(-[WebImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
(-[WebImmediateActionController immediateActionRecognizerDidCancelAnimation:]):
(-[WebImmediateActionController immediateActionRecognizerDidCompleteAnimation:]):
(-[WebImmediateActionController _menuItemForDataDetectedText]):
(-[WebImmediateActionController _animationControllerForText]):
(-[WebImmediateActionController _showTextIndicator]):
Forward immediate action gesture recognizer animation progress
to TextIndicator. Force us to keep the selection when immediate
action popovers steal first responder status from the WebView.
If the Lookup range is equal to the selection range, use a Crossfade
animation; otherwise, use a FadeIn animation.

* WebView/WebView.mm:
(-[WebView _setMaintainsInactiveSelection:]):
(-[WebView maintainsInactiveSelection]):
(-[WebView _animationControllerForDictionaryLookupPopupInfo:]):
(-[WebView _setTextIndicator:fadeOut:]):
(-[WebView _clearTextIndicator]):
(-[WebView _setTextIndicatorAnimationProgress:]):
(-[WebView _showDictionaryLookupPopup:]):
(-[WebView _dictionaryLookupPopoverWillClose:]):
(-[WebView _setTextIndicator:fadeOut:animationCompletionHandler:]):
Remove the completionHandler from text indicator presentation.
Add a _setMaintainsInactiveSelection, which allows WebKit internals
to change the return value of -maintainsInactiveSelection, allowing
us to keep the selection alive when the WebView loses first responder status.

* WebView/WebViewData.h:
* WebView/WebViewInternal.h:

* UIProcess/API/mac/WKView.mm:
(-[WKView _setTextIndicator:fadeOut:]):
(-[WKView _setTextIndicatorAnimationProgress:]):
(-[WKView _setTextIndicator:fadeOut:animationCompletionHandler:]): Deleted.
* UIProcess/API/mac/WKViewInternal.h:
* UIProcess/PageClient.h:
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):
(WebKit::WebPageProxy::setTextIndicatorAnimationProgress):
(WebKit::WebPageProxy::performActionMenuHitTestAtLocation):
* UIProcess/WebPageProxy.h:
* UIProcess/mac/PageClientImpl.h:
* UIProcess/mac/PageClientImpl.mm:
(WebKit::PageClientImpl::setTextIndicatorAnimationProgress):
(WebKit::PageClientImpl::didPerformDictionaryLookup):
Remove the completion handler block argument from TextIndicator
installation.
Plumb animation progress through PageClient to TextIndicatorWindow.

* UIProcess/mac/WKActionMenuController.mm:
(-[WKActionMenuController prepareForMenu:withEvent:]):
(-[WKActionMenuController _defaultMenuItemsForDataDetectedText]):
* UIProcess/mac/WKImmediateActionController.mm:
(-[WKImmediateActionController _clearImmediateActionState]):
(-[WKImmediateActionController immediateActionRecognizerWillPrepare:]):
(-[WKImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
(-[WKImmediateActionController immediateActionRecognizerDidCancelAnimation:]):
(-[WKImmediateActionController immediateActionRecognizerDidCompleteAnimation:]):
(-[WKImmediateActionController _menuItemForDataDetectedText]):
(-[WKImmediateActionController _animationControllerForText]):
Forward immediate action gesture recognizer animation progress
to TextIndicator. Force us to keep the selection when immediate
action popovers steal first responder status from the WebView.

* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::textIndicatorTransitionForActionMenu):
(WebKit::WebPage::performActionMenuHitTestAtLocation):
Factor out the presentation animation decision code.
For immediate actions, of the Lookup range is equal to the
selection range, use a Crossfade animation; otherwise, use a FadeIn
animation.
Push whether the actionMenuHitTest is for an immediate action
or a menu to the Web process, to make the presentation animation
decision code live entirely in the Web process.
Avoid extracting encoded image data if we know we're doing
an immediate action and will never need it.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCoreexpin">trunk/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#trunkSourceWebCorepageTextIndicatorcpp">trunk/Source/WebCore/page/TextIndicator.cpp</a></li>
<li><a href="#trunkSourceWebCorepageTextIndicatorh">trunk/Source/WebCore/page/TextIndicator.h</a></li>
<li><a href="#trunkSourceWebCorepagemacTextIndicatorWindowh">trunk/Source/WebCore/page/mac/TextIndicatorWindow.h</a></li>
<li><a href="#trunkSourceWebCorepagemacTextIndicatorWindowmm">trunk/Source/WebCore/page/mac/TextIndicatorWindow.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformspimacNSImmediateActionGestureRecognizerSPIh">trunk/Source/WebCore/platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebActionMenuControllermm">trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebHTMLViewmm">trunk/Source/WebKit/mac/WebView/WebHTMLView.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebImmediateActionControllermm">trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewDatah">trunk/Source/WebKit/mac/WebView/WebViewData.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewInternalh">trunk/Source/WebKit/mac/WebView/WebViewInternal.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="#trunkSourceWebKit2UIProcessAPImacWKViewInternalh">trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPageClienth">trunk/Source/WebKit2/UIProcess/PageClient.h</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="#trunkSourceWebKit2UIProcessmacPageClientImplh">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacPageClientImplmm">trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWKActionMenuControllermm">trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm</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 (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebCore/ChangeLog        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -1,3 +1,63 @@
</span><ins>+2014-12-16  Timothy Horton  &lt;timothy_horton@apple.com&gt;
+
+        Implement and adopt two new TextIndicator presentation animations
+        https://bugs.webkit.org/show_bug.cgi?id=139715
+        &lt;rdar://problem/19237945&gt;
+
+        Reviewed by Anders Carlsson.
+
+        * WebCore.exp.in:
+        Adjust one symbol and export another.
+
+        * page/TextIndicator.cpp:
+        (WebCore::TextIndicator::createWithSelectionInFrame):
+        Take a blue-highlight snapshot if we're doing a crossfade without a bounce.
+
+        * page/TextIndicator.h:
+        (WebCore::TextIndicator::presentationTransition):
+        Add FadeIn and Crossfade transition types.
+
+        * page/mac/TextIndicatorWindow.h:
+        * page/mac/TextIndicatorWindow.mm:
+        (-[WebTextIndicatorView initWithFrame:textIndicator:margin:]):
+        (createBounceAnimation):
+        (createContentCrossfadeAnimation):
+        (createShadowFadeAnimation):
+        (createFadeInAnimation):
+        (-[WebTextIndicatorView _textIndicatorWantsBounce]):
+        (-[WebTextIndicatorView _textIndicatorWantsContentCrossfade]):
+        (-[WebTextIndicatorView _textIndicatorWantsFadeIn]):
+        Factor out the animation construction.
+
+        (-[WebTextIndicatorView _animationDuration]):
+        Factor out the duration computation.
+
+        (-[WebTextIndicatorView present]):
+        (-[WebTextIndicatorView setAnimationProgress:]):
+        Implement FadeIn and Crossfade transitions.
+        They can be driven externally and then continue from where they
+        left off when the progress reaches 100%.
+        FadeIn changes the opacity of the whole bubble, Crossfade
+        crossfades the content (from blue to yellow).
+
+        (WebCore::TextIndicatorWindow::TextIndicatorWindow):
+        (WebCore::TextIndicatorWindow::~TextIndicatorWindow):
+        Don't immediately destroy the window if it is crossfades or fades in.
+        Fade it out, instead.
+
+        (WebCore::TextIndicatorWindow::setAnimationProgress):
+        Drive the paused animation manually. If progress hits 100%,
+        start running it automatically from where it last left off.
+
+        (WebCore::TextIndicatorWindow::setTextIndicator):
+        (WebCore::TextIndicatorWindow::startFadeOut):
+        (-[WebTextIndicatorView presentWithCompletionHandler:]): Deleted.
+        (WebCore::TextIndicatorWindow::startFadeOutTimerFired): Deleted.
+        Remove the completion block from -present.
+
+        * platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h:
+        Add some SPI.
+
</ins><span class="cx"> 2014-12-16  Gyuyoung Kim  &lt;gyuyoung.kim@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Move WebCore/platform/image-decoders to std::unique_ptr&lt;&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.exp.in (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.exp.in        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebCore/WebCore.exp.in        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -1823,6 +1823,7 @@
</span><span class="cx"> __ZNK7WebCore16HTMLInputElement6isTextEv
</span><span class="cx"> __ZNK7WebCore16IconDatabaseBase12databasePathEv
</span><span class="cx"> __ZNK7WebCore16ResourceResponse13nsURLResponseEv
</span><ins>+__ZNK7WebCore16VisibleSelection10firstRangeEv
</ins><span class="cx"> __ZNK7WebCore16VisibleSelection17isContentEditableEv
</span><span class="cx"> __ZNK7WebCore16VisibleSelection17isInPasswordFieldEv
</span><span class="cx"> __ZNK7WebCore16VisibleSelection17toNormalizedRangeEv
</span><span class="lines">@@ -2312,7 +2313,8 @@
</span><span class="cx"> __ZN7WebCore17ScrollbarThemeMac24removeOverhangAreaShadowEP7CALayer
</span><span class="cx"> __ZN7WebCore17ScrollbarThemeMac27setUpOverhangAreaBackgroundEP7CALayerRKNS_5ColorE
</span><span class="cx"> __ZN7WebCore17ScrollbarThemeMac28removeOverhangAreaBackgroundEP7CALayer
</span><del>-__ZN7WebCore19TextIndicatorWindow16setTextIndicatorEN3WTF10PassRefPtrINS_13TextIndicatorEEE6CGRectbNSt3__18functionIFvvEEE
</del><ins>+__ZN7WebCore19TextIndicatorWindow16setTextIndicatorEN3WTF10PassRefPtrINS_13TextIndicatorEEE6CGRectb
+__ZN7WebCore19TextIndicatorWindow20setAnimationProgressEf
</ins><span class="cx"> __ZN7WebCore19TextIndicatorWindowC1EP6NSView
</span><span class="cx"> __ZN7WebCore19TextIndicatorWindowD1Ev
</span><span class="cx"> __ZN7WebCore19applicationIsSafariEv
</span><span class="lines">@@ -3412,7 +3414,6 @@
</span><span class="cx"> __ZN7WebCore8PositionC1EN3WTF10PassRefPtrINS_4NodeEEENS0_10AnchorTypeE
</span><span class="cx"> __ZNK7WebCore11ImageBuffer7contextEv
</span><span class="cx"> __ZNK7WebCore11ImageBuffer9copyImageENS_16BackingStoreCopyENS_13ScaleBehaviorE
</span><del>-__ZNK7WebCore16VisibleSelection10firstRangeEv
</del><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SPEECH_SYNTHESIS)
</span></span></pre></div>
<a id="trunkSourceWebCorepageTextIndicatorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/TextIndicator.cpp (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/TextIndicator.cpp        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebCore/page/TextIndicator.cpp        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -141,7 +141,7 @@
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;Image&gt; indicatorBitmapWithHighlight;
</span><del>-    if (presentationTransition == TextIndicatorPresentationTransition::BounceAndCrossfade)
</del><ins>+    if (presentationTransition == TextIndicatorPresentationTransition::BounceAndCrossfade || presentationTransition == TextIndicatorPresentationTransition::Crossfade)
</ins><span class="cx">         indicatorBitmapWithHighlight = snapshotSelectionWithHighlight(frame);
</span><span class="cx"> 
</span><span class="cx">     // Store the selection rect in window coordinates, to be used subsequently
</span></span></pre></div>
<a id="trunkSourceWebCorepageTextIndicatorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/TextIndicator.h (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/TextIndicator.h        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebCore/page/TextIndicator.h        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -47,7 +47,9 @@
</span><span class="cx"> enum class TextIndicatorPresentationTransition {
</span><span class="cx">     None,
</span><span class="cx">     Bounce,
</span><del>-    BounceAndCrossfade
</del><ins>+    BounceAndCrossfade,
+    FadeIn,
+    Crossfade
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct TextIndicatorData {
</span><span class="lines">@@ -74,8 +76,8 @@
</span><span class="cx">     float contentImageScaleFactor() const { return m_data.contentImageScaleFactor; }
</span><span class="cx">     Image *contentImageWithHighlight() const { return m_data.contentImageWithHighlight.get(); }
</span><span class="cx">     Image *contentImage() const { return m_data.contentImage.get(); }
</span><ins>+
</ins><span class="cx">     TextIndicatorPresentationTransition presentationTransition() const { return m_data.presentationTransition; }
</span><del>-
</del><span class="cx">     void setPresentationTransition(TextIndicatorPresentationTransition transition) { m_data.presentationTransition = transition; }
</span><span class="cx"> 
</span><span class="cx">     TextIndicatorData data() const { return m_data; }
</span></span></pre></div>
<a id="trunkSourceWebCorepagemacTextIndicatorWindowh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/mac/TextIndicatorWindow.h (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/mac/TextIndicatorWindow.h        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebCore/page/mac/TextIndicatorWindow.h        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -28,7 +28,6 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> 
</span><del>-#import &lt;functional&gt;
</del><span class="cx"> #import &lt;wtf/Noncopyable.h&gt;
</span><span class="cx"> #import &lt;wtf/RefPtr.h&gt;
</span><span class="cx"> #import &lt;wtf/RetainPtr.h&gt;
</span><span class="lines">@@ -48,12 +47,14 @@
</span><span class="cx">     explicit TextIndicatorWindow(NSView *);
</span><span class="cx">     ~TextIndicatorWindow();
</span><span class="cx"> 
</span><del>-    void setTextIndicator(PassRefPtr&lt;TextIndicator&gt;, CGRect contentRect, bool fadeOut, std::function&lt;void ()&gt; animationCompletionHandler);
</del><ins>+    void setTextIndicator(PassRefPtr&lt;TextIndicator&gt;, CGRect contentRect, bool fadeOut);
</ins><span class="cx"> 
</span><ins>+    void setAnimationProgress(float);
+
</ins><span class="cx"> private:
</span><span class="cx">     void closeWindow();
</span><span class="cx"> 
</span><del>-    void startFadeOutTimerFired();
</del><ins>+    void startFadeOut();
</ins><span class="cx"> 
</span><span class="cx">     NSView *m_targetView;
</span><span class="cx">     RefPtr&lt;TextIndicator&gt; m_textIndicator;
</span><span class="lines">@@ -61,8 +62,6 @@
</span><span class="cx">     RetainPtr&lt;WebTextIndicatorView&gt; m_textIndicatorView;
</span><span class="cx"> 
</span><span class="cx">     RunLoop::Timer&lt;TextIndicatorWindow&gt; m_startFadeOutTimer;
</span><del>-
-    std::function&lt;void ()&gt; m_bounceAnimationCompletionHandler;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebCorepagemacTextIndicatorWindowmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/mac/TextIndicatorWindow.mm (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/mac/TextIndicatorWindow.mm        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebCore/page/mac/TextIndicatorWindow.mm        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> 
</span><span class="cx"> const CFTimeInterval bounceAnimationDuration = 0.12;
</span><span class="cx"> const CFTimeInterval bounceWithCrossfadeAnimationDuration = 0.3;
</span><ins>+const CFTimeInterval fadeInAnimationDuration = 0.15;
</ins><span class="cx"> const CFTimeInterval timeBeforeFadeStarts = bounceAnimationDuration + 0.2;
</span><span class="cx"> const CFTimeInterval fadeOutAnimationDuration = 0.3;
</span><span class="cx"> 
</span><span class="lines">@@ -69,13 +70,16 @@
</span><span class="cx">     RefPtr&lt;TextIndicator&gt; _textIndicator;
</span><span class="cx">     RetainPtr&lt;NSArray&gt; _bounceLayers;
</span><span class="cx">     NSSize _margin;
</span><ins>+    bool _hasCompletedAnimation;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (instancetype)initWithFrame:(NSRect)frame textIndicator:(PassRefPtr&lt;TextIndicator&gt;)textIndicator margin:(NSSize)margin;
</span><span class="cx"> 
</span><del>-- (void)presentWithCompletionHandler:(void(^)(void))completionHandler;
</del><ins>+- (void)present;
</ins><span class="cx"> - (void)hideWithCompletionHandler:(void(^)(void))completionHandler;
</span><span class="cx"> 
</span><ins>+- (void)setAnimationProgress:(float)progress;
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> @implementation WebTextIndicatorView
</span><span class="lines">@@ -91,7 +95,7 @@
</span><span class="cx">     self.wantsLayer = YES;
</span><span class="cx">     self.layer.anchorPoint = CGPointZero;
</span><span class="cx"> 
</span><del>-    bool wantsCrossfade = _textIndicator-&gt;presentationTransition() == TextIndicatorPresentationTransition::BounceAndCrossfade;
</del><ins>+    bool wantsCrossfade = [self _textIndicatorWantsContentCrossfade];
</ins><span class="cx"> 
</span><span class="cx">     FloatSize contentsImageLogicalSize = _textIndicator-&gt;contentImage()-&gt;size();
</span><span class="cx">     contentsImageLogicalSize.scale(1 / _textIndicator-&gt;contentImageScaleFactor());
</span><span class="lines">@@ -187,41 +191,153 @@
</span><span class="cx">     return self;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)presentWithCompletionHandler:(void(^)(void))completionHandler
</del><ins>+static RetainPtr&lt;CAKeyframeAnimation&gt; createBounceAnimation(CFTimeInterval duration)
</ins><span class="cx"> {
</span><del>-    bool wantsCrossfade = _textIndicator-&gt;presentationTransition() == TextIndicatorPresentationTransition::BounceAndCrossfade;
-    double animationDuration = wantsCrossfade ? bounceWithCrossfadeAnimationDuration : bounceAnimationDuration;
</del><span class="cx">     RetainPtr&lt;CAKeyframeAnimation&gt; bounceAnimation = [CAKeyframeAnimation animationWithKeyPath:@&quot;transform&quot;];
</span><span class="cx">     [bounceAnimation setValues:@[
</span><span class="cx">         [NSValue valueWithCATransform3D:CATransform3DIdentity],
</span><span class="cx">         [NSValue valueWithCATransform3D:CATransform3DMakeScale(midBounceScale, midBounceScale, 1)],
</span><span class="cx">         [NSValue valueWithCATransform3D:CATransform3DIdentity]
</span><span class="cx">         ]];
</span><del>-    [bounceAnimation setDuration:animationDuration];
</del><ins>+    [bounceAnimation setDuration:duration];
</ins><span class="cx"> 
</span><ins>+    return bounceAnimation;
+}
+
+static RetainPtr&lt;CABasicAnimation&gt; createContentCrossfadeAnimation(CFTimeInterval duration, TextIndicator&amp; textIndicator)
+{
+    RetainPtr&lt;CABasicAnimation&gt; crossfadeAnimation = [CABasicAnimation animationWithKeyPath:@&quot;contents&quot;];
+    RetainPtr&lt;CGImageRef&gt; contentsImage = textIndicator.contentImage()-&gt;getCGImageRef();
+    [crossfadeAnimation setToValue:(id)contentsImage.get()];
+    [crossfadeAnimation setFillMode:kCAFillModeForwards];
+    [crossfadeAnimation setRemovedOnCompletion:NO];
+    [crossfadeAnimation setDuration:duration];
+
+    return crossfadeAnimation;
+}
+
+static RetainPtr&lt;CABasicAnimation&gt; createShadowFadeAnimation(CFTimeInterval duration)
+{
+    RetainPtr&lt;CABasicAnimation&gt; fadeShadowInAnimation = [CABasicAnimation animationWithKeyPath:@&quot;shadowOpacity&quot;];
+    [fadeShadowInAnimation setFromValue:@0];
+    [fadeShadowInAnimation setToValue:@1];
+    [fadeShadowInAnimation setFillMode:kCAFillModeForwards];
+    [fadeShadowInAnimation setRemovedOnCompletion:NO];
+    [fadeShadowInAnimation setDuration:duration];
+
+    return fadeShadowInAnimation;
+}
+
+static RetainPtr&lt;CABasicAnimation&gt; createFadeInAnimation(CFTimeInterval duration)
+{
+    RetainPtr&lt;CABasicAnimation&gt; fadeInAnimation = [CABasicAnimation animationWithKeyPath:@&quot;opacity&quot;];
+    [fadeInAnimation setFromValue:@0];
+    [fadeInAnimation setToValue:@1];
+    [fadeInAnimation setFillMode:kCAFillModeForwards];
+    [fadeInAnimation setRemovedOnCompletion:NO];
+    [fadeInAnimation setDuration:duration];
+
+    return fadeInAnimation;
+}
+
+- (bool)_textIndicatorWantsBounce
+{
+    switch (_textIndicator-&gt;presentationTransition()) {
+    case TextIndicatorPresentationTransition::BounceAndCrossfade:
+    case TextIndicatorPresentationTransition::Bounce:
+        return true;
+
+    case TextIndicatorPresentationTransition::FadeIn:
+    case TextIndicatorPresentationTransition::Crossfade:
+    case TextIndicatorPresentationTransition::None:
+        return false;
+    }
+
+    return false;
+}
+
+- (bool)_textIndicatorWantsContentCrossfade
+{
+    if (!_textIndicator-&gt;contentImageWithHighlight())
+        return false;
+
+    switch (_textIndicator-&gt;presentationTransition()) {
+    case TextIndicatorPresentationTransition::BounceAndCrossfade:
+    case TextIndicatorPresentationTransition::Crossfade:
+        return true;
+
+    case TextIndicatorPresentationTransition::Bounce:
+    case TextIndicatorPresentationTransition::FadeIn:
+    case TextIndicatorPresentationTransition::None:
+        return false;
+    }
+
+    return false;
+}
+
+- (bool)_textIndicatorWantsFadeIn
+{
+    switch (_textIndicator-&gt;presentationTransition()) {
+    case TextIndicatorPresentationTransition::FadeIn:
+        return true;
+
+    case TextIndicatorPresentationTransition::Bounce:
+    case TextIndicatorPresentationTransition::BounceAndCrossfade:
+    case TextIndicatorPresentationTransition::Crossfade:
+    case TextIndicatorPresentationTransition::None:
+        return false;
+    }
+
+    return false;
+}
+
+- (CFTimeInterval)_animationDuration
+{
+    bool wantsBounce = [self _textIndicatorWantsBounce];
+    bool wantsCrossfade = [self _textIndicatorWantsContentCrossfade];
+
+    if (wantsBounce) {
+        if (wantsCrossfade)
+            return bounceWithCrossfadeAnimationDuration;
+        return bounceAnimationDuration;
+    }
+
+    return fadeInAnimationDuration;
+}
+
+- (void)present
+{
+    bool wantsBounce = [self _textIndicatorWantsBounce];
+    bool wantsCrossfade = [self _textIndicatorWantsContentCrossfade];
+    bool wantsFadeIn = [self _textIndicatorWantsFadeIn];
+    CFTimeInterval animationDuration = [self _animationDuration];
+
+    _hasCompletedAnimation = false;
+
+    RetainPtr&lt;CAAnimation&gt; presentationAnimation;
+    if (wantsBounce)
+        presentationAnimation = createBounceAnimation(animationDuration);
+    else if (wantsFadeIn)
+        presentationAnimation = createFadeInAnimation(animationDuration);
+
</ins><span class="cx">     RetainPtr&lt;CABasicAnimation&gt; crossfadeAnimation;
</span><span class="cx">     RetainPtr&lt;CABasicAnimation&gt; fadeShadowInAnimation;
</span><span class="cx">     if (wantsCrossfade) {
</span><del>-        crossfadeAnimation = [CABasicAnimation animationWithKeyPath:@&quot;contents&quot;];
-        RetainPtr&lt;CGImageRef&gt; contentsImage = _textIndicator-&gt;contentImage()-&gt;getCGImageRef();
-        [crossfadeAnimation setToValue:(id)contentsImage.get()];
-        [crossfadeAnimation setFillMode:kCAFillModeForwards];
-        [crossfadeAnimation setRemovedOnCompletion:NO];
-        [crossfadeAnimation setDuration:animationDuration];
-
-        fadeShadowInAnimation = [CABasicAnimation animationWithKeyPath:@&quot;shadowOpacity&quot;];
-        [fadeShadowInAnimation setFromValue:@0];
-        [fadeShadowInAnimation setToValue:@1];
-        [fadeShadowInAnimation setFillMode:kCAFillModeForwards];
-        [fadeShadowInAnimation setRemovedOnCompletion:NO];
-        [fadeShadowInAnimation setDuration:animationDuration];
</del><ins>+        crossfadeAnimation = createContentCrossfadeAnimation(animationDuration, *_textIndicator);
+        fadeShadowInAnimation = createShadowFadeAnimation(animationDuration);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     [CATransaction begin];
</span><del>-    [CATransaction setCompletionBlock:completionHandler];
-    for (CALayer* bounceLayer in _bounceLayers.get()) {
-        [bounceLayer setOpacity:1];
-        [bounceLayer addAnimation:bounceAnimation.get() forKey:@&quot;bounce&quot;];
</del><ins>+    for (CALayer *bounceLayer in _bounceLayers.get()) {
+        if (wantsFadeIn || wantsCrossfade)
+            bounceLayer.speed = 0;
+
+        if (!wantsFadeIn)
+            bounceLayer.opacity = 1;
+
+        if (presentationAnimation)
+            [bounceLayer addAnimation:presentationAnimation.get() forKey:@&quot;presentation&quot;];
+
</ins><span class="cx">         if (wantsCrossfade) {
</span><span class="cx">             [[bounceLayer valueForKey:textLayerKey] addAnimation:crossfadeAnimation.get() forKey:@&quot;contentTransition&quot;];
</span><span class="cx">             [[bounceLayer valueForKey:dropShadowLayerKey] addAnimation:fadeShadowInAnimation.get() forKey:@&quot;fadeShadowIn&quot;];
</span><span class="lines">@@ -246,6 +362,28 @@
</span><span class="cx">     [CATransaction commit];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)setAnimationProgress:(float)progress
+{
+    if (_hasCompletedAnimation)
+        return;
+
+    if (progress == 1) {
+        _hasCompletedAnimation = true;
+
+        for (CALayer *bounceLayer in _bounceLayers.get()) {
+            // Continue the animation from wherever it had manually progressed to.
+            CFTimeInterval beginTime = bounceLayer.timeOffset;
+            bounceLayer.speed = 1;
+            beginTime = [bounceLayer convertTime:CACurrentMediaTime() fromLayer:nil] - beginTime;
+            bounceLayer.beginTime = beginTime;
+        }
+    } else {
+        CFTimeInterval animationDuration = [self _animationDuration];
+        for (CALayer *bounceLayer in _bounceLayers.get())
+            bounceLayer.timeOffset = progress * animationDuration;
+    }
+}
+
</ins><span class="cx"> - (BOOL)isFlipped
</span><span class="cx"> {
</span><span class="cx">     return YES;
</span><span class="lines">@@ -257,17 +395,37 @@
</span><span class="cx"> 
</span><span class="cx"> TextIndicatorWindow::TextIndicatorWindow(NSView *targetView)
</span><span class="cx">     : m_targetView(targetView)
</span><del>-    , m_startFadeOutTimer(RunLoop::main(), this, &amp;TextIndicatorWindow::startFadeOutTimerFired)
</del><ins>+    , m_startFadeOutTimer(RunLoop::main(), this, &amp;TextIndicatorWindow::startFadeOut)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> TextIndicatorWindow::~TextIndicatorWindow()
</span><span class="cx"> {
</span><ins>+    switch (m_textIndicator-&gt;presentationTransition()) {
+    case TextIndicatorPresentationTransition::Crossfade:
+    case TextIndicatorPresentationTransition::FadeIn:
+        startFadeOut();
+        return;
+
+    case TextIndicatorPresentationTransition::Bounce:
+    case TextIndicatorPresentationTransition::BounceAndCrossfade:
+    case TextIndicatorPresentationTransition::None:
+        break;
+    }
+
</ins><span class="cx">     closeWindow();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextIndicatorWindow::setTextIndicator(PassRefPtr&lt;TextIndicator&gt; textIndicator, CGRect contentRect, bool fadeOut, std::function&lt;void ()&gt; animationCompletionHandler)
</del><ins>+void TextIndicatorWindow::setAnimationProgress(float progress)
</ins><span class="cx"> {
</span><ins>+    if (!m_textIndicator)
+        return;
+
+    [m_textIndicatorView setAnimationProgress:progress];
+}
+
+void TextIndicatorWindow::setTextIndicator(PassRefPtr&lt;TextIndicator&gt; textIndicator, CGRect contentRect, bool fadeOut)
+{
</ins><span class="cx">     if (m_textIndicator == textIndicator)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -296,11 +454,8 @@
</span><span class="cx">     [[m_targetView window] addChildWindow:m_textIndicatorWindow.get() ordered:NSWindowAbove];
</span><span class="cx">     [m_textIndicatorWindow setReleasedWhenClosed:NO];
</span><span class="cx"> 
</span><del>-    if (m_textIndicator-&gt;presentationTransition() != TextIndicatorPresentationTransition::None) {
-        [m_textIndicatorView presentWithCompletionHandler:[animationCompletionHandler] {
-            animationCompletionHandler();
-        }];
-    }
</del><ins>+    if (m_textIndicator-&gt;presentationTransition() != TextIndicatorPresentationTransition::None)
+        [m_textIndicatorView present];
</ins><span class="cx"> 
</span><span class="cx">     if (fadeOut)
</span><span class="cx">         m_startFadeOutTimer.startOneShot(timeBeforeFadeStarts);
</span><span class="lines">@@ -318,7 +473,7 @@
</span><span class="cx">     m_textIndicatorWindow = nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void TextIndicatorWindow::startFadeOutTimerFired()
</del><ins>+void TextIndicatorWindow::startFadeOut()
</ins><span class="cx"> {
</span><span class="cx">     RetainPtr&lt;NSWindow&gt; indicatorWindow = m_textIndicatorWindow;
</span><span class="cx">     [m_textIndicatorView hideWithCompletionHandler:[indicatorWindow] {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformspimacNSImmediateActionGestureRecognizerSPIh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebCore/platform/spi/mac/NSImmediateActionGestureRecognizerSPI.h        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx"> @interface NSImmediateActionGestureRecognizer : NSGestureRecognizer
</span><span class="cx"> 
</span><span class="cx"> @property (strong) id&lt;NSImmediateActionAnimationController&gt; animationController;
</span><ins>+@property (readonly) CGFloat animationProgress;
</ins><span class="cx"> 
</span><span class="cx"> @end
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit/mac/ChangeLog        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -1,3 +1,49 @@
</span><ins>+2014-12-16  Timothy Horton  &lt;timothy_horton@apple.com&gt;
+
+        Implement and adopt two new TextIndicator presentation animations
+        https://bugs.webkit.org/show_bug.cgi?id=139715
+        &lt;rdar://problem/19237945&gt;
+
+        Reviewed by Anders Carlsson.
+
+        * WebView/WebActionMenuController.mm:
+        (-[WebActionMenuController _showTextIndicator]):
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView quickLookWithEvent:]):
+        Remove the completionHandler from text indicator presentation.
+
+        * WebView/WebImmediateActionController.mm:
+        (-[WebImmediateActionController immediateActionRecognizerWillPrepare:]):
+        (-[WebImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
+        (-[WebImmediateActionController immediateActionRecognizerDidCancelAnimation:]):
+        (-[WebImmediateActionController immediateActionRecognizerDidCompleteAnimation:]):
+        (-[WebImmediateActionController _menuItemForDataDetectedText]):
+        (-[WebImmediateActionController _animationControllerForText]):
+        (-[WebImmediateActionController _showTextIndicator]):
+        Forward immediate action gesture recognizer animation progress
+        to TextIndicator. Force us to keep the selection when immediate
+        action popovers steal first responder status from the WebView.
+        If the Lookup range is equal to the selection range, use a Crossfade
+        animation; otherwise, use a FadeIn animation.
+
+        * WebView/WebView.mm:
+        (-[WebView _setMaintainsInactiveSelection:]):
+        (-[WebView maintainsInactiveSelection]):
+        (-[WebView _animationControllerForDictionaryLookupPopupInfo:]):
+        (-[WebView _setTextIndicator:fadeOut:]):
+        (-[WebView _clearTextIndicator]):
+        (-[WebView _setTextIndicatorAnimationProgress:]):
+        (-[WebView _showDictionaryLookupPopup:]):
+        (-[WebView _dictionaryLookupPopoverWillClose:]):
+        (-[WebView _setTextIndicator:fadeOut:animationCompletionHandler:]):
+        Remove the completionHandler from text indicator presentation.
+        Add a _setMaintainsInactiveSelection, which allows WebKit internals
+        to change the return value of -maintainsInactiveSelection, allowing
+        us to keep the selection alive when the WebView loses first responder status.
+
+        * WebView/WebViewData.h:
+        * WebView/WebViewInternal.h:
+
</ins><span class="cx"> 2014-12-16  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Use Ref for SecurityOrigin.
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebActionMenuControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -818,7 +818,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (_type == WebActionMenuDataDetectedItem &amp;&amp; _currentDetectedDataTextIndicator) {
</span><del>-        [_webView _setTextIndicator:_currentDetectedDataTextIndicator.get() fadeOut:NO animationCompletionHandler:^ { }];
</del><ins>+        [_webView _setTextIndicator:_currentDetectedDataTextIndicator.get() fadeOut:NO];
</ins><span class="cx">         _isShowingTextIndicator = YES;
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebHTMLViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebHTMLView.mm (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit/mac/WebView/WebHTMLView.mm        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -5651,7 +5651,7 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)quickLookWithEvent:(NSEvent *)event
</span><span class="cx"> {
</span><del>-    [[self _webView] _setTextIndicator:nullptr fadeOut:NO animationCompletionHandler:[] { }];
</del><ins>+    [[self _webView] _setTextIndicator:nullptr fadeOut:NO];
</ins><span class="cx">     [super quickLookWithEvent:event];
</span><span class="cx"> }
</span><span class="cx"> #endif // !PLATFORM(IOS)
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebImmediateActionControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit/mac/WebView/WebImmediateActionController.mm        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -41,6 +41,7 @@
</span><span class="cx"> #import &lt;WebCore/DataDetectorsSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/DictionaryLookup.h&gt;
</span><span class="cx"> #import &lt;WebCore/EventHandler.h&gt;
</span><ins>+#import &lt;WebCore/FocusController.h&gt;
</ins><span class="cx"> #import &lt;WebCore/Frame.h&gt;
</span><span class="cx"> #import &lt;WebCore/FrameView.h&gt;
</span><span class="cx"> #import &lt;WebCore/HTMLConverter.h&gt;
</span><span class="lines">@@ -121,6 +122,8 @@
</span><span class="cx">     if (immediateActionRecognizer != _immediateActionRecognizer)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    [_webView _setMaintainsInactiveSelection:YES];
+
</ins><span class="cx">     WebHTMLView *documentView = [[[_webView _selectedOrMainFrame] frameView] documentView];
</span><span class="cx">     NSPoint locationInDocumentView = [immediateActionRecognizer locationInView:documentView];
</span><span class="cx">     [self performHitTestAtPoint:locationInDocumentView];
</span><span class="lines">@@ -146,12 +149,22 @@
</span><span class="cx">     // FIXME: Add support for the types of functionality provided in Action menu's menuNeedsUpdate.
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)immediateActionRecognizerDidUpdateAnimation:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
+{
+    if (immediateActionRecognizer != _immediateActionRecognizer)
+        return;
+
+    [_webView _setTextIndicatorAnimationProgress:[immediateActionRecognizer animationProgress]];
+}
+
</ins><span class="cx"> - (void)immediateActionRecognizerDidCancelAnimation:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
</span><span class="cx"> {
</span><span class="cx">     if (immediateActionRecognizer != _immediateActionRecognizer)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    [_webView _setTextIndicatorAnimationProgress:0];
</ins><span class="cx">     [self _clearImmediateActionState];
</span><ins>+    [_webView _setMaintainsInactiveSelection:NO];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)immediateActionRecognizerDidCompleteAnimation:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
</span><span class="lines">@@ -159,7 +172,8 @@
</span><span class="cx">     if (immediateActionRecognizer != _immediateActionRecognizer)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // FIXME: Add support for the types of functionality provided in Action menu's willOpenMenu.
</del><ins>+    [_webView _setTextIndicatorAnimationProgress:1];
+    [_webView _setMaintainsInactiveSelection:NO];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #pragma mark Immediate actions
</span><span class="lines">@@ -268,7 +282,7 @@
</span><span class="cx">             return nil;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    _currentDetectedDataTextIndicator = TextIndicator::createWithRange(*detectedDataRange, TextIndicatorPresentationTransition::BounceAndCrossfade);
</del><ins>+    _currentDetectedDataTextIndicator = TextIndicator::createWithRange(*detectedDataRange, TextIndicatorPresentationTransition::FadeIn);
</ins><span class="cx"> 
</span><span class="cx">     _currentActionContext = [actionContext contextForView:_webView altMode:YES interactionStartedHandler:^() {
</span><span class="cx">     } interactionChangedHandler:^() {
</span><span class="lines">@@ -284,8 +298,6 @@
</span><span class="cx">     if (menuItems.count != 1)
</span><span class="cx">         return nil;
</span><span class="cx"> 
</span><del>-    if (_currentDetectedDataTextIndicator)
-        _currentDetectedDataTextIndicator-&gt;setPresentationTransition(TextIndicatorPresentationTransition::Bounce);
</del><span class="cx">     return menuItems.lastObject;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -349,7 +361,9 @@
</span><span class="cx">     if (!dictionaryRange)
</span><span class="cx">         return nil;
</span><span class="cx"> 
</span><del>-    DictionaryPopupInfo dictionaryPopupInfo = dictionaryPopupInfoForRange(frame, *dictionaryRange, options, TextIndicatorPresentationTransition::Bounce);
</del><ins>+    RefPtr&lt;Range&gt; selectionRange = frame-&gt;page()-&gt;focusController().focusedOrMainFrame().selection().selection().firstRange();
+    bool rangeMatchesSelection = areRangesEqual(dictionaryRange.get(), selectionRange.get());
+    DictionaryPopupInfo dictionaryPopupInfo = dictionaryPopupInfoForRange(frame, *dictionaryRange, options, rangeMatchesSelection ? TextIndicatorPresentationTransition::Crossfade : TextIndicatorPresentationTransition::FadeIn);
</ins><span class="cx">     if (!dictionaryPopupInfo.attributedString)
</span><span class="cx">         return nil;
</span><span class="cx"> 
</span><span class="lines">@@ -364,7 +378,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (_type == WebImmediateActionDataDetectedItem &amp;&amp; _currentDetectedDataTextIndicator) {
</span><del>-        [_webView _setTextIndicator:_currentDetectedDataTextIndicator.get() fadeOut:NO animationCompletionHandler:^ { }];
</del><ins>+        [_webView _setTextIndicator:_currentDetectedDataTextIndicator.get() fadeOut:NO];
</ins><span class="cx">         _isShowingTextIndicator = YES;
</span><span class="cx">     }
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -7206,9 +7206,14 @@
</span><span class="cx">     return [[self _editingDelegateForwarder] webView:self shouldChangeSelectedDOMRange:currentRange toDOMRange:proposedRange affinity:selectionAffinity stillSelecting:flag];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_setMaintainsInactiveSelection:(BOOL)shouldMaintainInactiveSelection
+{
+    _private-&gt;shouldMaintainInactiveSelection = shouldMaintainInactiveSelection;
+}
+
</ins><span class="cx"> - (BOOL)maintainsInactiveSelection
</span><span class="cx"> {
</span><del>-    return NO;
</del><ins>+    return _private-&gt;shouldMaintainInactiveSelection;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)setSelectedDOMRange:(DOMRange *)range affinity:(NSSelectionAffinity)selectionAffinity
</span><span class="lines">@@ -8632,6 +8637,7 @@
</span><span class="cx">         if (!mutableOptions)
</span><span class="cx">             mutableOptions = adoptNS([[NSMutableDictionary alloc] init]);
</span><span class="cx">         [mutableOptions setObject:@YES forKey:getLUTermOptionDisableSearchTermIndicator()];
</span><ins>+        [self _setTextIndicator:dictionaryPopupInfo.textIndicator.get() fadeOut:NO];
</ins><span class="cx">         return [getLULookupDefinitionModuleClass() lookupAnimationControllerForTerm:dictionaryPopupInfo.attributedString.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -8639,7 +8645,7 @@
</span><span class="cx"> }
</span><span class="cx"> #endif // __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
</span><span class="cx"> 
</span><del>-- (void)_setTextIndicator:(TextIndicator *)textIndicator fadeOut:(BOOL)fadeOut animationCompletionHandler:(std::function&lt;void ()&gt;)completionHandler
</del><ins>+- (void)_setTextIndicator:(TextIndicator *)textIndicator fadeOut:(BOOL)fadeOut
</ins><span class="cx"> {
</span><span class="cx">     if (!textIndicator) {
</span><span class="cx">         _private-&gt;textIndicatorWindow = nullptr;
</span><span class="lines">@@ -8650,14 +8656,20 @@
</span><span class="cx">         _private-&gt;textIndicatorWindow = std::make_unique&lt;TextIndicatorWindow&gt;(self);
</span><span class="cx"> 
</span><span class="cx">     NSRect contentRect = [self.window convertRectToScreen:textIndicator-&gt;textBoundingRectInWindowCoordinates()];
</span><del>-    _private-&gt;textIndicatorWindow-&gt;setTextIndicator(textIndicator, NSRectToCGRect(contentRect), fadeOut, WTF::move(completionHandler));
</del><ins>+    _private-&gt;textIndicatorWindow-&gt;setTextIndicator(textIndicator, NSRectToCGRect(contentRect), fadeOut);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_clearTextIndicator
</span><span class="cx"> {
</span><del>-    [self _setTextIndicator:nullptr fadeOut:NO animationCompletionHandler:^ { }];
</del><ins>+    [self _setTextIndicator:nullptr fadeOut:NO];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)_setTextIndicatorAnimationProgress:(float)progress
+{
+    if (_private-&gt;textIndicatorWindow)
+        _private-&gt;textIndicatorWindow-&gt;setAnimationProgress(progress);
+}
+
</ins><span class="cx"> - (void)_showDictionaryLookupPopup:(const DictionaryPopupInfo&amp;)dictionaryPopupInfo
</span><span class="cx"> {
</span><span class="cx">     if (!dictionaryPopupInfo.attributedString)
</span><span class="lines">@@ -8678,16 +8690,15 @@
</span><span class="cx">         if (!mutableOptions)
</span><span class="cx">             mutableOptions = adoptNS([[NSMutableDictionary alloc] init]);
</span><span class="cx">         [mutableOptions setObject:@YES forKey:getLUTermOptionDisableSearchTermIndicator()];
</span><del>-        [self _setTextIndicator:dictionaryPopupInfo.textIndicator.get() fadeOut:NO animationCompletionHandler:[dictionaryPopupInfo, textBaselineOrigin, mutableOptions] {
-            [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
-        }];
</del><ins>+        [self _setTextIndicator:dictionaryPopupInfo.textIndicator.get() fadeOut:NO];
+        [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
</ins><span class="cx">     } else
</span><span class="cx">         [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.get() atLocation:textBaselineOrigin options:dictionaryPopupInfo.options.get()];
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_dictionaryLookupPopoverWillClose:(NSNotification *)notification
</span><span class="cx"> {
</span><del>-    [self _setTextIndicator:nullptr fadeOut:NO animationCompletionHandler:[] { }];
</del><ins>+    [self _setTextIndicator:nullptr fadeOut:NO];
</ins><span class="cx"> }
</span><span class="cx"> #endif // PLATFORM(MAC)
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebViewData.h (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebViewData.h        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit/mac/WebView/WebViewData.h        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -157,6 +157,8 @@
</span><span class="cx">     BOOL hasInitializedLookupObserver;
</span><span class="cx"> #endif // PLATFORM(MAC)
</span><span class="cx"> 
</span><ins>+    BOOL shouldMaintainInactiveSelection;
+
</ins><span class="cx">     BOOL allowsUndo;
</span><span class="cx">         
</span><span class="cx">     float zoomMultiplier;
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebViewInternal.h (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebViewInternal.h        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit/mac/WebView/WebViewInternal.h        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -258,9 +258,12 @@
</span><span class="cx"> - (NSPoint)_convertPointFromRootView:(NSPoint)point;
</span><span class="cx"> - (NSRect)_convertRectFromRootView:(NSRect)rect;
</span><span class="cx"> 
</span><ins>+- (void)_setMaintainsInactiveSelection:(BOOL)shouldMaintainInactiveSelection;
+
</ins><span class="cx"> #if PLATFORM(MAC) &amp;&amp; defined(__cplusplus)
</span><del>-- (void)_setTextIndicator:(WebCore::TextIndicator*)textIndicator fadeOut:(BOOL)fadeOut animationCompletionHandler:(std::function&lt;void ()&gt;)completionHandler;
</del><ins>+- (void)_setTextIndicator:(WebCore::TextIndicator*)textIndicator fadeOut:(BOOL)fadeOut;
</ins><span class="cx"> - (void)_clearTextIndicator;
</span><ins>+- (void)_setTextIndicatorAnimationProgress:(float)progress;
</ins><span class="cx"> - (void)_showDictionaryLookupPopup:(const DictionaryPopupInfo&amp;)dictionaryPopupInfo;
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
</span><span class="cx"> - (id)_animationControllerForDictionaryLookupPopupInfo:(const DictionaryPopupInfo&amp;)dictionaryPopupInfo;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit2/ChangeLog        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -1,3 +1,60 @@
</span><ins>+2014-12-16  Timothy Horton  &lt;timothy_horton@apple.com&gt;
+
+        Implement and adopt two new TextIndicator presentation animations
+        https://bugs.webkit.org/show_bug.cgi?id=139715
+        &lt;rdar://problem/19237945&gt;
+
+        Reviewed by Anders Carlsson.
+
+        * UIProcess/API/mac/WKView.mm:
+        (-[WKView _setTextIndicator:fadeOut:]):
+        (-[WKView _setTextIndicatorAnimationProgress:]):
+        (-[WKView _setTextIndicator:fadeOut:animationCompletionHandler:]): Deleted.
+        * UIProcess/API/mac/WKViewInternal.h:
+        * UIProcess/PageClient.h:
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy):
+        (WebKit::WebPageProxy::setTextIndicatorAnimationProgress):
+        (WebKit::WebPageProxy::performActionMenuHitTestAtLocation):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/mac/PageClientImpl.h:
+        * UIProcess/mac/PageClientImpl.mm:
+        (WebKit::PageClientImpl::setTextIndicatorAnimationProgress):
+        (WebKit::PageClientImpl::didPerformDictionaryLookup):
+        Remove the completion handler block argument from TextIndicator
+        installation.
+        Plumb animation progress through PageClient to TextIndicatorWindow.
+
+        * UIProcess/mac/WKActionMenuController.mm:
+        (-[WKActionMenuController prepareForMenu:withEvent:]):
+        (-[WKActionMenuController _defaultMenuItemsForDataDetectedText]):
+        * UIProcess/mac/WKImmediateActionController.mm:
+        (-[WKImmediateActionController _clearImmediateActionState]):
+        (-[WKImmediateActionController immediateActionRecognizerWillPrepare:]):
+        (-[WKImmediateActionController immediateActionRecognizerDidUpdateAnimation:]):
+        (-[WKImmediateActionController immediateActionRecognizerDidCancelAnimation:]):
+        (-[WKImmediateActionController immediateActionRecognizerDidCompleteAnimation:]):
+        (-[WKImmediateActionController _menuItemForDataDetectedText]):
+        (-[WKImmediateActionController _animationControllerForText]):
+        Forward immediate action gesture recognizer animation progress
+        to TextIndicator. Force us to keep the selection when immediate
+        action popovers steal first responder status from the WebView.
+
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::textIndicatorTransitionForActionMenu):
+        (WebKit::WebPage::performActionMenuHitTestAtLocation):
+        Factor out the presentation animation decision code.
+        For immediate actions, of the Lookup range is equal to the
+        selection range, use a Crossfade animation; otherwise, use a FadeIn
+        animation.
+        Push whether the actionMenuHitTest is for an immediate action
+        or a menu to the Web process, to make the presentation animation
+        decision code live entirely in the Web process.
+        Avoid extracting encoded image data if we know we're doing
+        an immediate action and will never need it.
+
</ins><span class="cx"> 2014-12-16  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix lambda and std::function formatting
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -3095,7 +3095,7 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_setTextIndicator:(PassRefPtr&lt;TextIndicator&gt;)textIndicator fadeOut:(BOOL)fadeOut animationCompletionHandler:(std::function&lt;void ()&gt;)completionHandler
</del><ins>+- (void)_setTextIndicator:(PassRefPtr&lt;TextIndicator&gt;)textIndicator fadeOut:(BOOL)fadeOut
</ins><span class="cx"> {
</span><span class="cx">     if (!textIndicator) {
</span><span class="cx">         _data-&gt;_textIndicatorWindow = nullptr;
</span><span class="lines">@@ -3106,12 +3106,13 @@
</span><span class="cx">         _data-&gt;_textIndicatorWindow = std::make_unique&lt;TextIndicatorWindow&gt;(self);
</span><span class="cx"> 
</span><span class="cx">     NSRect contentRect = [self.window convertRectToScreen:[self convertRect:textIndicator-&gt;textBoundingRectInWindowCoordinates() toView:nil]];
</span><del>-    _data-&gt;_textIndicatorWindow-&gt;setTextIndicator(textIndicator, NSRectToCGRect(contentRect), fadeOut, WTF::move(completionHandler));
</del><ins>+    _data-&gt;_textIndicatorWindow-&gt;setTextIndicator(textIndicator, NSRectToCGRect(contentRect), fadeOut);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_setTextIndicator:(PassRefPtr&lt;TextIndicator&gt;)textIndicator fadeOut:(BOOL)fadeOut
</del><ins>+- (void)_setTextIndicatorAnimationProgress:(float)progress
</ins><span class="cx"> {
</span><del>-    [self _setTextIndicator:textIndicator fadeOut:fadeOut animationCompletionHandler:[] { }];
</del><ins>+    if (_data-&gt;_textIndicatorWindow)
+        _data-&gt;_textIndicatorWindow-&gt;setAnimationProgress(progress);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (CALayer *)_rootLayer
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPImacWKViewInternalh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit2/UIProcess/API/mac/WKViewInternal.h        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -81,7 +81,7 @@
</span><span class="cx"> - (NSRect)_convertToDeviceSpace:(NSRect)rect;
</span><span class="cx"> - (NSRect)_convertToUserSpace:(NSRect)rect;
</span><span class="cx"> - (void)_setTextIndicator:(PassRefPtr&lt;WebCore::TextIndicator&gt;)textIndicator fadeOut:(BOOL)fadeOut;
</span><del>-- (void)_setTextIndicator:(PassRefPtr&lt;WebCore::TextIndicator&gt;)textIndicator fadeOut:(BOOL)fadeOut animationCompletionHandler:(std::function&lt;void ()&gt;)completionHandler;
</del><ins>+- (void)_setTextIndicatorAnimationProgress:(float)progress;
</ins><span class="cx"> 
</span><span class="cx"> - (void)_setAcceleratedCompositingModeRootLayer:(CALayer *)rootLayer;
</span><span class="cx"> - (CALayer *)_acceleratedCompositingModeRootLayer;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPageClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/PageClient.h (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/PageClient.h        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit2/UIProcess/PageClient.h        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -219,6 +219,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     virtual void setTextIndicator(PassRefPtr&lt;WebCore::TextIndicator&gt;, bool fadeOut) = 0;
</span><ins>+    virtual void setTextIndicatorAnimationProgress(float) = 0;
</ins><span class="cx"> 
</span><span class="cx">     virtual void enterAcceleratedCompositingMode(const LayerTreeContext&amp;) = 0;
</span><span class="cx">     virtual void exitAcceleratedCompositingMode() = 0;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -286,6 +286,7 @@
</span><span class="cx">     , m_viewState(ViewState::NoFlags)
</span><span class="cx">     , m_viewWasEverInWindow(false)
</span><span class="cx">     , m_backForwardList(WebBackForwardList::create(*this))
</span><ins>+    , m_maintainsInactiveSelection(false)
</ins><span class="cx"> #if PLATFORM(MAC) &amp;&amp; !USE(ASYNC_NSTEXTINPUTCLIENT)
</span><span class="cx">     , m_temporarilyClosedComposition(false)
</span><span class="cx"> #endif
</span><span class="lines">@@ -3688,6 +3689,11 @@
</span><span class="cx">     m_pageClient.setTextIndicator(nullptr, false);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void WebPageProxy::setTextIndicatorAnimationProgress(float progress)
+{
+    m_pageClient.setTextIndicatorAnimationProgress(progress);
+}
+
</ins><span class="cx"> void WebPageProxy::didFindString(const String&amp; string, uint32_t matchCount, int32_t matchIndex)
</span><span class="cx"> {
</span><span class="cx">     m_findClient-&gt;didFindString(this, string, matchCount, matchIndex);
</span><span class="lines">@@ -5336,9 +5342,9 @@
</span><span class="cx">     m_pageClient.removeNavigationGestureSnapshot();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPageProxy::performActionMenuHitTestAtLocation(FloatPoint point)
</del><ins>+void WebPageProxy::performActionMenuHitTestAtLocation(FloatPoint point, bool forImmediateAction)
</ins><span class="cx"> {
</span><del>-    m_process-&gt;send(Messages::WebPage::PerformActionMenuHitTestAtLocation(point), m_pageID);
</del><ins>+    m_process-&gt;send(Messages::WebPage::PerformActionMenuHitTestAtLocation(point, forImmediateAction), m_pageID);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPageProxy::selectLastActionMenuRange()
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -674,6 +674,7 @@
</span><span class="cx">     void countStringMatches(const String&amp;, FindOptions, unsigned maxMatchCount);
</span><span class="cx">     void didCountStringMatches(const String&amp;, uint32_t matchCount);
</span><span class="cx">     void setTextIndicator(const WebCore::TextIndicatorData&amp;, bool fadeOut);
</span><ins>+    void setTextIndicatorAnimationProgress(float);
</ins><span class="cx">     void clearTextIndicator();
</span><span class="cx">     void didFindString(const String&amp;, uint32_t matchCount, int32_t matchIndex);
</span><span class="cx">     void didFailToFindString(const String&amp;);
</span><span class="lines">@@ -932,7 +933,7 @@
</span><span class="cx">     void removeNavigationGestureSnapshot();
</span><span class="cx"> 
</span><span class="cx">     WebHitTestResult* lastMouseMoveHitTestResult() const { return m_lastMouseMoveHitTestResult.get(); }
</span><del>-    void performActionMenuHitTestAtLocation(WebCore::FloatPoint);
</del><ins>+    void performActionMenuHitTestAtLocation(WebCore::FloatPoint, bool forImmediateAction);
</ins><span class="cx">     void selectLastActionMenuRange();
</span><span class="cx">     void focusAndSelectLastActionMenuHitTestResult();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.h        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -122,7 +122,8 @@
</span><span class="cx">     virtual PassRefPtr&lt;WebColorPicker&gt; createColorPicker(WebPageProxy*, const WebCore::Color&amp; initialColor, const WebCore::IntRect&amp;);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    void setTextIndicator(PassRefPtr&lt;WebCore::TextIndicator&gt;, bool fadeOut);
</del><ins>+    virtual void setTextIndicator(PassRefPtr&lt;WebCore::TextIndicator&gt;, bool fadeOut) override;
+    virtual void setTextIndicatorAnimationProgress(float) override;
</ins><span class="cx"> 
</span><span class="cx">     virtual void enterAcceleratedCompositingMode(const LayerTreeContext&amp;);
</span><span class="cx">     virtual void exitAcceleratedCompositingMode();
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacPageClientImplmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit2/UIProcess/mac/PageClientImpl.mm        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -493,6 +493,11 @@
</span><span class="cx">     [m_wkView _setTextIndicator:textIndicator fadeOut:fadeOut];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PageClientImpl::setTextIndicatorAnimationProgress(float progress)
+{
+    [m_wkView _setTextIndicatorAnimationProgress:progress];
+}
+
</ins><span class="cx"> void PageClientImpl::accessibilityWebProcessTokenReceived(const IPC::DataReference&amp; data)
</span><span class="cx"> {
</span><span class="cx">     NSData* remoteToken = [NSData dataWithBytes:data.data() length:data.size()];
</span><span class="lines">@@ -567,10 +572,9 @@
</span><span class="cx">         // Run the animations serially because attaching another subwindow breaks the bounce animation.
</span><span class="cx">         // We could consider making the bounce NSAnimationNonblockingThreaded instead, which seems
</span><span class="cx">         // to work, but need to consider all of the implications.
</span><del>-        [m_wkView _setTextIndicator:TextIndicator::create(dictionaryPopupInfo.textIndicator) fadeOut:NO animationCompletionHandler:[dictionaryPopupInfo, textBaselineOrigin, mutableOptions] {
-            [mutableOptions setObject:@YES forKey:getLUTermOptionDisableSearchTermIndicator()];
-            [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.string.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
-        }];
</del><ins>+        [m_wkView _setTextIndicator:TextIndicator::create(dictionaryPopupInfo.textIndicator) fadeOut:NO];
+        [mutableOptions setObject:@YES forKey:getLUTermOptionDisableSearchTermIndicator()];
+        [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.string.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
</ins><span class="cx">     } else
</span><span class="cx">         [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.string.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWKActionMenuControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -101,7 +101,7 @@
</span><span class="cx"> 
</span><span class="cx">     [_wkView _dismissContentRelativeChildWindows];
</span><span class="cx"> 
</span><del>-    _page-&gt;performActionMenuHitTestAtLocation([_wkView convertPoint:event.locationInWindow fromView:nil]);
</del><ins>+    _page-&gt;performActionMenuHitTestAtLocation([_wkView convertPoint:event.locationInWindow fromView:nil], false);
</ins><span class="cx"> 
</span><span class="cx">     _state = ActionMenuState::Pending;
</span><span class="cx">     [self _updateActionMenuItems];
</span><span class="lines">@@ -399,8 +399,6 @@
</span><span class="cx">     [_currentActionContext setHighlightFrame:[_wkView.window convertRectToScreen:[_wkView convertRect:_hitTestResult.detectedDataBoundingBox toView:nil]]];
</span><span class="cx"> 
</span><span class="cx">     NSArray *menuItems = [[getDDActionsManagerClass() sharedManager] menuItemsForResult:[_currentActionContext mainResult] actionContext:_currentActionContext.get()];
</span><del>-    if (menuItems.count == 1 &amp;&amp; _hitTestResult.detectedDataTextIndicator)
-        _hitTestResult.detectedDataTextIndicator-&gt;setPresentationTransition(TextIndicatorPresentationTransition::Bounce);
</del><span class="cx">     return menuItems;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWKImmediateActionControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -101,6 +101,12 @@
</span><span class="cx"> 
</span><span class="cx"> - (void)_clearImmediateActionState
</span><span class="cx"> {
</span><ins>+#if WK_API_ENABLED
+    [self hidePreview];
+#endif
+
+    _page-&gt;clearTextIndicator();
+
</ins><span class="cx">     if (_currentActionContext &amp;&amp; _hasActivatedActionContext) {
</span><span class="cx">         [getDDActionsManagerClass() didUseActions];
</span><span class="cx">         _hasActivatedActionContext = NO;
</span><span class="lines">@@ -130,10 +136,12 @@
</span><span class="cx">     if (immediateActionRecognizer != _immediateActionRecognizer)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    _page-&gt;setMaintainsInactiveSelection(true);
+
</ins><span class="cx">     [_wkView _dismissContentRelativeChildWindows];
</span><span class="cx"> 
</span><span class="cx">     _eventLocationInView = [immediateActionRecognizer locationInView:immediateActionRecognizer.view];
</span><del>-    _page-&gt;performActionMenuHitTestAtLocation(_eventLocationInView);
</del><ins>+    _page-&gt;performActionMenuHitTestAtLocation(_eventLocationInView, true);
</ins><span class="cx"> 
</span><span class="cx">     _state = ImmediateActionState::Pending;
</span><span class="cx">     [self _updateImmediateActionItem];
</span><span class="lines">@@ -172,12 +180,22 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (void)immediateActionRecognizerDidUpdateAnimation:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
+{
+    if (immediateActionRecognizer != _immediateActionRecognizer)
+        return;
+
+    _page-&gt;setTextIndicatorAnimationProgress([immediateActionRecognizer animationProgress]);
+}
+
</ins><span class="cx"> - (void)immediateActionRecognizerDidCancelAnimation:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
</span><span class="cx"> {
</span><span class="cx">     if (immediateActionRecognizer != _immediateActionRecognizer)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><ins>+    _page-&gt;setTextIndicatorAnimationProgress(0);
</ins><span class="cx">     [self _clearImmediateActionState];
</span><ins>+    _page-&gt;setMaintainsInactiveSelection(false);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)immediateActionRecognizerDidCompleteAnimation:(NSImmediateActionGestureRecognizer *)immediateActionRecognizer
</span><span class="lines">@@ -185,7 +203,8 @@
</span><span class="cx">     if (immediateActionRecognizer != _immediateActionRecognizer)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    // FIXME: Add support for the types of functionality provided in Action menu's willOpenMenu.
</del><ins>+    _page-&gt;setTextIndicatorAnimationProgress(1);
+    _page-&gt;setMaintainsInactiveSelection(false);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (PassRefPtr&lt;WebHitTestResult&gt;)_webHitTestResult
</span><span class="lines">@@ -507,8 +526,6 @@
</span><span class="cx">     if (menuItems.count != 1)
</span><span class="cx">         return nil;
</span><span class="cx"> 
</span><del>-    if (_hitTestResult.detectedDataTextIndicator)
-        _hitTestResult.detectedDataTextIndicator-&gt;setPresentationTransition(TextIndicatorPresentationTransition::Bounce);
</del><span class="cx">     return menuItems.lastObject;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -533,6 +550,7 @@
</span><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;NSMutableDictionary&gt; mutableOptions = adoptNS([(NSDictionary *)dictionaryPopupInfo.options.get() mutableCopy]);
</span><span class="cx">     if (canLoadLUTermOptionDisableSearchTermIndicator() &amp;&amp; dictionaryPopupInfo.textIndicator.contentImage) {
</span><ins>+        [_wkView _setTextIndicator:TextIndicator::create(dictionaryPopupInfo.textIndicator) fadeOut:NO];
</ins><span class="cx">         [mutableOptions setObject:@YES forKey:getLUTermOptionDisableSearchTermIndicator()];
</span><span class="cx">         return [getLULookupDefinitionModuleClass() lookupAnimationControllerForTerm:dictionaryPopupInfo.attributedString.string.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -1077,7 +1077,7 @@
</span><span class="cx">     void reportUsedFeatures();
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><del>-    void performActionMenuHitTestAtLocation(WebCore::FloatPoint);
</del><ins>+    void performActionMenuHitTestAtLocation(WebCore::FloatPoint, bool forImmediateAction);
</ins><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></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -399,7 +399,7 @@
</span><span class="cx">     
</span><span class="cx">     TakeSnapshot(WebCore::IntRect snapshotRect, WebCore::IntSize bitmapSize, uint32_t options, uint64_t callbackID)
</span><span class="cx"> #if PLATFORM(MAC)
</span><del>-    PerformActionMenuHitTestAtLocation(WebCore::FloatPoint location)
</del><ins>+    PerformActionMenuHitTestAtLocation(WebCore::FloatPoint location, bool forImmediateAction)
</ins><span class="cx">     SelectLastActionMenuRange()
</span><span class="cx">     FocusAndSelectLastActionMenuHitTestResult()
</span><span class="cx">     DataDetectorsDidPresentUI(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 (177426 => 177427)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2014-12-17 02:55:04 UTC (rev 177426)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2014-12-17 03:02:41 UTC (rev 177427)
</span><span class="lines">@@ -978,8 +978,15 @@
</span><span class="cx">     return String();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::performActionMenuHitTestAtLocation(WebCore::FloatPoint locationInViewCooordinates)
</del><ins>+static TextIndicatorPresentationTransition textIndicatorTransitionForActionMenu(Range* selectionRange, Range&amp; indicatorRange, bool forImmediateAction, bool forDataDetectors)
</ins><span class="cx"> {
</span><ins>+    if (areRangesEqual(&amp;indicatorRange, selectionRange) || (forDataDetectors &amp;&amp; !forImmediateAction))
+        return forImmediateAction ? TextIndicatorPresentationTransition::Crossfade : TextIndicatorPresentationTransition::BounceAndCrossfade;
+    return forImmediateAction ? TextIndicatorPresentationTransition::FadeIn : TextIndicatorPresentationTransition::Bounce;
+}
+
+void WebPage::performActionMenuHitTestAtLocation(WebCore::FloatPoint locationInViewCooordinates, bool forImmediateAction)
+{
</ins><span class="cx">     layoutIfNeeded();
</span><span class="cx"> 
</span><span class="cx">     MainFrame&amp; mainFrame = corePage()-&gt;mainFrame();
</span><span class="lines">@@ -995,26 +1002,31 @@
</span><span class="cx">     actionMenuResult.hitTestLocationInViewCooordinates = locationInViewCooordinates;
</span><span class="cx">     actionMenuResult.hitTestResult = WebHitTestResult::Data(hitTestResult);
</span><span class="cx"> 
</span><ins>+    RefPtr&lt;Range&gt; selectionRange = corePage()-&gt;focusController().focusedOrMainFrame().selection().selection().firstRange();
+
</ins><span class="cx">     NSDictionary *options = nil;
</span><del>-    RefPtr&lt;WebCore::Range&gt; lookupRange = lookupTextAtLocation(locationInViewCooordinates, &amp;options);
</del><ins>+    RefPtr&lt;Range&gt; lookupRange = lookupTextAtLocation(locationInViewCooordinates, &amp;options);
</ins><span class="cx">     actionMenuResult.lookupText = lookupRange ? lookupRange-&gt;text() : String();
</span><ins>+
</ins><span class="cx">     if (lookupRange) {
</span><span class="cx">         if (Node* node = hitTestResult.innerNode()) {
</span><span class="cx">             if (Frame* hitTestResultFrame = node-&gt;document().frame())
</span><del>-                actionMenuResult.dictionaryPopupInfo = dictionaryPopupInfoForRange(hitTestResultFrame, *lookupRange.get(), &amp;options, TextIndicatorPresentationTransition::Bounce);
</del><ins>+                actionMenuResult.dictionaryPopupInfo = dictionaryPopupInfoForRange(hitTestResultFrame, *lookupRange.get(), &amp;options, textIndicatorTransitionForActionMenu(selectionRange.get(), *lookupRange, forImmediateAction, false));
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     m_lastActionMenuRangeForSelection = lookupRange;
</span><span class="cx">     m_lastActionMenuHitTestResult = hitTestResult;
</span><span class="cx"> 
</span><del>-    if (Image* image = hitTestResult.image()) {
-        RefPtr&lt;SharedBuffer&gt; buffer = image-&gt;data();
-        String imageExtension = image-&gt;filenameExtension();
-        if (!imageExtension.isEmpty() &amp;&amp; buffer) {
-            actionMenuResult.imageSharedMemory = SharedMemory::create(buffer-&gt;size());
-            memcpy(actionMenuResult.imageSharedMemory-&gt;data(), buffer-&gt;data(), buffer-&gt;size());
-            actionMenuResult.imageExtension = imageExtension;
</del><ins>+    if (!forImmediateAction) {
+        if (Image* image = hitTestResult.image()) {
+            RefPtr&lt;SharedBuffer&gt; buffer = image-&gt;data();
+            String imageExtension = image-&gt;filenameExtension();
+            if (!imageExtension.isEmpty() &amp;&amp; buffer) {
+                actionMenuResult.imageSharedMemory = SharedMemory::create(buffer-&gt;size());
+                memcpy(actionMenuResult.imageSharedMemory-&gt;data(), buffer-&gt;data(), buffer-&gt;size());
+                actionMenuResult.imageExtension = imageExtension;
+            }
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1040,7 +1052,7 @@
</span><span class="cx">             detectedDataBoundingBox.unite(frameView-&gt;contentsToWindow(quad.enclosingBoundingBox()));
</span><span class="cx"> 
</span><span class="cx">         actionMenuResult.detectedDataBoundingBox = detectedDataBoundingBox;
</span><del>-        actionMenuResult.detectedDataTextIndicator = TextIndicator::createWithRange(*mainResultRange, TextIndicatorPresentationTransition::BounceAndCrossfade);
</del><ins>+        actionMenuResult.detectedDataTextIndicator = TextIndicator::createWithRange(*mainResultRange, textIndicatorTransitionForActionMenu(selectionRange.get(), *mainResultRange, forImmediateAction, true));
</ins><span class="cx">         actionMenuResult.detectedDataOriginatingPageOverlay = overlay-&gt;pageOverlayID();
</span><span class="cx">         m_lastActionMenuRangeForSelection = mainResultRange;
</span><span class="cx"> 
</span><span class="lines">@@ -1054,7 +1066,7 @@
</span><span class="cx">         actionMenuResult.actionContext = DataDetection::detectItemAroundHitTestResult(hitTestResult, detectedDataBoundingBox, detectedDataRange);
</span><span class="cx">         if (actionMenuResult.actionContext &amp;&amp; detectedDataRange) {
</span><span class="cx">             actionMenuResult.detectedDataBoundingBox = detectedDataBoundingBox;
</span><del>-            actionMenuResult.detectedDataTextIndicator = TextIndicator::createWithRange(*detectedDataRange, TextIndicatorPresentationTransition::BounceAndCrossfade);
</del><ins>+            actionMenuResult.detectedDataTextIndicator = TextIndicator::createWithRange(*detectedDataRange, textIndicatorTransitionForActionMenu(selectionRange.get(), *detectedDataRange, forImmediateAction, true));
</ins><span class="cx">             m_lastActionMenuRangeForSelection = detectedDataRange;
</span><span class="cx">         }
</span><span class="cx">     }
</span></span></pre>
</div>
</div>

</body>
</html>