<!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>[175340] branches/safari-600.3-branch</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/175340">175340</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2014-10-29 13:26:40 -0700 (Wed, 29 Oct 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merge <a href="http://trac.webkit.org/projects/webkit/changeset/175335">r175335</a>. rdar://problem/18709436</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6003branchSourceWebCoreChangeLog">branches/safari-600.3-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6003branchSourceWebCoreWebCoreexpin">branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in</a></li>
<li><a href="#branchessafari6003branchSourceWebCoreWebCorexcodeprojprojectpbxproj">branches/safari-600.3-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2ChangeLog">branches/safari-600.3-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2SharedAPIcWKActionMenuTypesh">branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKActionMenuTypes.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2SharedWebHitTestResultcpp">branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.cpp</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2SharedWebHitTestResulth">branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2SharedmacActionMenuHitTestResulth">branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2UIProcessAPImacWKViewmm">branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2UIProcessmacWKActionMenuControllerh">branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2UIProcessmacWKActionMenuControllermm">branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2WebKit2xcodeprojprojectpbxproj">branches/safari-600.3-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2WebProcessWebPageWebPagecpp">branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2WebProcessWebPagemacWebPageMacmm">branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm</a></li>
<li><a href="#branchessafari6003branchWebKitLibrariesChangeLog">branches/safari-600.3-branch/WebKitLibraries/ChangeLog</a></li>
<li><a href="#branchessafari6003branchWebKitLibrariesWebKitSystemInterfaceh">branches/safari-600.3-branch/WebKitLibraries/WebKitSystemInterface.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#branchessafari6003branchSourceWebCoreplatformspimacDataDetectorsSPIh">branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2SharedmacActionMenuHitTestResultmm">branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.mm</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#branchessafari6003branchSourceWebKit2SharedmacActionMenuHitTestResultcpp">branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.cpp</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 (175339 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/ChangeLog        2014-10-29 20:24:13 UTC (rev 175339)
+++ branches/safari-600.3-branch/Source/WebCore/ChangeLog        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2014-08-29  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r175335. rdar://problem/18709436
+
+    2014-10-29  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
+            Implement action menus for data detected items
+            https://bugs.webkit.org/show_bug.cgi?id=138178
+            &lt;rdar://problem/18709436&gt;
+
+            Reviewed by Anders Carlsson.
+
+            * WebCore.exp.in:
+            Export a symbol from Position that we need.
+
+            * WebCore.xcodeproj/project.pbxproj:
+            * platform/spi/mac/DataDetectorsSPI.h:
+            Add a combined SPI header for all of the random bits of DataDetectors that we use.
+
</ins><span class="cx"> 2014-10-29  Lucas Forschler  &lt;lforschler@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r175147
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in (175339 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in        2014-10-29 20:24:13 UTC (rev 175339)
+++ branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -1334,6 +1334,7 @@
</span><span class="cx"> __ZN7WebCore8Gradient12addColorStopEfRKNS_5ColorE
</span><span class="cx"> __ZN7WebCore8GradientC1ERKNS_10FloatPointES3_
</span><span class="cx"> __ZN7WebCore8GradientD1Ev
</span><ins>+__ZN7WebCore8PositionC1EN3WTF10PassRefPtrINS_4NodeEEENS0_19LegacyEditingOffsetE
</ins><span class="cx"> __ZN7WebCore8PositionC1EN3WTF10PassRefPtrINS_4NodeEEEiNS0_10AnchorTypeE
</span><span class="cx"> __ZN7WebCore8Settings13gQTKitEnabledE
</span><span class="cx"> __ZN7WebCore8Settings14setJavaEnabledEb
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj (175339 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-10-29 20:24:13 UTC (rev 175339)
+++ branches/safari-600.3-branch/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -1089,6 +1089,7 @@
</span><span class="cx">                 2D481F02146B5C5500AA7834 /* CrossfadeGeneratedImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D2FC0551460CD6F00263633 /* CrossfadeGeneratedImage.h */; };
</span><span class="cx">                 2D481F03146B5C6500AA7834 /* GradientImage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D2FC0561460CD6F00263633 /* GradientImage.cpp */; };
</span><span class="cx">                 2D481F04146B5C6B00AA7834 /* GradientImage.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D2FC0571460CD6F00263633 /* GradientImage.h */; };
</span><ins>+                2D59F1BF1A0044C6001F3D29 /* DataDetectorsSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D59F1BE1A0044C6001F3D29 /* DataDetectorsSPI.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 2D5A592F152525230036EE51 /* ImageOrientation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8748D7412CC3F89001FBA41 /* ImageOrientation.cpp */; };
</span><span class="cx">                 2D5A5931152525D00036EE51 /* ImageOrientation.h in Headers */ = {isa = PBXBuildFile; fileRef = A8748D6612CC3763001FBA41 /* ImageOrientation.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 2D5BC42716F882EE007048D0 /* SecurityPolicyViolationEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D5BC42516F882BE007048D0 /* SecurityPolicyViolationEvent.h */; };
</span><span class="lines">@@ -8103,6 +8104,7 @@
</span><span class="cx">                 2D3EF4471917915C00034184 /* WebCoreCALayerExtras.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebCoreCALayerExtras.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D46F04D17B96FBD005647F0 /* IntPoint.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntPoint.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D46F04F17B96FD2005647F0 /* IntSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IntSize.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                2D59F1BE1A0044C6001F3D29 /* DataDetectorsSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataDetectorsSPI.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 2D5BC42516F882BE007048D0 /* SecurityPolicyViolationEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecurityPolicyViolationEvent.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D5BC42616F882BE007048D0 /* SecurityPolicyViolationEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SecurityPolicyViolationEvent.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D5C9CFB19C7B52E00B3C5C1 /* PageOverlay.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageOverlay.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -17618,6 +17620,7 @@
</span><span class="cx">                 9348428019F1A9190009D5AE /* mac */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><ins>+                                2D59F1BE1A0044C6001F3D29 /* DataDetectorsSPI.h */,
</ins><span class="cx">                                 2DCB837719F99BBA00A7FBE4 /* NSSharingServicePickerSPI.h */,
</span><span class="cx">                                 2DCB837819F99BBA00A7FBE4 /* NSSharingServiceSPI.h */,
</span><span class="cx">                                 9348428119F1A9190009D5AE /* NSViewSPI.h */,
</span><span class="lines">@@ -24136,6 +24139,7 @@
</span><span class="cx">                                 8538F05B0AD722F1006A81D1 /* DOMRange.h in Headers */,
</span><span class="cx">                                 851EE8210ABCA58100A6AA33 /* DOMRangeException.h in Headers */,
</span><span class="cx">                                 8538F05D0AD722F1006A81D1 /* DOMRangeInternal.h in Headers */,
</span><ins>+                                2D59F1BF1A0044C6001F3D29 /* DataDetectorsSPI.h in Headers */,
</ins><span class="cx">                                 8538F0850AD72CB6006A81D1 /* DOMRanges.h in Headers */,
</span><span class="cx">                                 858C38A70AA8F20400B187A4 /* DOMRect.h in Headers */,
</span><span class="cx">                                 85E711D60AC5D5350053270F /* DOMRectInternal.h in Headers */,
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCoreplatformspimacDataDetectorsSPIhfromrev175335trunkSourceWebCoreplatformspimacDataDetectorsSPIh"></a>
<div class="copfile"><h4>Copied: branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h (from rev 175335, trunk/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h) (0 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h                                (rev 0)
+++ branches/safari-600.3-branch/Source/WebCore/platform/spi/mac/DataDetectorsSPI.h        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -0,0 +1,77 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;SoftLinking.h&quot;
+#import &lt;objc/runtime.h&gt;
+
+typedef struct __DDScanner DDScanner, *DDScannerRef;
+typedef struct __DDScanQuery *DDScanQueryRef;
+typedef struct __DDResult *DDResultRef;
+
+typedef enum {
+    DDScannerTypeStandard = 0,
+} DDScannerType;
+
+enum {
+    DDScannerOptionStopAtFirstMatch = 1,
+};
+typedef CFIndex DDScannerOptions;
+
+enum {
+    DDScannerCopyResultsOptionsNone = 0,
+    DDScannerCopyResultsOptionsNoOverlap = 1 &lt;&lt; 0,
+};
+typedef CFIndex DDScannerCopyResultsOptions;
+
+SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(DataDetectors)
+SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(DataDetectorsCore)
+
+extern &quot;C&quot; {
+
+SOFT_LINK(DataDetectorsCore, DDScannerCreate, DDScannerRef, (DDScannerType type, DDScannerOptions options, CFErrorRef* errorRef), (type, options, errorRef))
+SOFT_LINK(DataDetectorsCore, DDScanQueryCreateFromString, DDScanQueryRef, (CFAllocatorRef allocator, CFStringRef string, CFRange range), (allocator, string, range))
+SOFT_LINK(DataDetectorsCore, DDScannerScanQuery, DDScanQueryRef, (DDScannerRef scanner, DDScanQueryRef query), (scanner, query))
+SOFT_LINK(DataDetectorsCore, DDScannerCopyResultsWithOptions, CFArrayRef, (DDScannerRef scanner, DDScannerCopyResultsOptions options), (scanner, options))
+SOFT_LINK(DataDetectorsCore, DDResultGetRange, CFRange, (DDResultRef result), (result))
+
+}
+
+SOFT_LINK_CLASS(DataDetectors, DDActionContext)
+SOFT_LINK_CLASS(DataDetectors, DDActionsManager)
+
+@interface DDActionContext : NSObject &lt;NSCopying, NSSecureCoding&gt;
+
+@property NSRect highlightFrame;
+@property (retain) NSArray *allResults;
+@property (retain) __attribute__((NSObject)) DDResultRef mainResult;
+
+@end
+
+@interface DDActionsManager : NSObject
+
++ (DDActionsManager *)sharedManager;
+- (NSArray *)menuItemsForResult:(DDResultRef)result actionContext:(DDActionContext *)context;
+
+@end
</ins></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/ChangeLog (175339 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/ChangeLog        2014-10-29 20:24:13 UTC (rev 175339)
+++ branches/safari-600.3-branch/Source/WebKit2/ChangeLog        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -1,3 +1,77 @@
</span><ins>+2014-08-29  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r175335. rdar://problem/18709436
+
+    2014-10-29  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
+            Implement action menus for data detected items
+            https://bugs.webkit.org/show_bug.cgi?id=138178
+            &lt;rdar://problem/18709436&gt;
+
+            Reviewed by Anders Carlsson.
+
+            * Shared/API/c/WKActionMenuTypes.h:
+            Add a new type.
+
+            * Shared/WebHitTestResult.cpp:
+            (WebKit::WebHitTestResult::Data::Data):
+            (WebKit::WebHitTestResult::Data::encode):
+            (WebKit::WebHitTestResult::Data::decode):
+            * Shared/WebHitTestResult.h:
+            (WebKit::WebHitTestResult::isTextNode):
+            Determine, store, encode, and decode whether or not the hit node is a text node.
+
+            * Shared/mac/ActionMenuHitTestResult.h:
+            * Shared/mac/ActionMenuHitTestResult.mm: Renamed from Source/WebKit2/Shared/mac/ActionMenuHitTestResult.cpp.
+            (WebKit::ActionMenuHitTestResult::encode):
+            (WebKit::ActionMenuHitTestResult::decode):
+            Make ActionMenuHitTestResult an Obj-C++ file.
+            Store, encode, and decode (securely!) a DDActionContext and FloatRect
+            representing the bounding box of the data detected item, if any.
+
+            * UIProcess/API/mac/WKView.mm:
+            (-[WKView initWithFrame:context:configuration:webView:]):
+            (-[WKView willOpenMenu:withEvent:]): Deleted.
+            Stop using willOpenMenu; we'll use NSMenuDelegate's menuNeedsUpdate: instead.
+            Hook up WKActionMenuController as our action menu's delegate.
+
+            * UIProcess/mac/WKActionMenuController.mm:
+            (-[WKActionMenuController prepareForMenu:withEvent:]):
+            Call _updateActionMenuItems *after* we've adjusted _state, so that it
+            can depend on the value being correct.
+
+            (-[WKActionMenuController willOpenMenu:withEvent:]):
+            (-[WKActionMenuController didPerformActionMenuHitTest:]):
+            Move menu updating to menuNeedsUpdate for more accurate timing.
+
+            (_updateActionMenuItems):
+            When building the menu, if we have a text node that is not a link,
+            and hit a data detected item, retrieve the menu from the DDActionContext.
+            If we have nothing, make sure to reset _type, and if the final hit-test
+            is still pending, build a menu with a dummy item.
+
+            * WebKit2.xcodeproj/project.pbxproj:
+            * WebProcess/WebPage/WebPage.cpp:
+            (WebKit::WebPage::performActionMenuHitTestAtLocation): Moved to WebPageMac.
+            * WebProcess/WebPage/mac/WebPageMac.mm:
+            (WebKit::rangeExpandedAroundPosition):
+            Factor this out of performDictionaryLookupAtLocation.
+
+            (WebKit::WebPage::performDictionaryLookupAtLocation):
+            Make use of rangeExpandedAroundPosition.
+
+            (WebKit::scanForDataDetectedItems):
+            Expand to four lines of context around the hit point.
+            Convert that range to plain text, and feed it to DataDetectors.
+            Find the result that intersects the hit point, and make a DDActionContext
+            for it. Also, store the bounding box of the first quad of the detected
+            text, to provide to Data Detectors as a hint for UI placement.
+
+            (WebKit::WebPage::performActionMenuHitTestAtLocation):
+            If the hit node is a text node, call scanForDataDetectedItems and
+            store the resultant DDActionContext and bounding rect on our
+            ActionMenuHitTestResult for transfer to the UI process.
+
</ins><span class="cx"> 2014-10-29  Lucas Forschler  &lt;lforschler@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r175256
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2SharedAPIcWKActionMenuTypesh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKActionMenuTypes.h (175339 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKActionMenuTypes.h        2014-10-29 20:24:13 UTC (rev 175339)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/API/c/WKActionMenuTypes.h        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -35,7 +35,8 @@
</span><span class="cx"> enum {
</span><span class="cx">     kWKActionMenuNone = 0,
</span><span class="cx">     kWKActionMenuLink,
</span><del>-    kWKActionMenuImage
</del><ins>+    kWKActionMenuImage,
+    kWKActionMenuDataDetectedItem
</ins><span class="cx"> };
</span><span class="cx"> typedef uint32_t _WKActionMenuType;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2SharedWebHitTestResultcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.cpp (175339 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.cpp        2014-10-29 20:24:13 UTC (rev 175339)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.cpp        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -52,6 +52,7 @@
</span><span class="cx">     , isContentEditable(hitTestResult.isContentEditable())
</span><span class="cx">     , elementBoundingBox(elementBoundingBoxInWindowCoordinates(hitTestResult))
</span><span class="cx">     , isScrollbar(hitTestResult.scrollbar())
</span><ins>+    , isTextNode(hitTestResult.innerNode() &amp;&amp; hitTestResult.innerNode()-&gt;isTextNode())
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -70,6 +71,7 @@
</span><span class="cx">     encoder &lt;&lt; isContentEditable;
</span><span class="cx">     encoder &lt;&lt; elementBoundingBox;
</span><span class="cx">     encoder &lt;&lt; isScrollbar;
</span><ins>+    encoder &lt;&lt; isTextNode;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool WebHitTestResult::Data::decode(IPC::ArgumentDecoder&amp; decoder, WebHitTestResult::Data&amp; hitTestResultData)
</span><span class="lines">@@ -82,7 +84,8 @@
</span><span class="cx">         || !decoder.decode(hitTestResultData.linkTitle)
</span><span class="cx">         || !decoder.decode(hitTestResultData.isContentEditable)
</span><span class="cx">         || !decoder.decode(hitTestResultData.elementBoundingBox)
</span><del>-        || !decoder.decode(hitTestResultData.isScrollbar))
</del><ins>+        || !decoder.decode(hitTestResultData.isScrollbar)
+        || !decoder.decode(hitTestResultData.isTextNode))
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     return true;
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2SharedWebHitTestResulth"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.h (175339 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.h        2014-10-29 20:24:13 UTC (rev 175339)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.h        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -52,6 +52,7 @@
</span><span class="cx">         bool isContentEditable;
</span><span class="cx">         WebCore::IntRect elementBoundingBox;
</span><span class="cx">         bool isScrollbar;
</span><ins>+        bool isTextNode;
</ins><span class="cx"> 
</span><span class="cx">         Data();
</span><span class="cx">         explicit Data(const WebCore::HitTestResult&amp;);
</span><span class="lines">@@ -79,6 +80,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool isScrollbar() const { return m_data.isScrollbar; }
</span><span class="cx"> 
</span><ins>+    bool isTextNode() const { return m_data.isTextNode; }
+
</ins><span class="cx"> private:
</span><span class="cx">     explicit WebHitTestResult(const WebHitTestResult::Data&amp; hitTestResultData)
</span><span class="cx">         : m_data(hitTestResultData)
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2SharedmacActionMenuHitTestResultcpp"></a>
<div class="delfile"><h4>Deleted: branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.cpp (175339 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.cpp        2014-10-29 20:24:13 UTC (rev 175339)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.cpp        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -1,57 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;ActionMenuHitTestResult.h&quot;
-
-#include &quot;ArgumentDecoder.h&quot;
-#include &quot;ArgumentEncoder.h&quot;
-
-namespace WebKit {
-
-void ActionMenuHitTestResult::encode(IPC::ArgumentEncoder&amp; encoder) const
-{
-    ShareableBitmap::Handle handle;
-
-    // FIXME: We should consider sharing the raw original resource data so that metadata and whatnot are preserved.
-    if (image)
-        image-&gt;createHandle(handle, SharedMemory::ReadOnly);
-
-    encoder &lt;&lt; handle;
-}
-
-bool ActionMenuHitTestResult::decode(IPC::ArgumentDecoder&amp; decoder, ActionMenuHitTestResult&amp; actionMenuHitTestResult)
-{
-    ShareableBitmap::Handle handle;
-    if (!decoder.decode(handle))
-        return false;
-
-    if (!handle.isNull())
-        actionMenuHitTestResult.image = ShareableBitmap::create(handle, SharedMemory::ReadOnly);
-
-    return true;
-}
-    
-} // namespace WebKit
</del></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2SharedmacActionMenuHitTestResulth"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.h (175339 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.h        2014-10-29 20:24:13 UTC (rev 175339)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.h        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -27,7 +27,10 @@
</span><span class="cx"> #define ActionMenuHitTestResult_h
</span><span class="cx"> 
</span><span class="cx"> #include &quot;ShareableBitmap.h&quot;
</span><ins>+#include &lt;WebCore/FloatRect.h&gt;
</ins><span class="cx"> 
</span><ins>+OBJC_CLASS DDActionContext;
+
</ins><span class="cx"> namespace IPC {
</span><span class="cx"> class ArgumentDecoder;
</span><span class="cx"> class ArgumentEncoder;
</span><span class="lines">@@ -40,6 +43,9 @@
</span><span class="cx">     static bool decode(IPC::ArgumentDecoder&amp;, ActionMenuHitTestResult&amp;);
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;ShareableBitmap&gt; image;
</span><ins>+
+    RetainPtr&lt;DDActionContext&gt; actionContext;
+    WebCore::FloatRect actionBoundingBox;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2SharedmacActionMenuHitTestResultmmfromrev175335trunkSourceWebKit2SharedmacActionMenuHitTestResultmm"></a>
<div class="copfile"><h4>Copied: branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.mm (from rev 175335, trunk/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.mm) (0 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.mm                                (rev 0)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/mac/ActionMenuHitTestResult.mm        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -0,0 +1,98 @@
</span><ins>+/*
+ * Copyright (C) 2014 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import &quot;config.h&quot;
+#import &quot;ActionMenuHitTestResult.h&quot;
+
+#import &quot;ArgumentCodersCF.h&quot;
+#import &quot;ArgumentDecoder.h&quot;
+#import &quot;ArgumentEncoder.h&quot;
+#import &quot;WebCoreArgumentCoders.h&quot;
+#import &lt;WebCore/DataDetectorsSPI.h&gt;
+
+namespace WebKit {
+
+void ActionMenuHitTestResult::encode(IPC::ArgumentEncoder&amp; encoder) const
+{
+    ShareableBitmap::Handle handle;
+
+    // FIXME: We should consider sharing the raw original resource data so that metadata and whatnot are preserved.
+    if (image)
+        image-&gt;createHandle(handle, SharedMemory::ReadOnly);
+
+    encoder &lt;&lt; handle;
+
+    bool hasActionContext = actionContext;
+    encoder &lt;&lt; hasActionContext;
+    if (hasActionContext) {
+        RetainPtr&lt;NSMutableData&gt; data = adoptNS([[NSMutableData alloc] init]);
+        RetainPtr&lt;NSKeyedArchiver&gt; archiver = adoptNS([[NSKeyedArchiver alloc] initForWritingWithMutableData:data.get()]);
+        [archiver setRequiresSecureCoding:YES];
+        [archiver encodeObject:actionContext.get() forKey:@&quot;actionContext&quot;];
+        [archiver finishEncoding];
+
+        IPC::encode(encoder, reinterpret_cast&lt;CFDataRef&gt;(data.get()));
+    }
+
+    encoder &lt;&lt; actionBoundingBox;
+}
+
+bool ActionMenuHitTestResult::decode(IPC::ArgumentDecoder&amp; decoder, ActionMenuHitTestResult&amp; actionMenuHitTestResult)
+{
+    ShareableBitmap::Handle handle;
+    if (!decoder.decode(handle))
+        return false;
+
+    if (!handle.isNull())
+        actionMenuHitTestResult.image = ShareableBitmap::create(handle, SharedMemory::ReadOnly);
+
+    bool hasActionContext;
+    if (!decoder.decode(hasActionContext))
+        return false;
+
+    if (hasActionContext) {
+        RetainPtr&lt;CFDataRef&gt; data;
+        if (!IPC::decode(decoder, data))
+            return false;
+
+        RetainPtr&lt;NSKeyedUnarchiver&gt; unarchiver = adoptNS([[NSKeyedUnarchiver alloc] initForReadingWithData:(NSData *)data.get()]);
+        [unarchiver setRequiresSecureCoding:YES];
+        @try {
+            actionMenuHitTestResult.actionContext = [unarchiver decodeObjectOfClass:getDDActionContextClass() forKey:@&quot;actionContext&quot;];
+        } @catch (NSException *exception) {
+            LOG_ERROR(&quot;Failed to decode DDActionContext: %@&quot;, exception);
+            return false;
+        }
+        
+        [unarchiver finishDecoding];
+    }
+
+    if (!decoder.decode(actionMenuHitTestResult.actionBoundingBox))
+        return false;
+
+    return true;
+}
+    
+} // namespace WebKit
</ins></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm (175339 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-10-29 20:24:13 UTC (rev 175339)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -3538,6 +3538,7 @@
</span><span class="cx">         RetainPtr&lt;NSMenu&gt; menu = adoptNS([[NSMenu alloc] init]);
</span><span class="cx">         self.actionMenu = menu.get();
</span><span class="cx">         _data-&gt;_actionMenuController = adoptNS([[WKActionMenuController alloc] initWithPage:*_data-&gt;_page view:self]);
</span><ins>+        self.actionMenu.delegate = _data-&gt;_actionMenuController.get();
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return self;
</span><span class="lines">@@ -3642,11 +3643,6 @@
</span><span class="cx">     [_data-&gt;_actionMenuController prepareForMenu:menu withEvent:event];
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event
-{
-    [_data-&gt;_actionMenuController willOpenMenu:menu withEvent:event];
-}
-
</del><span class="cx"> - (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event
</span><span class="cx"> {
</span><span class="cx">     [_data-&gt;_actionMenuController didCloseMenu:menu withEvent:event];
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2UIProcessmacWKActionMenuControllerh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.h (175339 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.h        2014-10-29 20:24:13 UTC (rev 175339)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.h        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx"> 
</span><span class="cx"> @class WKView;
</span><span class="cx"> 
</span><del>-@interface WKActionMenuController : NSObject {
</del><ins>+@interface WKActionMenuController : NSObject &lt;NSMenuDelegate&gt; {
</ins><span class="cx"> @private
</span><span class="cx">     WebKit::WebPageProxy *_page;
</span><span class="cx">     WKView *_wkView;
</span><span class="lines">@@ -59,7 +59,6 @@
</span><span class="cx"> - (void)willDestroyView:(WKView *)view;
</span><span class="cx"> 
</span><span class="cx"> - (void)prepareForMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
</span><del>-- (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
</del><span class="cx"> - (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event;
</span><span class="cx"> 
</span><span class="cx"> - (void)didPerformActionMenuHitTest:(const WebKit::ActionMenuHitTestResult&amp;)hitTestResult;
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2UIProcessmacWKActionMenuControllermm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (175339 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm        2014-10-29 20:24:13 UTC (rev 175339)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -31,12 +31,15 @@
</span><span class="cx"> #import &quot;WKNSURLExtras.h&quot;
</span><span class="cx"> #import &quot;WKViewInternal.h&quot;
</span><span class="cx"> #import &quot;WebContext.h&quot;
</span><ins>+#import &quot;WebKitSystemInterface.h&quot;
</ins><span class="cx"> #import &quot;WebPageMessages.h&quot;
</span><span class="cx"> #import &quot;WebPageProxy.h&quot;
</span><span class="cx"> #import &quot;WebPageProxyMessages.h&quot;
</span><span class="cx"> #import &quot;WebProcessProxy.h&quot;
</span><ins>+#import &lt;Foundation/Foundation.h&gt;
</ins><span class="cx"> #import &lt;ImageIO/ImageIO.h&gt;
</span><span class="cx"> #import &lt;ImageKit/ImageKit.h&gt;
</span><ins>+#import &lt;WebCore/DataDetectorsSPI.h&gt;
</ins><span class="cx"> #import &lt;WebCore/NSSharingServicePickerSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/NSViewSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/SoftLinking.h&gt;
</span><span class="lines">@@ -94,31 +97,12 @@
</span><span class="cx">     if (menu != _wkView.actionMenu)
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    [self _updateActionMenuItems];
-
</del><span class="cx">     _page-&gt;performActionMenuHitTestAtLocation([_wkView convertPoint:event.locationInWindow fromView:nil]);
</span><span class="cx"> 
</span><span class="cx">     _state = ActionMenuState::Pending;
</span><ins>+    [self _updateActionMenuItems];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-- (void)willOpenMenu:(NSMenu *)menu withEvent:(NSEvent *)event
-{
-    if (menu != _wkView.actionMenu)
-        return;
-
-    ASSERT(_state != ActionMenuState::None);
-
-    // FIXME: We need to be able to cancel this if the menu goes away.
-    // FIXME: Connection can be null if the process is closed; we should clean up better in that case.
-    if (_state == ActionMenuState::Pending) {
-        if (auto* connection = _page-&gt;process().connection())
-            connection-&gt;waitForAndDispatchImmediately&lt;Messages::WebPageProxy::DidPerformActionMenuHitTest&gt;(_page-&gt;pageID(), std::chrono::milliseconds(500));
-    }
-
-    if (_state == ActionMenuState::Ready)
-        [self _updateActionMenuItems];
-}
-
</del><span class="cx"> - (void)didCloseMenu:(NSMenu *)menu withEvent:(NSEvent *)event
</span><span class="cx"> {
</span><span class="cx">     if (menu != _wkView.actionMenu)
</span><span class="lines">@@ -297,6 +281,25 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#pragma mark NSMenuDelegate implementation
+
+- (void)menuNeedsUpdate:(NSMenu *)menu
+{
+    if (menu != _wkView.actionMenu)
+        return;
+
+    ASSERT(_state != ActionMenuState::None);
+
+    // FIXME: We need to be able to cancel this if the menu goes away.
+    // FIXME: Connection can be null if the process is closed; we should clean up better in that case.
+    if (_state == ActionMenuState::Pending) {
+        if (auto* connection = _page-&gt;process().connection())
+            connection-&gt;waitForAndDispatchImmediately&lt;Messages::WebPageProxy::DidPerformActionMenuHitTest&gt;(_page-&gt;pageID(), std::chrono::milliseconds(500));
+    }
+
+    [self _updateActionMenuItems];
+}
+
</ins><span class="cx"> #pragma mark NSSharingServicePickerDelegate implementation
</span><span class="cx"> 
</span><span class="cx"> - (id &lt;NSSharingServiceDelegate&gt;)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker delegateForSharingService:(NSSharingService *)sharingService
</span><span class="lines">@@ -385,13 +388,28 @@
</span><span class="cx">         if (!hitTestResult-&gt;absoluteImageURL().isEmpty() &amp;&amp; _hitTestResult.image) {
</span><span class="cx">             _type = kWKActionMenuImage;
</span><span class="cx">             return [self _defaultMenuItemsForImage];
</span><del>-        } if (!hitTestResult-&gt;absoluteLinkURL().isEmpty()) {
</del><ins>+        }
+
+        if (!hitTestResult-&gt;absoluteLinkURL().isEmpty()) {
</ins><span class="cx">             _type = kWKActionMenuLink;
</span><span class="cx">             return [self _defaultMenuItemsForLink];
</span><span class="cx">         }
</span><ins>+
+        if (hitTestResult-&gt;isTextNode()) {
+            if (DDActionContext *actionContext = _hitTestResult.actionContext.get()) {
+                WKSetDDActionContextIsForActionMenu(actionContext);
+                actionContext.highlightFrame = [_wkView.window convertRectToScreen:[_wkView convertRect:_hitTestResult.actionBoundingBox toView:nil]];
+                NSArray *dataDetectorMenuItems = [[getDDActionsManagerClass() sharedManager] menuItemsForResult:[_hitTestResult.actionContext mainResult] actionContext:actionContext];
+                if (dataDetectorMenuItems.count) {
+                    _type = kWKActionMenuDataDetectedItem;
+                    return dataDetectorMenuItems;
+                }
+            }
+        }
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return @[ ];
</del><ins>+    _type = kWKActionMenuNone;
+    return _state != ActionMenuState::Ready ? @[ [NSMenuItem separatorItem] ] : @[ ];
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (void)_updateActionMenuItems
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (175339 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-10-29 20:24:13 UTC (rev 175339)
+++ branches/safari-600.3-branch/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -577,7 +577,7 @@
</span><span class="cx">                 2D2ADF0916362DD500197E47 /* PDFPluginTextAnnotation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2ADF0616362DC700197E47 /* PDFPluginTextAnnotation.mm */; };
</span><span class="cx">                 2D2ADF0B16362DDB00197E47 /* PDFPluginAnnotation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2ADF031636243500197E47 /* PDFPluginAnnotation.mm */; };
</span><span class="cx">                 2D2ADF1016364D8200197E47 /* PDFPluginChoiceAnnotation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D2ADF0E16364D8200197E47 /* PDFPluginChoiceAnnotation.mm */; };
</span><del>-                2D353B1219F8305D000EEACD /* ActionMenuHitTestResult.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D353B1019F8305D000EEACD /* ActionMenuHitTestResult.cpp */; };
</del><ins>+                2D353B1219F8305D000EEACD /* ActionMenuHitTestResult.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D353B1019F8305D000EEACD /* ActionMenuHitTestResult.mm */; };
</ins><span class="cx">                 2D353B1319F8305D000EEACD /* ActionMenuHitTestResult.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D353B1119F8305D000EEACD /* ActionMenuHitTestResult.h */; };
</span><span class="cx">                 2D3EF4421917646300034184 /* WebMemoryPressureHandlerIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2D3EF4401917646300034184 /* WebMemoryPressureHandlerIOS.mm */; };
</span><span class="cx">                 2D3EF4431917646300034184 /* WebMemoryPressureHandlerIOS.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D3EF4411917646300034184 /* WebMemoryPressureHandlerIOS.h */; };
</span><span class="lines">@@ -2587,7 +2587,7 @@
</span><span class="cx">                 2D2ADF0C16363DEC00197E47 /* PDFLayerControllerDetails.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = PDFLayerControllerDetails.h; path = PDF/PDFLayerControllerDetails.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D2ADF0D16364D8200197E47 /* PDFPluginChoiceAnnotation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PDFPluginChoiceAnnotation.h; path = PDF/PDFPluginChoiceAnnotation.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D2ADF0E16364D8200197E47 /* PDFPluginChoiceAnnotation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PDFPluginChoiceAnnotation.mm; path = PDF/PDFPluginChoiceAnnotation.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                2D353B1019F8305D000EEACD /* ActionMenuHitTestResult.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ActionMenuHitTestResult.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                2D353B1019F8305D000EEACD /* ActionMenuHitTestResult.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ActionMenuHitTestResult.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 2D353B1119F8305D000EEACD /* ActionMenuHitTestResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ActionMenuHitTestResult.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D3EF4401917646300034184 /* WebMemoryPressureHandlerIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebMemoryPressureHandlerIOS.mm; path = ios/WebMemoryPressureHandlerIOS.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 2D3EF4411917646300034184 /* WebMemoryPressureHandlerIOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebMemoryPressureHandlerIOS.h; path = ios/WebMemoryPressureHandlerIOS.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -6121,7 +6121,7 @@
</span><span class="cx">                 BC111B5A112F628200337BAB /* mac */ = {
</span><span class="cx">                         isa = PBXGroup;
</span><span class="cx">                         children = (
</span><del>-                                2D353B1019F8305D000EEACD /* ActionMenuHitTestResult.cpp */,
</del><ins>+                                2D353B1019F8305D000EEACD /* ActionMenuHitTestResult.mm */,
</ins><span class="cx">                                 2D353B1119F8305D000EEACD /* ActionMenuHitTestResult.h */,
</span><span class="cx">                                 E179FD9B134D38060015B883 /* ArgumentCodersMac.h */,
</span><span class="cx">                                 E179FD9E134D38250015B883 /* ArgumentCodersMac.mm */,
</span><span class="lines">@@ -9305,7 +9305,7 @@
</span><span class="cx">                                 1AE00D5C182DADE100087DD7 /* KeyedEncoder.cpp in Sources */,
</span><span class="cx">                                 1AC8702E130B49A2002C1257 /* WebPluginSiteDataManager.cpp in Sources */,
</span><span class="cx">                                 BC5744EF12638FB3006F0F12 /* WebPopupItem.cpp in Sources */,
</span><del>-                                2D353B1219F8305D000EEACD /* ActionMenuHitTestResult.cpp in Sources */,
</del><ins>+                                2D353B1219F8305D000EEACD /* ActionMenuHitTestResult.mm in Sources */,
</ins><span class="cx">                                 0F931C1D18C5711900DBA7C3 /* ScrollingTreeOverflowScrollingNodeIOS.mm in Sources */,
</span><span class="cx">                                 D3B9484611FF4B6500032B39 /* WebPopupMenu.cpp in Sources */,
</span><span class="cx">                                 1AAF08A1192681D100B6390C /* WebUserContentControllerProxy.cpp in Sources */,
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (175339 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-10-29 20:24:13 UTC (rev 175339)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -28,7 +28,6 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;WebPage.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;ActionMenuHitTestResult.h&quot;
</del><span class="cx"> #include &quot;Arguments.h&quot;
</span><span class="cx"> #include &quot;DataReference.h&quot;
</span><span class="cx"> #include &quot;DragControllerAction.h&quot;
</span><span class="lines">@@ -4777,32 +4776,4 @@
</span><span class="cx">     send(Messages::WebPageProxy::WillChangeCurrentHistoryItemForMainFrame());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebPage::performActionMenuHitTestAtLocation(WebCore::FloatPoint locationInViewCooordinates)
-{
-    layoutIfNeeded();
-
-    MainFrame&amp; mainFrame = corePage()-&gt;mainFrame();
-    if (!mainFrame.view() || !mainFrame.view()-&gt;renderView()) {
-        send(Messages::WebPageProxy::DidPerformActionMenuHitTest(ActionMenuHitTestResult()));
-        return;
-    }
-
-    RenderView&amp; mainRenderView = *mainFrame.view()-&gt;renderView();
-
-    HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AllowChildFrameContent | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent);
-
-    HitTestResult hitTestResult(mainFrame.view()-&gt;rootViewToContents(roundedIntPoint(locationInViewCooordinates)));
-    mainRenderView.hitTest(request, hitTestResult);
-
-    ActionMenuHitTestResult actionMenuResult;
-
-    if (Image* image = hitTestResult.image()) {
-        actionMenuResult.image = ShareableBitmap::createShareable(IntSize(image-&gt;size()), ShareableBitmap::SupportsAlpha);
-        if (actionMenuResult.image)
-            actionMenuResult.image-&gt;createGraphicsContext()-&gt;drawImage(image, ColorSpaceDeviceRGB, IntPoint());
-    }
-
-    send(Messages::WebPageProxy::DidPerformActionMenuHitTest(actionMenuResult));
-}
-
</del><span class="cx"> } // namespace WebKit
</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 (175339 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2014-10-29 20:24:13 UTC (rev 175339)
+++ branches/safari-600.3-branch/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> 
</span><ins>+#import &quot;ActionMenuHitTestResult.h&quot;
</ins><span class="cx"> #import &quot;AttributedString.h&quot;
</span><span class="cx"> #import &quot;DataReference.h&quot;
</span><span class="cx"> #import &quot;DictionaryPopupInfo.h&quot;
</span><span class="lines">@@ -52,10 +53,12 @@
</span><span class="cx"> #import &lt;QuartzCore/QuartzCore.h&gt;
</span><span class="cx"> #import &lt;WebCore/AXObjectCache.h&gt;
</span><span class="cx"> #import &lt;WebCore/BackForwardController.h&gt;
</span><ins>+#import &lt;WebCore/DataDetectorsSPI.h&gt;
</ins><span class="cx"> #import &lt;WebCore/EventHandler.h&gt;
</span><span class="cx"> #import &lt;WebCore/FocusController.h&gt;
</span><span class="cx"> #import &lt;WebCore/FrameLoader.h&gt;
</span><span class="cx"> #import &lt;WebCore/FrameView.h&gt;
</span><ins>+#import &lt;WebCore/GraphicsContext.h&gt;
</ins><span class="cx"> #import &lt;WebCore/HTMLConverter.h&gt;
</span><span class="cx"> #import &lt;WebCore/HitTestResult.h&gt;
</span><span class="cx"> #import &lt;WebCore/KeyboardEvent.h&gt;
</span><span class="lines">@@ -68,12 +71,14 @@
</span><span class="cx"> #import &lt;WebCore/RenderElement.h&gt;
</span><span class="cx"> #import &lt;WebCore/RenderObject.h&gt;
</span><span class="cx"> #import &lt;WebCore/RenderStyle.h&gt;
</span><ins>+#import &lt;WebCore/RenderView.h&gt;
</ins><span class="cx"> #import &lt;WebCore/ResourceHandle.h&gt;
</span><span class="cx"> #import &lt;WebCore/ScrollView.h&gt;
</span><span class="cx"> #import &lt;WebCore/StyleInheritedData.h&gt;
</span><span class="cx"> #import &lt;WebCore/TextIterator.h&gt;
</span><span class="cx"> #import &lt;WebCore/VisibleUnits.h&gt;
</span><span class="cx"> #import &lt;WebCore/WindowsKeyboardCodes.h&gt;
</span><ins>+#import &lt;WebCore/htmlediting.h&gt;
</ins><span class="cx"> #import &lt;WebKitSystemInterface.h&gt;
</span><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="lines">@@ -491,6 +496,34 @@
</span><span class="cx">     return isPositionInRange(position, selectedRange.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static PassRefPtr&lt;Range&gt; rangeExpandedAroundPosition(const VisiblePosition&amp; position, int numberOfLinesToExpand)
+{
+    VisiblePosition contextStart = position;
+    VisiblePosition contextEnd = position;
+    for (int i = 0; i &lt; numberOfLinesToExpand; i++) {
+        VisiblePosition n = previousLinePosition(contextStart, contextStart.lineDirectionPointForBlockDirectionNavigation());
+        if (n.isNull() || n == contextStart)
+            break;
+        contextStart = n;
+    }
+    for (int i = 0; i &lt; numberOfLinesToExpand; i++) {
+        VisiblePosition n = nextLinePosition(contextEnd, contextEnd.lineDirectionPointForBlockDirectionNavigation());
+        if (n.isNull() || n == contextEnd)
+            break;
+        contextEnd = n;
+    }
+
+    VisiblePosition lineStart = startOfLine(contextStart);
+    if (!lineStart.isNull())
+        contextStart = lineStart;
+
+    VisiblePosition lineEnd = endOfLine(contextEnd);
+    if (!lineEnd.isNull())
+        contextEnd = lineEnd;
+    
+    return makeRange(contextStart, contextEnd);
+}
+
</ins><span class="cx"> void WebPage::performDictionaryLookupAtLocation(const FloatPoint&amp; floatPoint)
</span><span class="cx"> {
</span><span class="cx">     if (PluginView* pluginView = pluginViewForFrame(&amp;m_page-&gt;mainFrame())) {
</span><span class="lines">@@ -519,33 +552,9 @@
</span><span class="cx">     NSDictionary *options = nil;
</span><span class="cx"> 
</span><span class="cx">     // As context, we are going to use four lines of text before and after the point. (Dictionary can sometimes look up things that are four lines long)
</span><del>-    const int numberOfLinesOfContext = 4;
-    VisiblePosition contextStart = position;
-    VisiblePosition contextEnd = position;
-    for (int i = 0; i &lt; numberOfLinesOfContext; i++) {
-        VisiblePosition n = previousLinePosition(contextStart, contextStart.lineDirectionPointForBlockDirectionNavigation());
-        if (n.isNull() || n == contextStart)
-            break;
-        contextStart = n;
-    }
-    for (int i = 0; i &lt; numberOfLinesOfContext; i++) {
-        VisiblePosition n = nextLinePosition(contextEnd, contextEnd.lineDirectionPointForBlockDirectionNavigation());
-        if (n.isNull() || n == contextEnd)
-            break;
-        contextEnd = n;
-    }
</del><ins>+    RefPtr&lt;Range&gt; fullCharacterRange = rangeExpandedAroundPosition(position, 4);
+    NSRange rangeToPass = NSMakeRange(TextIterator::rangeLength(makeRange(fullCharacterRange-&gt;startPosition(), position).get()), 0);
</ins><span class="cx"> 
</span><del>-    VisiblePosition lineStart = startOfLine(contextStart);
-    if (!lineStart.isNull())
-        contextStart = lineStart;
-
-    VisiblePosition lineEnd = endOfLine(contextEnd);
-    if (!lineEnd.isNull())
-        contextEnd = lineEnd;
-
-    NSRange rangeToPass = NSMakeRange(TextIterator::rangeLength(makeRange(contextStart, position).get()), 0);
-
-    RefPtr&lt;Range&gt; fullCharacterRange = makeRange(contextStart, contextEnd);
</del><span class="cx">     String fullPlainTextString = plainText(fullCharacterRange.get());
</span><span class="cx"> 
</span><span class="cx">     NSRange extractedRange = WKExtractWordDefinitionTokenRangeFromContextualString(fullPlainTextString, rangeToPass, &amp;options);
</span><span class="lines">@@ -1045,6 +1054,95 @@
</span><span class="cx">     return String();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static RetainPtr&lt;DDActionContext&gt; scanForDataDetectedItems(const HitTestResult&amp; hitTestResult, FloatRect&amp; actionBoundingBox)
+{
+    Node* node = hitTestResult.innerNonSharedNode();
+    if (!node)
+        return nullptr;
+    auto renderer = node-&gt;renderer();
+    if (!renderer)
+        return nullptr;
+    VisiblePosition position = renderer-&gt;positionForPoint(hitTestResult.localPoint(), nullptr);
+    if (position.isNull())
+        position = firstPositionInOrBeforeNode(node);
+
+    RefPtr&lt;Range&gt; contextRange = rangeExpandedAroundPosition(position, 4);
+    String fullPlainTextString = plainText(contextRange.get());
+    int hitLocation = TextIterator::rangeLength(makeRange(contextRange-&gt;startPosition(), position).get());
+
+    RetainPtr&lt;DDScannerRef&gt; scanner = adoptCF(DDScannerCreate(DDScannerTypeStandard, 0, nullptr));
+    RetainPtr&lt;DDScanQueryRef&gt; scanQuery = adoptCF(DDScanQueryCreateFromString(kCFAllocatorDefault, fullPlainTextString.createCFString().get(), CFRangeMake(0, fullPlainTextString.length())));
+
+    if (!DDScannerScanQuery(scanner.get(), scanQuery.get()))
+        return nullptr;
+
+    RetainPtr&lt;CFArrayRef&gt; results = adoptCF(DDScannerCopyResultsWithOptions(scanner.get(), DDScannerCopyResultsOptionsNoOverlap));
+
+    // Find the DDResultRef that intersects the hitTestResult's VisiblePosition.
+    DDResultRef mainResult = nullptr;
+    RefPtr&lt;Range&gt; mainResultRange;
+    CFIndex resultCount = CFArrayGetCount(results.get());
+    for (CFIndex i = 0; i &lt; resultCount; i++) {
+        DDResultRef result = (DDResultRef)CFArrayGetValueAtIndex(results.get(), i);
+        CFRange resultRangeInContext = DDResultGetRange(result);
+        if (hitLocation &gt;= resultRangeInContext.location &amp;&amp; (hitLocation - resultRangeInContext.location) &lt; resultRangeInContext.length) {
+            mainResult = result;
+            mainResultRange = TextIterator::subrange(contextRange.get(), resultRangeInContext.location, resultRangeInContext.length);
+            break;
+        }
+    }
+
+    if (!mainResult)
+        return nullptr;
+
+    RetainPtr&lt;DDActionContext&gt; actionContext = adoptNS([[getDDActionContextClass() alloc] init]);
+    [actionContext setAllResults:(NSArray *)results.get()];
+    [actionContext setMainResult:mainResult];
+
+    Vector&lt;FloatQuad&gt; quads;
+    mainResultRange-&gt;textQuads(quads);
+    if (!quads.isEmpty())
+        actionBoundingBox = mainResultRange-&gt;ownerDocument().view()-&gt;contentsToWindow(quads[0].enclosingBoundingBox());
+
+    return actionContext;
+}
+
+void WebPage::performActionMenuHitTestAtLocation(WebCore::FloatPoint locationInViewCooordinates)
+{
+    layoutIfNeeded();
+
+    MainFrame&amp; mainFrame = corePage()-&gt;mainFrame();
+    if (!mainFrame.view() || !mainFrame.view()-&gt;renderView()) {
+        send(Messages::WebPageProxy::DidPerformActionMenuHitTest(ActionMenuHitTestResult()));
+        return;
+    }
+
+    RenderView&amp; mainRenderView = *mainFrame.view()-&gt;renderView();
+
+    HitTestRequest request(HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AllowChildFrameContent | HitTestRequest::IgnoreClipping | HitTestRequest::DisallowShadowContent);
+
+    IntPoint locationInContentCoordinates = mainFrame.view()-&gt;rootViewToContents(roundedIntPoint(locationInViewCooordinates));
+    HitTestResult hitTestResult(locationInContentCoordinates);
+    mainRenderView.hitTest(request, hitTestResult);
+
+    ActionMenuHitTestResult actionMenuResult;
+
+    if (Image* image = hitTestResult.image()) {
+        actionMenuResult.image = ShareableBitmap::createShareable(IntSize(image-&gt;size()), ShareableBitmap::SupportsAlpha);
+        if (actionMenuResult.image)
+            actionMenuResult.image-&gt;createGraphicsContext()-&gt;drawImage(image, ColorSpaceDeviceRGB, IntPoint());
+    }
+
+    // FIXME: Avoid scanning if we will just throw away the result (e.g. we're over a link).
+    if (hitTestResult.innerNode() &amp;&amp; hitTestResult.innerNode()-&gt;isTextNode()) {
+        FloatRect actionBoundingBox;
+        actionMenuResult.actionContext = scanForDataDetectedItems(hitTestResult, actionBoundingBox);
+        actionMenuResult.actionBoundingBox = actionBoundingBox;
+    }
+    
+    send(Messages::WebPageProxy::DidPerformActionMenuHitTest(actionMenuResult));
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #endif // PLATFORM(MAC)
</span></span></pre></div>
<a id="branchessafari6003branchWebKitLibrariesChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/WebKitLibraries/ChangeLog (175339 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/WebKitLibraries/ChangeLog        2014-10-29 20:24:13 UTC (rev 175339)
+++ branches/safari-600.3-branch/WebKitLibraries/ChangeLog        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2014-08-29  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r175335. rdar://problem/18709436
+
+    2014-10-29  Tim Horton  &lt;timothy_horton@apple.com&gt;
+
+            Implement action menus for data detected items
+            https://bugs.webkit.org/show_bug.cgi?id=138178
+            &lt;rdar://problem/18709436&gt;
+
+            Reviewed by Anders Carlsson.
+
+            * WebKitSystemInterface.h:
+            * libWebKitSystemInterfaceMavericks.a:
+            * libWebKitSystemInterfaceMountainLion.a:
+            * libWebKitSystemInterfaceYosemite.a:
+            Update WebKitSystemInterface.
+
</ins><span class="cx"> 2014-08-26  Dana Burkart  &lt;dburkart@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r172982. &lt;rdar://problem/18141695&gt;
</span></span></pre></div>
<a id="branchessafari6003branchWebKitLibrariesWebKitSystemInterfaceh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/WebKitLibraries/WebKitSystemInterface.h (175339 => 175340)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/WebKitLibraries/WebKitSystemInterface.h        2014-10-29 20:24:13 UTC (rev 175339)
+++ branches/safari-600.3-branch/WebKitLibraries/WebKitSystemInterface.h        2014-10-29 20:26:40 UTC (rev 175340)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx"> 
</span><span class="cx"> @class AVAsset;
</span><span class="cx"> @class AVPlayer;
</span><ins>+@class DDActionContext;
</ins><span class="cx"> @class QTMovie;
</span><span class="cx"> @class QTMovieView;
</span><span class="cx"> 
</span><span class="lines">@@ -152,9 +153,10 @@
</span><span class="cx"> void WKDrawTextFieldCellFocusRing(NSTextFieldCell*, NSRect);
</span><span class="cx"> void WKDrawBezeledTextArea(NSRect, BOOL enabled);
</span><span class="cx"> 
</span><del>-void WKPopupMenu(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize, bool hideArrows);
</del><ins>+void WKPopupMenu(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize, bool usesCustomAppearance);
</ins><span class="cx"> void WKPopupMenuWithSize(NSMenu*, NSPoint location, float width, NSView*, int selectedItem, NSFont*, NSControlSize controlSize);
</span><span class="cx"> void WKPopupContextMenu(NSMenu *menu, NSPoint screenLocation);
</span><ins>+void WKSetDDActionContextIsForActionMenu(DDActionContext *actionContext);
</ins><span class="cx"> void WKSendUserChangeNotifications(void);
</span><span class="cx"> #ifndef __LP64__
</span><span class="cx"> BOOL WKConvertNSEventToCarbonEvent(EventRecord *carbonEvent, NSEvent *cocoaEvent);
</span></span></pre>
</div>
</div>

</body>
</html>