<!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>[177352] branches/safari-600.3-branch/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/177352">177352</a></dd>
<dt>Author</dt> <dd>dburkart@apple.com</dd>
<dt>Date</dt> <dd>2014-12-16 01:01:53 -0800 (Tue, 16 Dec 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/177323">r177323</a>. &lt;rdar://problem/19198414&gt;</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6003branchSourceWebCoreChangeLog">branches/safari-600.3-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6003branchSourceWebCoreplatformspimacLookupSPIh">branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/LookupSPI.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacChangeLog">branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacWebViewWebActionMenuControllermm">branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacWebViewWebImmediateActionControllermm">branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebImmediateActionController.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacWebViewWebUIDelegatePrivateh">branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacWebViewWebViewmm">branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacWebViewWebViewInternalh">branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewInternal.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2ChangeLog">branches/safari-600.3-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2SharedAPIcWKImmediateActionTypesh">branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKImmediateActionTypes.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2SharedmacActionMenuHitTestResulth">branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2SharedmacActionMenuHitTestResultmm">branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2UIProcessmacWKActionMenuControllermm">branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2UIProcessmacWKImmediateActionControllermm">branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2WebProcessWebPageWebPageh">branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2WebProcessWebPagemacWebPageMacmm">branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6003branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/ChangeLog (177351 => 177352)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/ChangeLog        2014-12-16 08:57:40 UTC (rev 177351)
+++ branches/safari-600.3-branch/Source/WebCore/ChangeLog        2014-12-16 09:01:53 UTC (rev 177352)
</span><span class="lines">@@ -1,5 +1,21 @@
</span><span class="cx"> 2014-12-16  Dana Burkart  &lt;dburkart@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merged r177323. &lt;rdar://problem/19198414&gt;
+
+    2014-12-15  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+            Make lookup an immediate action instead of an action menu item
+            https://bugs.webkit.org/show_bug.cgi?id=139661
+            -and corresponding-
+            rdar://problem/19198414
+
+            Reviewed by Tim Horton.
+
+            New SPI.
+            * platform/spi/mac/LookupSPI.h:
+
+2014-12-16  Dana Burkart  &lt;dburkart@apple.com&gt;
+
</ins><span class="cx">         Merged r177303. &lt;rdar://problem/19198539&gt;
</span><span class="cx"> 
</span><span class="cx">     2014-12-15  Timothy Horton  &lt;timothy_horton@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCoreplatformspimacLookupSPIh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/LookupSPI.h (177351 => 177352)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/LookupSPI.h        2014-12-16 08:57:40 UTC (rev 177351)
+++ branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/LookupSPI.h        2014-12-16 09:01:53 UTC (rev 177352)
</span><span class="lines">@@ -47,4 +47,10 @@
</span><span class="cx"> 
</span><span class="cx"> #endif // !USE(APPLE_INTERNAL_SDK)
</span><span class="cx"> 
</span><ins>+@interface LULookupDefinitionModule (AnimationController)
+
++ (id&lt;NSImmediateActionAnimationController&gt;)lookupAnimationControllerForTerm:(NSAttributedString *)term atLocation:(NSPoint)screenPoint options:(NSDictionary *)options;
+
+@end
+
</ins><span class="cx"> #endif // PLATFORM(MAC)
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog (177351 => 177352)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog        2014-12-16 08:57:40 UTC (rev 177351)
+++ branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog        2014-12-16 09:01:53 UTC (rev 177352)
</span><span class="lines">@@ -1,5 +1,44 @@
</span><span class="cx"> 2014-12-16  Dana Burkart  &lt;dburkart@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merged r177323. &lt;rdar://problem/19198414&gt;
+
+    2014-12-15  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+            Make lookup an immediate action instead of an action menu item
+            https://bugs.webkit.org/show_bug.cgi?id=139661
+            -and corresponding-
+            rdar://problem/19198414
+
+            Reviewed by Tim Horton.
+
+            Remove the lookup menu items and non-unused static function associated with 
+            lookup.
+            * WebView/WebActionMenuController.mm:
+            (-[WebActionMenuController _defaultMenuItemsForText]):
+            (-[WebActionMenuController _defaultMenuItemsForEditableText]):
+            (-[WebActionMenuController _defaultMenuItemsForEditableTextWithSuggestions]):
+            (-[WebActionMenuController _createActionMenuItemForTag:]):
+            (-[WebActionMenuController _lookupText:]): Deleted.
+            (performDictionaryLookupForSelection): Deleted.
+            (performDictionaryLookupForRange): Deleted.
+
+            Set the defaultAnimationController to the lookup-provided animation controller 
+            when appropriate.
+            * WebView/WebImmediateActionController.mm:
+            (-[WebImmediateActionController _defaultAnimationController]):
+            (dictionaryPopupInfoForRange):
+            (-[WebImmediateActionController _animationControllerForText]):
+
+            New type.
+            * WebView/WebUIDelegatePrivate.h:
+
+            New function to get the lookup animation controller.
+            * WebView/WebView.mm:
+            (-[WebView _animationControllerForDictionaryLookupPopupInfo:]):
+            * WebView/WebViewInternal.h:
+
+2014-12-16  Dana Burkart  &lt;dburkart@apple.com&gt;
+
</ins><span class="cx">         Merged r177304. &lt;rdar://problem/19198539&gt;
</span><span class="cx"> 
</span><span class="cx">     2014-12-15  Timothy Horton  &lt;timothy_horton@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacWebViewWebActionMenuControllermm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm (177351 => 177352)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm        2014-12-16 08:57:40 UTC (rev 177351)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm        2014-12-16 09:01:53 UTC (rev 177352)
</span><span class="lines">@@ -30,7 +30,6 @@
</span><span class="cx"> #import &quot;DOMElementInternal.h&quot;
</span><span class="cx"> #import &quot;DOMNodeInternal.h&quot;
</span><span class="cx"> #import &quot;DOMRangeInternal.h&quot;
</span><del>-#import &quot;DictionaryPopupInfo.h&quot;
</del><span class="cx"> #import &quot;WebDocumentInternal.h&quot;
</span><span class="cx"> #import &quot;WebElementDictionary.h&quot;
</span><span class="cx"> #import &quot;WebFrameInternal.h&quot;
</span><span class="lines">@@ -54,7 +53,6 @@
</span><span class="cx"> #import &lt;WebCore/FrameView.h&gt;
</span><span class="cx"> #import &lt;WebCore/HTMLConverter.h&gt;
</span><span class="cx"> #import &lt;WebCore/LocalizedStrings.h&gt;
</span><del>-#import &lt;WebCore/LookupSPI.h&gt;
</del><span class="cx"> #import &lt;WebCore/NSMenuSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/NSSharingServicePickerSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/NSSharingServiceSPI.h&gt;
</span><span class="lines">@@ -460,20 +458,18 @@
</span><span class="cx"> - (NSArray *)_defaultMenuItemsForText
</span><span class="cx"> {
</span><span class="cx">     RetainPtr&lt;NSMenuItem&gt; copyTextItem = [self _createActionMenuItemForTag:WebActionMenuItemTagCopyText];
</span><del>-    RetainPtr&lt;NSMenuItem&gt; lookupTextItem = [self _createActionMenuItemForTag:WebActionMenuItemTagLookupText];
</del><span class="cx">     RetainPtr&lt;NSMenuItem&gt; pasteItem = [self _createActionMenuItemForTag:WebActionMenuItemTagPaste];
</span><span class="cx">     [pasteItem setEnabled:NO];
</span><span class="cx"> 
</span><del>-    return @[ copyTextItem.get(), lookupTextItem.get(), pasteItem.get() ];
</del><ins>+    return @[ copyTextItem.get(), [NSMenuItem separatorItem], pasteItem.get() ];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSArray *)_defaultMenuItemsForEditableText
</span><span class="cx"> {
</span><span class="cx">     RetainPtr&lt;NSMenuItem&gt; copyTextItem = [self _createActionMenuItemForTag:WebActionMenuItemTagCopyText];
</span><del>-    RetainPtr&lt;NSMenuItem&gt; lookupTextItem = [self _createActionMenuItemForTag:WebActionMenuItemTagLookupText];
</del><span class="cx">     RetainPtr&lt;NSMenuItem&gt; pasteItem = [self _createActionMenuItemForTag:WebActionMenuItemTagPaste];
</span><span class="cx"> 
</span><del>-    return @[ copyTextItem.get(), lookupTextItem.get(), pasteItem.get() ];
</del><ins>+    return @[ copyTextItem.get(), [NSMenuItem separatorItem], pasteItem.get() ];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSArray *)_defaultMenuItemsForEditableTextWithSuggestions
</span><span class="lines">@@ -510,13 +506,12 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;NSMenuItem&gt; copyTextItem = [self _createActionMenuItemForTag:WebActionMenuItemTagCopyText];
</span><del>-    RetainPtr&lt;NSMenuItem&gt; lookupTextItem = [self _createActionMenuItemForTag:WebActionMenuItemTagLookupText];
</del><span class="cx">     RetainPtr&lt;NSMenuItem&gt; pasteItem = [self _createActionMenuItemForTag:WebActionMenuItemTagPaste];
</span><span class="cx">     RetainPtr&lt;NSMenuItem&gt; textSuggestionsItem = [self _createActionMenuItemForTag:WebActionMenuItemTagTextSuggestions];
</span><span class="cx"> 
</span><span class="cx">     [textSuggestionsItem setSubmenu:spellingSubMenu.get()];
</span><span class="cx"> 
</span><del>-    return @[ copyTextItem.get(), lookupTextItem.get(), pasteItem.get(), textSuggestionsItem.get() ];
</del><ins>+    return @[ copyTextItem.get(), [NSMenuItem separatorItem], pasteItem.get(), textSuggestionsItem.get() ];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_selectDataDetectedText
</span><span class="lines">@@ -576,16 +571,6 @@
</span><span class="cx">     [_webView copy:self];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_lookupText:(id)sender
-{
-    Frame* frame = core([_webView _selectedOrMainFrame]);
-    if (!frame)
-        return;
-
-    DictionaryPopupInfo popupInfo = performDictionaryLookupForSelection(frame, frame-&gt;selection().selection());
-    [_webView _showDictionaryLookupPopup:popupInfo];
-}
-
</del><span class="cx"> - (void)_paste:(id)sender
</span><span class="cx"> {
</span><span class="cx">     [_webView paste:self];
</span><span class="lines">@@ -617,56 +602,6 @@
</span><span class="cx">     [documentView _changeSpellingToWord:selectedCorrection];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static DictionaryPopupInfo performDictionaryLookupForSelection(Frame* frame, const VisibleSelection&amp; selection)
-{
-    NSDictionary *options = nil;
-    DictionaryPopupInfo popupInfo;
-    RefPtr&lt;Range&gt; selectedRange = rangeForDictionaryLookupForSelection(selection, &amp;options);
-    if (selectedRange)
-        popupInfo = performDictionaryLookupForRange(frame, *selectedRange, options, TextIndicatorPresentationTransition::BounceAndCrossfade);
-    return popupInfo;
-}
-
-static DictionaryPopupInfo performDictionaryLookupForRange(Frame* frame, Range&amp; range, NSDictionary *options, TextIndicatorPresentationTransition presentationTransition)
-{
-    DictionaryPopupInfo popupInfo;
-    if (range.text().stripWhiteSpace().isEmpty())
-        return popupInfo;
-    
-    RenderObject* renderer = range.startContainer()-&gt;renderer();
-    const RenderStyle&amp; style = renderer-&gt;style();
-
-    Vector&lt;FloatQuad&gt; quads;
-    range.textQuads(quads);
-    if (quads.isEmpty())
-        return popupInfo;
-
-    IntRect rangeRect = frame-&gt;view()-&gt;contentsToWindow(quads[0].enclosingBoundingBox());
-
-    popupInfo.origin = NSMakePoint(rangeRect.x(), rangeRect.y() + (style.fontMetrics().descent() * frame-&gt;page()-&gt;pageScaleFactor()));
-    popupInfo.options = options;
-
-    NSAttributedString *nsAttributedString = editingAttributedStringFromRange(range, IncludeImagesInAttributedString::No);
-    RetainPtr&lt;NSMutableAttributedString&gt; scaledNSAttributedString = adoptNS([[NSMutableAttributedString alloc] initWithString:[nsAttributedString string]]);
-    NSFontManager *fontManager = [NSFontManager sharedFontManager];
-
-    [nsAttributedString enumerateAttributesInRange:NSMakeRange(0, [nsAttributedString length]) options:0 usingBlock:^(NSDictionary *attributes, NSRange range, BOOL *stop) {
-        RetainPtr&lt;NSMutableDictionary&gt; scaledAttributes = adoptNS([attributes mutableCopy]);
-
-        NSFont *font = [scaledAttributes objectForKey:NSFontAttributeName];
-        if (font) {
-            font = [fontManager convertFont:font toSize:[font pointSize] * frame-&gt;page()-&gt;pageScaleFactor()];
-            [scaledAttributes setObject:font forKey:NSFontAttributeName];
-        }
-
-        [scaledNSAttributedString addAttributes:scaledAttributes.get() range:range];
-    }];
-
-    popupInfo.attributedString = scaledNSAttributedString.get();
-    popupInfo.textIndicator = TextIndicator::createWithRange(range, presentationTransition);
-    return popupInfo;
-}
-
</del><span class="cx"> #pragma mark Whitespace actions
</span><span class="cx"> 
</span><span class="cx"> - (NSArray *)_defaultMenuItemsForWhitespaceInEditableArea
</span><span class="lines">@@ -734,13 +669,6 @@
</span><span class="cx">         enabled = _hitTestResult.allowsCopy();
</span><span class="cx">         break;
</span><span class="cx"> 
</span><del>-    case WebActionMenuItemTagLookupText:
-        selector = @selector(_lookupText:);
-        title = WEB_UI_STRING_KEY(&quot;Look Up&quot;, &quot;Look Up (action menu item)&quot;, &quot;action menu item&quot;);
-        image = [NSImage imageNamed:@&quot;NSActionMenuLookup&quot;];
-        enabled = getLULookupDefinitionModuleClass() &amp;&amp; _hitTestResult.allowsCopy();
-        break;
-
</del><span class="cx">     case WebActionMenuItemTagPaste:
</span><span class="cx">         selector = @selector(_paste:);
</span><span class="cx">         title = WEB_UI_STRING_KEY(&quot;Paste&quot;, &quot;Paste (action menu item)&quot;, &quot;action menu item&quot;);
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacWebViewWebImmediateActionControllermm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebImmediateActionController.mm (177351 => 177352)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebImmediateActionController.mm        2014-12-16 08:57:40 UTC (rev 177351)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebImmediateActionController.mm        2014-12-16 09:01:53 UTC (rev 177352)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #import &quot;DOMElementInternal.h&quot;
</span><span class="cx"> #import &quot;DOMNodeInternal.h&quot;
</span><span class="cx"> #import &quot;DOMRangeInternal.h&quot;
</span><ins>+#import &quot;DictionaryPopupInfo.h&quot;
</ins><span class="cx"> #import &quot;WebElementDictionary.h&quot;
</span><span class="cx"> #import &quot;WebFrameInternal.h&quot;
</span><span class="cx"> #import &quot;WebHTMLView.h&quot;
</span><span class="lines">@@ -38,9 +39,15 @@
</span><span class="cx"> #import &quot;WebViewInternal.h&quot;
</span><span class="cx"> #import &lt;WebCore/DataDetection.h&gt;
</span><span class="cx"> #import &lt;WebCore/DataDetectorsSPI.h&gt;
</span><ins>+#import &lt;WebCore/DictionaryLookup.h&gt;
</ins><span class="cx"> #import &lt;WebCore/EventHandler.h&gt;
</span><span class="cx"> #import &lt;WebCore/Frame.h&gt;
</span><ins>+#import &lt;WebCore/FrameView.h&gt;
+#import &lt;WebCore/HTMLConverter.h&gt;
+#import &lt;WebCore/LookupSPI.h&gt;
</ins><span class="cx"> #import &lt;WebCore/NSMenuSPI.h&gt;
</span><ins>+#import &lt;WebCore/Page.h&gt;
+#import &lt;WebCore/RenderObject.h&gt;
</ins><span class="cx"> #import &lt;WebCore/SoftLinking.h&gt;
</span><span class="cx"> #import &lt;WebCore/TextIndicator.h&gt;
</span><span class="cx"> #import &lt;objc/objc-class.h&gt;
</span><span class="lines">@@ -176,6 +183,11 @@
</span><span class="cx">             _type = WebImmediateActionDataDetectedItem;
</span><span class="cx">             return (id&lt;NSImmediateActionAnimationController&gt;)immediateActionItem;
</span><span class="cx">         }
</span><ins>+
+        if (id&lt;NSImmediateActionAnimationController&gt; defaultTextController = [self _animationControllerForText]) {
+            _type = WebImmediateActionText;
+            return defaultTextController;
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return nil;
</span><span class="lines">@@ -277,6 +289,71 @@
</span><span class="cx">     return menuItems.lastObject;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#pragma mark Text action
+
+static DictionaryPopupInfo dictionaryPopupInfoForRange(Frame* frame, Range&amp; range, NSDictionary *options, TextIndicatorPresentationTransition presentationTransition)
+{
+    DictionaryPopupInfo popupInfo;
+    if (range.text().stripWhiteSpace().isEmpty())
+        return popupInfo;
+    
+    RenderObject* renderer = range.startContainer()-&gt;renderer();
+    const RenderStyle&amp; style = renderer-&gt;style();
+
+    Vector&lt;FloatQuad&gt; quads;
+    range.textQuads(quads);
+    if (quads.isEmpty())
+        return popupInfo;
+
+    IntRect rangeRect = frame-&gt;view()-&gt;contentsToWindow(quads[0].enclosingBoundingBox());
+
+    popupInfo.origin = NSMakePoint(rangeRect.x(), rangeRect.y() + (style.fontMetrics().descent() * frame-&gt;page()-&gt;pageScaleFactor()));
+    popupInfo.options = options;
+
+    NSAttributedString *nsAttributedString = editingAttributedStringFromRange(range, IncludeImagesInAttributedString::No);
+    RetainPtr&lt;NSMutableAttributedString&gt; scaledNSAttributedString = adoptNS([[NSMutableAttributedString alloc] initWithString:[nsAttributedString string]]);
+    NSFontManager *fontManager = [NSFontManager sharedFontManager];
+
+    [nsAttributedString enumerateAttributesInRange:NSMakeRange(0, [nsAttributedString length]) options:0 usingBlock:^(NSDictionary *attributes, NSRange range, BOOL *stop) {
+        RetainPtr&lt;NSMutableDictionary&gt; scaledAttributes = adoptNS([attributes mutableCopy]);
+
+        NSFont *font = [scaledAttributes objectForKey:NSFontAttributeName];
+        if (font) {
+            font = [fontManager convertFont:font toSize:[font pointSize] * frame-&gt;page()-&gt;pageScaleFactor()];
+            [scaledAttributes setObject:font forKey:NSFontAttributeName];
+        }
+
+        [scaledNSAttributedString addAttributes:scaledAttributes.get() range:range];
+    }];
+
+    popupInfo.attributedString = scaledNSAttributedString.get();
+    popupInfo.textIndicator = TextIndicator::createWithRange(range, presentationTransition);
+    return popupInfo;
+}
+
+- (id&lt;NSImmediateActionAnimationController&gt;)_animationControllerForText
+{
+    if (!getLULookupDefinitionModuleClass())
+        return nil;
+
+    Node* node = _hitTestResult.innerNode();
+    if (!node)
+        return nil;
+
+    Frame* frame = node-&gt;document().frame();
+    if (!frame)
+        return nil;
+
+    NSDictionary *options = nil;
+    RefPtr&lt;Range&gt; dictionaryRange = rangeForDictionaryLookupAtHitTestResult(_hitTestResult, &amp;options);
+
+    DictionaryPopupInfo dictionaryPopupInfo = dictionaryPopupInfoForRange(frame, *dictionaryRange, options, TextIndicatorPresentationTransition::Bounce);
+    if (!dictionaryPopupInfo.attributedString)
+        return nil;
+
+    return [_webView _animationControllerForDictionaryLookupPopupInfo:dictionaryPopupInfo];
+}
+
</ins><span class="cx"> #pragma mark Text Indicator
</span><span class="cx"> 
</span><span class="cx"> - (void)_showTextIndicator
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacWebViewWebUIDelegatePrivateh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h (177351 => 177352)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h        2014-12-16 08:57:40 UTC (rev 177351)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h        2014-12-16 09:01:53 UTC (rev 177352)
</span><span class="lines">@@ -147,7 +147,8 @@
</span><span class="cx"> typedef enum {
</span><span class="cx">     WebImmediateActionNone = 0,
</span><span class="cx">     WebImmediateActionLinkPreview,
</span><del>-    WebImmediateActionDataDetectedItem
</del><ins>+    WebImmediateActionDataDetectedItem,
+    WebImmediateActionText
</ins><span class="cx"> } WebImmediateActionType;
</span><span class="cx"> 
</span><span class="cx"> // Message Sources.
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm (177351 => 177352)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm        2014-12-16 08:57:40 UTC (rev 177351)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm        2014-12-16 09:01:53 UTC (rev 177352)
</span><span class="lines">@@ -8656,6 +8656,33 @@
</span><span class="cx">         [getLULookupDefinitionModuleClass() showDefinitionForTerm:dictionaryPopupInfo.attributedString.get() atLocation:textBaselineOrigin options:dictionaryPopupInfo.options.get()];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+- (id)_animationControllerForDictionaryLookupPopupInfo:(const DictionaryPopupInfo&amp;)dictionaryPopupInfo
+{
+    if (!dictionaryPopupInfo.attributedString)
+        return nil;
+
+    NSPoint textBaselineOrigin = dictionaryPopupInfo.origin;
+
+    // Convert to screen coordinates.
+    textBaselineOrigin = [self.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin;
+
+    if (canLoadLUTermOptionDisableSearchTermIndicator() &amp;&amp; canLoadLUNotificationPopoverWillClose()) {
+        if (!_private-&gt;hasInitializedLookupObserver) {
+            [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_dictionaryLookupPopoverWillClose:) name:getLUNotificationPopoverWillClose() object:nil];
+            _private-&gt;hasInitializedLookupObserver = YES;
+        }
+
+        RetainPtr&lt;NSMutableDictionary&gt; mutableOptions = adoptNS([dictionaryPopupInfo.options mutableCopy]);
+        if (!mutableOptions)
+            mutableOptions = adoptNS([[NSMutableDictionary alloc] init]);
+        [mutableOptions setObject:@YES forKey:getLUTermOptionDisableSearchTermIndicator()];
+        [self _setTextIndicator:dictionaryPopupInfo.textIndicator.get() fadeOut:NO animationCompletionHandler:[] { }];
+        return [getLULookupDefinitionModuleClass() lookupAnimationControllerForTerm:dictionaryPopupInfo.attributedString.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
+    }
+
+    return [getLULookupDefinitionModuleClass() lookupAnimationControllerForTerm:dictionaryPopupInfo.attributedString.get() atLocation:textBaselineOrigin options:dictionaryPopupInfo.options.get()];
+}
+
</ins><span class="cx"> - (void)_dictionaryLookupPopoverWillClose:(NSNotification *)notification
</span><span class="cx"> {
</span><span class="cx">     [self _setTextIndicator:nullptr fadeOut:NO animationCompletionHandler:[] { }];
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacWebViewWebViewInternalh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewInternal.h (177351 => 177352)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewInternal.h        2014-12-16 08:57:40 UTC (rev 177351)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebViewInternal.h        2014-12-16 09:01:53 UTC (rev 177352)
</span><span class="lines">@@ -261,6 +261,7 @@
</span><span class="cx"> - (void)_setTextIndicator:(WebCore::TextIndicator*)textIndicator fadeOut:(BOOL)fadeOut animationCompletionHandler:(std::function&lt;void ()&gt;)completionHandler;
</span><span class="cx"> - (void)_clearTextIndicator;
</span><span class="cx"> - (void)_showDictionaryLookupPopup:(const DictionaryPopupInfo&amp;)dictionaryPopupInfo;
</span><ins>+- (id)_animationControllerForDictionaryLookupPopupInfo:(const DictionaryPopupInfo&amp;)dictionaryPopupInfo;
</ins><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
</span><span class="cx"> - (WebActionMenuController *)_actionMenuController;
</span><span class="cx"> - (WebImmediateActionController *)_immediateActionController;
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/ChangeLog (177351 => 177352)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/ChangeLog        2014-12-16 08:57:40 UTC (rev 177351)
+++ branches/safari-600.3-branch/Source/WebKit2/ChangeLog        2014-12-16 09:01:53 UTC (rev 177352)
</span><span class="lines">@@ -1,5 +1,52 @@
</span><span class="cx"> 2014-12-16  Dana Burkart  &lt;dburkart@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merged r177323. &lt;rdar://problem/19198414&gt;
+
+    2014-12-15  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+            Make lookup an immediate action instead of an action menu item
+            https://bugs.webkit.org/show_bug.cgi?id=139661
+            -and corresponding-
+            rdar://problem/19198414
+
+            Reviewed by Tim Horton.
+
+            New type.
+            * Shared/API/c/WKImmediateActionTypes.h:
+
+            ActionMenuHitTestResult now includes a DictionaryPopupInfo.
+            * Shared/mac/ActionMenuHitTestResult.h:
+            * Shared/mac/ActionMenuHitTestResult.mm:
+            (WebKit::ActionMenuHitTestResult::encode):
+            (WebKit::ActionMenuHitTestResult::decode):
+
+            Remove all lookup menu items.
+            * UIProcess/mac/WKActionMenuController.mm:
+            (-[WKActionMenuController _defaultMenuItemsForText]):
+            (-[WKActionMenuController _defaultMenuItemsForEditableText]):
+            (-[WKActionMenuController _defaultMenuItemsForEditableTextWithSuggestions]):
+            (-[WKActionMenuController _createActionMenuItemForTag:]):
+            (-[WKActionMenuController _lookupText:]): Deleted.
+
+            Set the defaultAnimationController to the lookup-provided animation controller 
+            when appropriate.
+            * UIProcess/mac/WKImmediateActionController.mm:
+            (-[WKImmediateActionController _defaultAnimationController]):
+            (-[WKImmediateActionController _animationControllerForText]):
+
+            Re-factor performDictionaryLookupForRange() so that most of the work is done in a 
+            new function called dictionaryPopupInfoForRange(). This was that code can be used 
+            for both performing a dictionary lookup and just getting the DictionaryPopupInfo 
+            for the ActionMenuHitTest.
+            * WebProcess/WebPage/WebPage.h:
+            * WebProcess/WebPage/mac/WebPageMac.mm:
+            (WebKit::WebPage::dictionaryPopupInfoForRange):
+            (WebKit::WebPage::performDictionaryLookupForRange):
+            (WebKit::WebPage::performActionMenuHitTestAtLocation):
+            (WebKit::WebPage::lookupTextAtLocation):
+
+2014-12-16  Dana Burkart  &lt;dburkart@apple.com&gt;
+
</ins><span class="cx">         Merged r177303. &lt;rdar://problem/19198539&gt;
</span><span class="cx"> 
</span><span class="cx">     2014-12-15  Timothy Horton  &lt;timothy_horton@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2SharedAPIcWKImmediateActionTypesh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKImmediateActionTypes.h (177351 => 177352)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKImmediateActionTypes.h        2014-12-16 08:57:40 UTC (rev 177351)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKImmediateActionTypes.h        2014-12-16 09:01:53 UTC (rev 177352)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx">     kWKImmediateActionNone = 0,
</span><span class="cx">     kWKImmediateActionLinkPreview,
</span><span class="cx">     kWKImmediateActionDataDetectedItem,
</span><ins>+    kWKImmediateActionLookupText,
</ins><span class="cx"> };
</span><span class="cx"> typedef uint32_t _WKImmediateActionType;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2SharedmacActionMenuHitTestResulth"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.h (177351 => 177352)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.h        2014-12-16 08:57:40 UTC (rev 177351)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.h        2014-12-16 09:01:53 UTC (rev 177352)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> #define ActionMenuHitTestResult_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;DataReference.h&quot;
</span><ins>+#include &quot;DictionaryPopupInfo.h&quot;
</ins><span class="cx"> #include &quot;ShareableBitmap.h&quot;
</span><span class="cx"> #include &quot;SharedMemory.h&quot;
</span><span class="cx"> #include &quot;WebHitTestResult.h&quot;
</span><span class="lines">@@ -59,6 +60,8 @@
</span><span class="cx">     WebCore::FloatRect detectedDataBoundingBox;
</span><span class="cx">     RefPtr&lt;WebCore::TextIndicator&gt; detectedDataTextIndicator;
</span><span class="cx">     WebCore::PageOverlay::PageOverlayID detectedDataOriginatingPageOverlay;
</span><ins>+
+    DictionaryPopupInfo dictionaryPopupInfo;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2SharedmacActionMenuHitTestResultmm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.mm (177351 => 177352)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.mm        2014-12-16 08:57:40 UTC (rev 177351)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.mm        2014-12-16 09:01:53 UTC (rev 177352)
</span><span class="lines">@@ -68,6 +68,8 @@
</span><span class="cx">         if (hasTextIndicator)
</span><span class="cx">             encoder &lt;&lt; detectedDataTextIndicator-&gt;data();
</span><span class="cx">     }
</span><ins>+
+    encoder &lt;&lt; dictionaryPopupInfo;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool ActionMenuHitTestResult::decode(IPC::ArgumentDecoder&amp; decoder, ActionMenuHitTestResult&amp; actionMenuHitTestResult)
</span><span class="lines">@@ -130,6 +132,9 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (!decoder.decode(actionMenuHitTestResult.dictionaryPopupInfo))
+        return false;
+
</ins><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx">     
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2UIProcessmacWKActionMenuControllermm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (177351 => 177352)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm        2014-12-16 08:57:40 UTC (rev 177351)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm        2014-12-16 09:01:53 UTC (rev 177352)
</span><span class="lines">@@ -41,7 +41,6 @@
</span><span class="cx"> #import &lt;ImageKit/ImageKit.h&gt;
</span><span class="cx"> #import &lt;WebCore/DataDetectorsSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/LocalizedStrings.h&gt;
</span><del>-#import &lt;WebCore/LookupSPI.h&gt;
</del><span class="cx"> #import &lt;WebCore/NSMenuSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/NSSharingServiceSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/NSSharingServicePickerSPI.h&gt;
</span><span class="lines">@@ -408,20 +407,18 @@
</span><span class="cx"> - (NSArray *)_defaultMenuItemsForText
</span><span class="cx"> {
</span><span class="cx">     RetainPtr&lt;NSMenuItem&gt; copyTextItem = [self _createActionMenuItemForTag:kWKContextActionItemTagCopyText];
</span><del>-    RetainPtr&lt;NSMenuItem&gt; lookupTextItem = [self _createActionMenuItemForTag:kWKContextActionItemTagLookupText];
</del><span class="cx">     RetainPtr&lt;NSMenuItem&gt; pasteItem = [self _createActionMenuItemForTag:kWKContextActionItemTagPaste];
</span><span class="cx">     [pasteItem setEnabled:NO];
</span><span class="cx"> 
</span><del>-    return @[ copyTextItem.get(), lookupTextItem.get(), pasteItem.get() ];
</del><ins>+    return @[ copyTextItem.get(), [NSMenuItem separatorItem], pasteItem.get() ];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSArray *)_defaultMenuItemsForEditableText
</span><span class="cx"> {
</span><span class="cx">     RetainPtr&lt;NSMenuItem&gt; copyTextItem = [self _createActionMenuItemForTag:kWKContextActionItemTagCopyText];
</span><del>-    RetainPtr&lt;NSMenuItem&gt; lookupTextItem = [self _createActionMenuItemForTag:kWKContextActionItemTagLookupText];
</del><span class="cx">     RetainPtr&lt;NSMenuItem&gt; pasteItem = [self _createActionMenuItemForTag:kWKContextActionItemTagPaste];
</span><span class="cx"> 
</span><del>-    return @[ copyTextItem.get(), lookupTextItem.get(), pasteItem.get() ];
</del><ins>+    return @[ copyTextItem.get(), [NSMenuItem separatorItem], pasteItem.get() ];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (NSArray *)_defaultMenuItemsForEditableTextWithSuggestions
</span><span class="lines">@@ -448,13 +445,12 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     RetainPtr&lt;NSMenuItem&gt; copyTextItem = [self _createActionMenuItemForTag:kWKContextActionItemTagCopyText];
</span><del>-    RetainPtr&lt;NSMenuItem&gt; lookupTextItem = [self _createActionMenuItemForTag:kWKContextActionItemTagLookupText];
</del><span class="cx">     RetainPtr&lt;NSMenuItem&gt; pasteItem = [self _createActionMenuItemForTag:kWKContextActionItemTagPaste];
</span><span class="cx">     RetainPtr&lt;NSMenuItem&gt; textSuggestionsItem = [self _createActionMenuItemForTag:kWKContextActionItemTagTextSuggestions];
</span><span class="cx"> 
</span><span class="cx">     [textSuggestionsItem setSubmenu:spellingSubMenu.get()];
</span><span class="cx"> 
</span><del>-    return @[ copyTextItem.get(), lookupTextItem.get(), pasteItem.get(), textSuggestionsItem.get() ];
</del><ins>+    return @[ copyTextItem.get(), [NSMenuItem separatorItem], pasteItem.get(), textSuggestionsItem.get() ];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_copySelection:(id)sender
</span><span class="lines">@@ -467,11 +463,6 @@
</span><span class="cx">     _page-&gt;executeEditCommand(&quot;paste&quot;);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)_lookupText:(id)sender
-{
-    _page-&gt;performDictionaryLookupOfCurrentSelection();
-}
-
</del><span class="cx"> - (void)_changeSelectionToSuggestion:(id)sender
</span><span class="cx"> {
</span><span class="cx">     NSString *selectedCorrection = [sender representedObject];
</span><span class="lines">@@ -627,13 +618,6 @@
</span><span class="cx">         enabled = hitTestResult-&gt;allowsCopy();
</span><span class="cx">         break;
</span><span class="cx"> 
</span><del>-    case kWKContextActionItemTagLookupText:
-        selector = @selector(_lookupText:);
-        title = WEB_UI_STRING_KEY(&quot;Look Up&quot;, &quot;Look Up (action menu item)&quot;, &quot;action menu item&quot;);
-        image = [NSImage imageNamed:@&quot;NSActionMenuLookup&quot;];
-        enabled = getLULookupDefinitionModuleClass() &amp;&amp; hitTestResult-&gt;allowsCopy();
-        break;
-
</del><span class="cx">     case kWKContextActionItemTagPaste:
</span><span class="cx">         selector = @selector(_paste:);
</span><span class="cx">         title = WEB_UI_STRING_KEY(&quot;Paste&quot;, &quot;Paste (action menu item)&quot;, &quot;action menu item&quot;);
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2UIProcessmacWKImmediateActionControllermm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm (177351 => 177352)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm        2014-12-16 08:57:40 UTC (rev 177351)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm        2014-12-16 09:01:53 UTC (rev 177352)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #import &quot;WebProcessProxy.h&quot;
</span><span class="cx"> #import &lt;WebCore/DataDetectorsSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/GeometryUtilities.h&gt;
</span><ins>+#import &lt;WebCore/LookupSPI.h&gt;
</ins><span class="cx"> #import &lt;WebCore/NSMenuSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/QuickLookMacSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/SoftLinking.h&gt;
</span><span class="lines">@@ -44,6 +45,7 @@
</span><span class="cx"> 
</span><span class="cx"> SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, QuickLookUI)
</span><span class="cx"> SOFT_LINK_CLASS(QuickLookUI, QLPreviewMenuItem)
</span><ins>+SOFT_LINK_CONSTANT_MAY_FAIL(Lookup, LUTermOptionDisableSearchTermIndicator, NSString *)
</ins><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> using namespace WebKit;
</span><span class="lines">@@ -235,6 +237,11 @@
</span><span class="cx">             _type = kWKImmediateActionDataDetectedItem;
</span><span class="cx">             return (id&lt;NSImmediateActionAnimationController&gt;)immediateActionItem;
</span><span class="cx">         }
</span><ins>+
+        if (id&lt;NSImmediateActionAnimationController&gt; textAnimationController = [self _animationControllerForText]) {
+            _type = kWKImmediateActionLookupText;
+            return textAnimationController;
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return nil;
</span><span class="lines">@@ -485,6 +492,34 @@
</span><span class="cx">     return menuItems.lastObject;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#pragma mark Text action
+
+- (id&lt;NSImmediateActionAnimationController&gt;)_animationControllerForText
+{
+    if (_state != ImmediateActionState::Ready)
+        return nil;
+
+    if (!getLULookupDefinitionModuleClass())
+        return nil;
+
+    DictionaryPopupInfo dictionaryPopupInfo = _hitTestResult.dictionaryPopupInfo;
+    if (!dictionaryPopupInfo.attributedString.string)
+        return nil;
+
+    // Convert baseline to screen coordinates.
+    NSPoint textBaselineOrigin = dictionaryPopupInfo.origin;
+    textBaselineOrigin = [_wkView convertPoint:textBaselineOrigin toView:nil];
+    textBaselineOrigin = [_wkView.window convertRectToScreen:NSMakeRect(textBaselineOrigin.x, textBaselineOrigin.y, 0, 0)].origin;
+
+    RetainPtr&lt;NSMutableDictionary&gt; mutableOptions = adoptNS([(NSDictionary *)dictionaryPopupInfo.options.get() mutableCopy]);
+    if (canLoadLUTermOptionDisableSearchTermIndicator() &amp;&amp; dictionaryPopupInfo.textIndicator.contentImage) {
+        [_wkView _setTextIndicator:TextIndicator::create(dictionaryPopupInfo.textIndicator) fadeOut:NO animationCompletionHandler:[]{ }];
+        [mutableOptions setObject:@YES forKey:getLUTermOptionDisableSearchTermIndicator()];
+        return [getLULookupDefinitionModuleClass() lookupAnimationControllerForTerm:dictionaryPopupInfo.attributedString.string.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
+    }
+    return [getLULookupDefinitionModuleClass() lookupAnimationControllerForTerm:dictionaryPopupInfo.attributedString.string.get() atLocation:textBaselineOrigin options:mutableOptions.get()];
+}
+
</ins><span class="cx"> @end
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(MAC)
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h (177351 => 177352)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-12-16 08:57:40 UTC (rev 177351)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-12-16 09:01:53 UTC (rev 177352)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include &quot;APIInjectedBundleFormClient.h&quot;
</span><span class="cx"> #include &quot;APIInjectedBundlePageUIClient.h&quot;
</span><span class="cx"> #include &quot;APIObject.h&quot;
</span><ins>+#include &quot;DictionaryPopupInfo.h&quot;
</ins><span class="cx"> #include &quot;FindController.h&quot;
</span><span class="cx"> #include &quot;GeolocationPermissionRequestManager.h&quot;
</span><span class="cx"> #include &quot;ImageOptions.h&quot;
</span><span class="lines">@@ -970,6 +971,7 @@
</span><span class="cx">     void performDictionaryLookupAtLocation(const WebCore::FloatPoint&amp;);
</span><span class="cx">     void performDictionaryLookupOfCurrentSelection();
</span><span class="cx">     void performDictionaryLookupForRange(WebCore::Frame*, WebCore::Range&amp;, NSDictionary *options, WebCore::TextIndicatorPresentationTransition);
</span><ins>+    DictionaryPopupInfo dictionaryPopupInfoForRange(WebCore::Frame* frame, WebCore::Range&amp; range, NSDictionary **options, WebCore::TextIndicatorPresentationTransition presentationTransition);
</ins><span class="cx"> 
</span><span class="cx">     void windowAndViewFramesChanged(const WebCore::FloatRect&amp; windowFrameInScreenCoordinates, const WebCore::FloatRect&amp; windowFrameInUnflippedScreenCoordinates, const WebCore::FloatRect&amp; viewFrameInWindowCoordinates, const WebCore::FloatPoint&amp; accessibilityViewCoordinates);
</span><span class="cx"> 
</span><span class="lines">@@ -1044,7 +1046,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     void performActionMenuHitTestAtLocation(WebCore::FloatPoint);
</span><del>-    PassRefPtr&lt;WebCore::Range&gt; lookupTextAtLocation(WebCore::FloatPoint);
</del><ins>+    PassRefPtr&lt;WebCore::Range&gt; lookupTextAtLocation(WebCore::FloatPoint, NSDictionary **options);
</ins><span class="cx">     void selectLastActionMenuRange();
</span><span class="cx">     void focusAndSelectLastActionMenuHitTestResult();
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2WebProcessWebPagemacWebPageMacmm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (177351 => 177352)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2014-12-16 08:57:40 UTC (rev 177351)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2014-12-16 09:01:53 UTC (rev 177352)
</span><span class="lines">@@ -506,10 +506,11 @@
</span><span class="cx">     performDictionaryLookupForSelection(frame, frame-&gt;selection().selection(), TextIndicatorPresentationTransition::BounceAndCrossfade);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::performDictionaryLookupForRange(Frame* frame, Range&amp; range, NSDictionary *options, TextIndicatorPresentationTransition presentationTransition)
</del><ins>+DictionaryPopupInfo WebPage::dictionaryPopupInfoForRange(Frame* frame, Range&amp; range, NSDictionary **options, TextIndicatorPresentationTransition presentationTransition)
</ins><span class="cx"> {
</span><ins>+    DictionaryPopupInfo dictionaryPopupInfo;
</ins><span class="cx">     if (range.text().stripWhiteSpace().isEmpty())
</span><del>-        return;
</del><ins>+        return dictionaryPopupInfo;
</ins><span class="cx">     
</span><span class="cx">     RenderObject* renderer = range.startContainer()-&gt;renderer();
</span><span class="cx">     const RenderStyle&amp; style = renderer-&gt;style();
</span><span class="lines">@@ -517,13 +518,12 @@
</span><span class="cx">     Vector&lt;FloatQuad&gt; quads;
</span><span class="cx">     range.textQuads(quads);
</span><span class="cx">     if (quads.isEmpty())
</span><del>-        return;
</del><ins>+        return dictionaryPopupInfo;
</ins><span class="cx"> 
</span><span class="cx">     IntRect rangeRect = frame-&gt;view()-&gt;contentsToWindow(quads[0].enclosingBoundingBox());
</span><span class="cx"> 
</span><del>-    DictionaryPopupInfo dictionaryPopupInfo;
</del><span class="cx">     dictionaryPopupInfo.origin = FloatPoint(rangeRect.x(), rangeRect.y() + (style.fontMetrics().ascent() * pageScaleFactor()));
</span><del>-    dictionaryPopupInfo.options = (CFDictionaryRef)options;
</del><ins>+    dictionaryPopupInfo.options = (CFDictionaryRef)*options;
</ins><span class="cx"> 
</span><span class="cx">     NSAttributedString *nsAttributedString = editingAttributedStringFromRange(range, IncludeImagesInAttributedString::No);
</span><span class="cx"> 
</span><span class="lines">@@ -545,11 +545,17 @@
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;TextIndicator&gt; textIndicator = TextIndicator::createWithRange(range, presentationTransition);
</span><span class="cx">     if (!textIndicator)
</span><del>-        return;
</del><ins>+        return dictionaryPopupInfo;
</ins><span class="cx"> 
</span><span class="cx">     dictionaryPopupInfo.textIndicator = textIndicator-&gt;data();
</span><span class="cx">     dictionaryPopupInfo.attributedString.string = scaledNSAttributedString;
</span><span class="cx"> 
</span><ins>+    return dictionaryPopupInfo;
+}
+
+void WebPage::performDictionaryLookupForRange(Frame* frame, Range&amp; range, NSDictionary *options, TextIndicatorPresentationTransition presentationTransition)
+{
+    DictionaryPopupInfo dictionaryPopupInfo = dictionaryPopupInfoForRange(frame, range, &amp;options, presentationTransition);
</ins><span class="cx">     send(Messages::WebPageProxy::DidPerformDictionaryLookup(dictionaryPopupInfo));
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -984,8 +990,16 @@
</span><span class="cx">     actionMenuResult.hitTestLocationInViewCooordinates = locationInViewCooordinates;
</span><span class="cx">     actionMenuResult.hitTestResult = WebHitTestResult::Data(hitTestResult);
</span><span class="cx"> 
</span><del>-    RefPtr&lt;WebCore::Range&gt; lookupRange = lookupTextAtLocation(locationInViewCooordinates);
</del><ins>+    NSDictionary *options = nil;
+    RefPtr&lt;WebCore::Range&gt; lookupRange = lookupTextAtLocation(locationInViewCooordinates, &amp;options);
</ins><span class="cx">     actionMenuResult.lookupText = lookupRange ? lookupRange-&gt;text() : String();
</span><ins>+    if (lookupRange) {
+        if (Node* node = hitTestResult.innerNode()) {
+            if (Frame* hitTestResultFrame = node-&gt;document().frame())
+                actionMenuResult.dictionaryPopupInfo = dictionaryPopupInfoForRange(hitTestResultFrame, *lookupRange.get(), &amp;options, TextIndicatorPresentationTransition::Bounce);
+        }
+    }
+
</ins><span class="cx">     m_lastActionMenuRangeForSelection = lookupRange;
</span><span class="cx">     m_lastActionMenuHitTestResult = hitTestResult;
</span><span class="cx"> 
</span><span class="lines">@@ -1047,7 +1061,7 @@
</span><span class="cx">     send(Messages::WebPageProxy::DidPerformActionMenuHitTest(actionMenuResult, InjectedBundleUserMessageEncoder(userData.get())));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;WebCore::Range&gt; WebPage::lookupTextAtLocation(FloatPoint locationInViewCooordinates)
</del><ins>+PassRefPtr&lt;WebCore::Range&gt; WebPage::lookupTextAtLocation(FloatPoint locationInViewCooordinates, NSDictionary **options)
</ins><span class="cx"> {
</span><span class="cx">     MainFrame&amp; mainFrame = corePage()-&gt;mainFrame();
</span><span class="cx">     if (!mainFrame.view() || !mainFrame.view()-&gt;renderView())
</span><span class="lines">@@ -1055,8 +1069,7 @@
</span><span class="cx"> 
</span><span class="cx">     IntPoint point = roundedIntPoint(locationInViewCooordinates);
</span><span class="cx">     HitTestResult result = mainFrame.eventHandler().hitTestResultAtPoint(m_page-&gt;mainFrame().view()-&gt;windowToContents(point));
</span><del>-    NSDictionary *options = nil;
-    return rangeForDictionaryLookupAtHitTestResult(result, &amp;options);
</del><ins>+    return rangeForDictionaryLookupAtHitTestResult(result, options);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebPage::selectLastActionMenuRange()
</span></span></pre>
</div>
</div>

</body>
</html>