<!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>[170782] trunk/Source</title>
</head>
<body>

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

<h3>Log Message</h3>
<pre>When showing the selection menu, include menu options for all selected phone numbers.
&lt;rdar://problem/16983434&gt;, &lt;rdar://problem/16874568&gt;, and https://bugs.webkit.org/show_bug.cgi?id=134613

Reviewed by Tim Horton.

Source/WebCore:
* English.lproj/Localizable.strings:

* dom/Range.cpp:
(WebCore::rangesOverlap): Fix reversed arguments that caused some types of overlaps to not be detected.

Source/WebKit2:
Move some telephone number menu logic from WebKitSystemInterface here.
Also provide utility to get just the one menu item relevant to a telephone number.
* Platform/mac/MenuUtilities.h:
* Platform/mac/MenuUtilities.mm: Added.
(WebKit::menuItemForTelephoneNumber):
(WebKit::menuItemsForTelephoneNumber):

* Platform/mac/StringUtilities.h:
* Platform/mac/StringUtilities.mm:
(WebKit::formattedPhoneNumberString): Return a localized formatted phone number.

Add a member to track the selected phone numbers:
* Shared/ContextMenuContextData.h:
(WebKit::ContextMenuContextData::ContextMenuContextData):
(WebKit::ContextMenuContextData::selectedTelephoneNumbers):

* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:

* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::setupServicesMenu): Also add menu items for each phone number that is
  in the selection.

Switch away from a WKSI method, and remove a lot of unneeded forward declarations and soft linking:
* UIProcess/mac/WebPageProxyMac.mm:
(WebKit::WebPageProxy::showTelephoneNumberMenu):
(WebKit::WebPageProxy::showSelectionServiceMenu):

* WebKit2.xcodeproj/project.pbxproj:

* WebProcess/WebPage/mac/ServicesOverlayController.mm:
(WebKit::ServicesOverlayController::drawSelectionHighlight):
(WebKit::ServicesOverlayController::handleClick): Pass the phone numbers along.

* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::handleSelectionServiceClick): Pass the phone numbers along.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreEnglishlprojLocalizablestrings">trunk/Source/WebCore/English.lproj/Localizable.strings</a></li>
<li><a href="#trunkSourceWebCoredomRangecpp">trunk/Source/WebCore/dom/Range.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformmacStringUtilitiesh">trunk/Source/WebKit2/Platform/mac/StringUtilities.h</a></li>
<li><a href="#trunkSourceWebKit2PlatformmacStringUtilitiesmm">trunk/Source/WebKit2/Platform/mac/StringUtilities.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedContextMenuContextDatah">trunk/Source/WebKit2/Shared/ContextMenuContextData.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxymessagesin">trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWebContextMenuProxyMacmm">trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWebPageProxyMacmm">trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm</a></li>
<li><a href="#trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj">trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacServicesOverlayControllermm">trunk/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacWebPageMacmm">trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2PlatformmacMenuUtilitiesh">trunk/Source/WebKit2/Platform/mac/MenuUtilities.h</a></li>
<li><a href="#trunkSourceWebKit2PlatformmacMenuUtilitiesmm">trunk/Source/WebKit2/Platform/mac/MenuUtilities.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (170781 => 170782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-07-04 00:36:07 UTC (rev 170781)
+++ trunk/Source/WebCore/ChangeLog        2014-07-04 00:39:41 UTC (rev 170782)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-07-03  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        When showing the selection menu, include menu options for all selected phone numbers.
+        &lt;rdar://problem/16983434&gt;, &lt;rdar://problem/16874568&gt;, and https://bugs.webkit.org/show_bug.cgi?id=134613
+
+        Reviewed by Tim Horton.
+
+        * English.lproj/Localizable.strings:
+
+        * dom/Range.cpp:
+        (WebCore::rangesOverlap): Fix reversed arguments that caused some types of overlaps to not be detected.
+
</ins><span class="cx"> 2014-07-03  Daniel Bates  &lt;dabates@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Add WTF::move()
</span></span></pre></div>
<a id="trunkSourceWebCoreEnglishlprojLocalizablestrings"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/English.lproj/Localizable.strings (170781 => 170782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/English.lproj/Localizable.strings        2014-07-04 00:36:07 UTC (rev 170781)
+++ trunk/Source/WebCore/English.lproj/Localizable.strings        2014-07-04 00:39:41 UTC (rev 170782)
</span><span class="lines">@@ -118,6 +118,9 @@
</span><span class="cx"> /* Undo action name */
</span><span class="cx"> &quot;Bold (Undo action name)&quot; = &quot;Bold&quot;;
</span><span class="cx"> 
</span><ins>+/* menu item for making a telephone call to a telephone number */
+&quot;Call “%@” Using iPhone&quot; = &quot;Call “%@” Using iPhone&quot;;
+
</ins><span class="cx"> /* File Upload alert sheet button string to cancel */
</span><span class="cx"> &quot;Cancel (file upload action sheet)&quot; = &quot;Cancel&quot;;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomRangecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Range.cpp (170781 => 170782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Range.cpp        2014-07-04 00:36:07 UTC (rev 170781)
+++ trunk/Source/WebCore/dom/Range.cpp        2014-07-04 00:39:41 UTC (rev 170782)
</span><span class="lines">@@ -2008,11 +2008,11 @@
</span><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     // End of first range is inside second range.
</span><del>-    if (a-&gt;compareBoundaryPoints(Range::END_TO_START, b, ASSERT_NO_EXCEPTION) &gt;= 0 &amp;&amp; endToEnd &lt;= 0)
</del><ins>+    if (a-&gt;compareBoundaryPoints(Range::START_TO_END, b, ASSERT_NO_EXCEPTION) &gt;= 0 &amp;&amp; endToEnd &lt;= 0)
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     // Start of first range is inside second range.
</span><del>-    if (startToStart &gt;= 0 &amp;&amp; a-&gt;compareBoundaryPoints(Range::START_TO_END, b, ASSERT_NO_EXCEPTION) &lt;= 0)
</del><ins>+    if (startToStart &gt;= 0 &amp;&amp; a-&gt;compareBoundaryPoints(Range::END_TO_START, b, ASSERT_NO_EXCEPTION) &lt;= 0)
</ins><span class="cx">         return true;
</span><span class="cx"> 
</span><span class="cx">     return false;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (170781 => 170782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-07-04 00:36:07 UTC (rev 170781)
+++ trunk/Source/WebKit2/ChangeLog        2014-07-04 00:39:41 UTC (rev 170782)
</span><span class="lines">@@ -1,3 +1,48 @@
</span><ins>+2014-07-03  Brady Eidson  &lt;beidson@apple.com&gt;
+
+        When showing the selection menu, include menu options for all selected phone numbers.
+        &lt;rdar://problem/16983434&gt;, &lt;rdar://problem/16874568&gt;, and https://bugs.webkit.org/show_bug.cgi?id=134613
+
+        Reviewed by Tim Horton.
+
+        Move some telephone number menu logic from WebKitSystemInterface here.
+        Also provide utility to get just the one menu item relevant to a telephone number.
+        * Platform/mac/MenuUtilities.h:
+        * Platform/mac/MenuUtilities.mm: Added.
+        (WebKit::menuItemForTelephoneNumber):
+        (WebKit::menuItemsForTelephoneNumber):
+
+        * Platform/mac/StringUtilities.h:
+        * Platform/mac/StringUtilities.mm:
+        (WebKit::formattedPhoneNumberString): Return a localized formatted phone number.
+
+        Add a member to track the selected phone numbers:
+        * Shared/ContextMenuContextData.h:
+        (WebKit::ContextMenuContextData::ContextMenuContextData):
+        (WebKit::ContextMenuContextData::selectedTelephoneNumbers):
+
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+
+        * UIProcess/mac/WebContextMenuProxyMac.mm:
+        (WebKit::WebContextMenuProxyMac::setupServicesMenu): Also add menu items for each phone number that is
+          in the selection.
+
+        Switch away from a WKSI method, and remove a lot of unneeded forward declarations and soft linking:
+        * UIProcess/mac/WebPageProxyMac.mm:
+        (WebKit::WebPageProxy::showTelephoneNumberMenu):
+        (WebKit::WebPageProxy::showSelectionServiceMenu):
+
+        * WebKit2.xcodeproj/project.pbxproj:
+
+        * WebProcess/WebPage/mac/ServicesOverlayController.mm:
+        (WebKit::ServicesOverlayController::drawSelectionHighlight):
+        (WebKit::ServicesOverlayController::handleClick): Pass the phone numbers along.
+
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::handleSelectionServiceClick): Pass the phone numbers along.
+
</ins><span class="cx"> 2014-07-03  Gavin Barraclough  &lt;baraclough@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WKProcessAssertionBackgroundTaskManager should clear member if task expires
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformmacMenuUtilitieshfromrev170781trunkSourceWebKit2PlatformmacStringUtilitiesmm"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/Platform/mac/MenuUtilities.h (from rev 170781, trunk/Source/WebKit2/Platform/mac/StringUtilities.mm) (0 => 170782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/mac/MenuUtilities.h                                (rev 0)
+++ trunk/Source/WebKit2/Platform/mac/MenuUtilities.h        2014-07-04 00:39:41 UTC (rev 170782)
</span><span class="lines">@@ -0,0 +1,41 @@
</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.
+ */
+
+#ifndef MenuUtilities_h
+#define MenuUtilities_h
+
+#import &lt;wtf/Vector.h&gt;
+#import &lt;wtf/text/WTFString.h&gt;
+
+namespace WebKit {
+
+#if ENABLE(TELEPHONE_NUMBER_DETECTION) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+NSMenuItem *menuItemForTelephoneNumber(const String&amp; telephoneNumberString);
+NSArray *menuItemsForTelephoneNumber(const String&amp; telephoneNumber);
+#endif
+
+} // namespace WebKit
+
+#endif // MenuUtilities_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2PlatformmacMenuUtilitiesmm"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/Platform/mac/MenuUtilities.mm (0 => 170782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/mac/MenuUtilities.mm                                (rev 0)
+++ trunk/Source/WebKit2/Platform/mac/MenuUtilities.mm        2014-07-04 00:39:41 UTC (rev 170782)
</span><span class="lines">@@ -0,0 +1,121 @@
</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;MenuUtilities.h&quot;
+
+#import &quot;StringUtilities.h&quot;
+#import &lt;WebCore/LocalizedStrings.h&gt;
+#import &lt;WebCore/SoftLinking.h&gt;
+#import &lt;objc/runtime.h&gt;
+
+#if ENABLE(TELEPHONE_NUMBER_DETECTION) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+SOFT_LINK_PRIVATE_FRAMEWORK(DataDetectors)
+SOFT_LINK_CLASS(DataDetectors, DDAction)
+SOFT_LINK_CLASS(DataDetectors, DDActionsManager)
+SOFT_LINK_CONSTANT(DataDetectors, DDBinderPhoneNumberKey, CFStringRef)
+
+@interface DDAction : NSObject
+@property (readonly) NSString *actionUTI;
+@end
+
+typedef void* DDActionContext;
+
+@interface DDActionsManager : NSObject
++ (DDActionsManager *)sharedManager;
+- (NSArray *)menuItemsForValue:(NSString *)value type:(CFStringRef)type service:(NSString *)service context:(DDActionContext *)context;
+@end
+#endif
+
+namespace WebKit {
+
+#if ENABLE(TELEPHONE_NUMBER_DETECTION) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+
+static NSString *menuItemTitleForTelephoneNumber(const String&amp; telephoneNumber)
+{
+    return [NSString stringWithFormat:WEB_UI_STRING(&quot;Call “%@” Using iPhone&quot;, &quot;menu item for making a telephone call to a telephone number&quot;), formattedPhoneNumberString(telephoneNumber)];
+}
+
+NSMenuItem *menuItemForTelephoneNumber(const String&amp; telephoneNumber)
+{
+    NSArray *proposedMenu = [[getDDActionsManagerClass() sharedManager] menuItemsForValue:(NSString *)telephoneNumber type:getDDBinderPhoneNumberKey() service:nil context:nil];
+    for (NSMenuItem *item in proposedMenu) {
+        NSDictionary *representedObject = item.representedObject;
+        if (![representedObject isKindOfClass:[NSDictionary class]])
+            continue;
+
+        DDAction *actionObject = [representedObject objectForKey:@&quot;DDAction&quot;];
+        if (![actionObject isKindOfClass:getDDActionClass()])
+            continue;
+
+        if ([actionObject.actionUTI hasPrefix:@&quot;com.apple.dial&quot;]) {
+            item.title = menuItemTitleForTelephoneNumber(telephoneNumber);
+            return item;
+        }
+    }
+
+    return nil;
+}
+
+NSArray *menuItemsForTelephoneNumber(const String&amp; telephoneNumber)
+{
+    NSMutableArray *items = [NSMutableArray array];
+    NSMutableArray *faceTimeItems = [NSMutableArray array];
+    NSMenuItem *dialItem = nil;
+
+    NSArray *proposedMenu = [[getDDActionsManagerClass() sharedManager] menuItemsForValue:(NSString *)telephoneNumber type:getDDBinderPhoneNumberKey() service:nil context:nil];
+    for (NSMenuItem *item in proposedMenu) {
+        NSDictionary *representedObject = item.representedObject;
+        if (![representedObject isKindOfClass:[NSDictionary class]])
+            continue;
+
+        DDAction *actionObject = [representedObject objectForKey:@&quot;DDAction&quot;];
+        if (![actionObject isKindOfClass:getDDActionClass()])
+            continue;
+
+        if ([actionObject.actionUTI hasPrefix:@&quot;com.apple.dial&quot;]) {
+            item.title = menuItemTitleForTelephoneNumber(telephoneNumber);
+            dialItem = item;
+            continue;
+        }
+
+        if ([actionObject.actionUTI hasPrefix:@&quot;com.apple.facetime&quot;])
+            [faceTimeItems addObject:item];
+    }
+
+    if (dialItem)
+        [items addObject:dialItem];
+
+    if (faceTimeItems.count) {
+        if (items.count)
+            [items addObject:[NSMenuItem separatorItem]];
+        [items addObjectsFromArray:faceTimeItems];
+    }
+
+    return items.count ? items : nil;
+}
+#endif
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2PlatformmacStringUtilitiesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/mac/StringUtilities.h (170781 => 170782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/mac/StringUtilities.h        2014-07-04 00:36:07 UTC (rev 170781)
+++ trunk/Source/WebKit2/Platform/mac/StringUtilities.h        2014-07-04 00:39:41 UTC (rev 170782)
</span><span class="lines">@@ -32,8 +32,12 @@
</span><span class="cx"> 
</span><span class="cx"> // NOTE: This does not use String::operator NSString*() since that function
</span><span class="cx"> // expects to be called on the thread running WebCore.
</span><del>-NSString* nsStringFromWebCoreString(const String&amp;);
</del><ins>+NSString *nsStringFromWebCoreString(const String&amp;);
</ins><span class="cx"> 
</span><ins>+#if ENABLE(TELEPHONE_NUMBER_DETECTION) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+NSString *formattedPhoneNumberString(NSString *originalPhoneNumber);
+#endif
+
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #endif // StringUtilities_h
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformmacStringUtilitiesmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/mac/StringUtilities.mm (170781 => 170782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/mac/StringUtilities.mm        2014-07-04 00:36:07 UTC (rev 170781)
+++ trunk/Source/WebKit2/Platform/mac/StringUtilities.mm        2014-07-04 00:39:41 UTC (rev 170782)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #import &quot;WKSharedAPICast.h&quot;
</span><span class="cx"> #import &quot;WKStringCF.h&quot;
</span><ins>+#import &lt;WebCore/SoftLinking.h&gt;
</ins><span class="cx"> #import &lt;wtf/ObjcRuntimeExtras.h&gt;
</span><span class="cx"> #import &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -38,4 +39,39 @@
</span><span class="cx">     return string.isEmpty() ? @&quot;&quot; : CFBridgingRelease(WKStringCopyCFString(0, toAPI(string.impl())));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(TELEPHONE_NUMBER_DETECTION) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+
+SOFT_LINK_PRIVATE_FRAMEWORK(PhoneNumbers);
+
+typedef struct __CFPhoneNumber* CFPhoneNumberRef;
+
+// These functions are declared with __attribute__((visibility (&quot;default&quot;)))
+// We currently don't have a way to soft link such functions, so we forward declare them again here.
+CFPhoneNumberRef CFPhoneNumberCreate(CFAllocatorRef, CFStringRef, CFStringRef);
+SOFT_LINK(PhoneNumbers, CFPhoneNumberCreate, CFPhoneNumberRef, (CFAllocatorRef allocator, CFStringRef digits, CFStringRef countryCode), (allocator, digits, countryCode));
+
+CFStringRef CFPhoneNumberCopyFormattedRepresentation(CFPhoneNumberRef);
+SOFT_LINK(PhoneNumbers, CFPhoneNumberCopyFormattedRepresentation, CFStringRef, (CFPhoneNumberRef phoneNumber), (phoneNumber));
+
+CFStringRef CFPhoneNumberCopyUnformattedRepresentation(CFPhoneNumberRef);
+SOFT_LINK(PhoneNumbers, CFPhoneNumberCopyUnformattedRepresentation, CFStringRef, (CFPhoneNumberRef phoneNumber), (phoneNumber));
+
+
+NSString *formattedPhoneNumberString(NSString *originalPhoneNumber)
+{
+    NSString *countryCode = [[[NSLocale currentLocale] objectForKey:NSLocaleCountryCode] lowercaseString];
+
+    RetainPtr&lt;CFPhoneNumberRef&gt; phoneNumber = adoptCF(CFPhoneNumberCreate(kCFAllocatorDefault, (CFStringRef)originalPhoneNumber, (CFStringRef)countryCode));
+    if (!phoneNumber)
+        return originalPhoneNumber;
+
+    CFStringRef phoneNumberString = CFPhoneNumberCopyFormattedRepresentation(phoneNumber.get());
+    if (!phoneNumberString)
+        phoneNumberString = CFPhoneNumberCopyUnformattedRepresentation(phoneNumber.get());
+
+    return [(NSString *)phoneNumberString autorelease];
</ins><span class="cx"> }
</span><ins>+
+#endif // ENABLE(TELEPHONE_NUMBER_DETECTION) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
+
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2SharedContextMenuContextDatah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/ContextMenuContextData.h (170781 => 170782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/ContextMenuContextData.h        2014-07-04 00:36:07 UTC (rev 170781)
+++ trunk/Source/WebKit2/Shared/ContextMenuContextData.h        2014-07-04 00:39:41 UTC (rev 170782)
</span><span class="lines">@@ -57,14 +57,16 @@
</span><span class="cx">     const WebHitTestResult::Data&amp; webHitTestResultData() const { return m_webHitTestResultData; }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><del>-    ContextMenuContextData(const Vector&lt;uint8_t&gt;&amp; selectionData, bool isEditable)
</del><ins>+    ContextMenuContextData(const Vector&lt;uint8_t&gt;&amp; selectionData, const Vector&lt;String&gt;&amp; selectedTelephoneNumbers, bool isEditable)
</ins><span class="cx">         : m_isTelephoneNumberContext(false)
</span><span class="cx">         , m_controlledSelectionData(selectionData)
</span><ins>+        , m_selectedTelephoneNumbers(selectedTelephoneNumbers)
</ins><span class="cx">         , m_selectionIsEditable(isEditable)
</span><span class="cx">     { }
</span><span class="cx"> 
</span><span class="cx">     const ShareableBitmap::Handle&amp; controlledImageHandle() const { return m_controlledImageHandle; }
</span><span class="cx">     const Vector&lt;uint8_t&gt;&amp; controlledSelectionData() const { return m_controlledSelectionData; }
</span><ins>+    const Vector&lt;String&gt;&amp; selectedTelephoneNumbers() const { return m_selectedTelephoneNumbers; }
</ins><span class="cx"> 
</span><span class="cx">     bool controlledDataIsEditable() const;
</span><span class="cx">     bool needsServicesMenu() const { return !m_controlledImageHandle.isNull() || !m_controlledSelectionData.isEmpty(); }
</span><span class="lines">@@ -85,6 +87,7 @@
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><span class="cx">     ShareableBitmap::Handle m_controlledImageHandle;
</span><span class="cx">     Vector&lt;uint8_t&gt; m_controlledSelectionData;
</span><ins>+    Vector&lt;String&gt; m_selectedTelephoneNumbers;
</ins><span class="cx">     bool m_selectionIsEditable;
</span><span class="cx"> #endif
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (170781 => 170782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-07-04 00:36:07 UTC (rev 170781)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2014-07-04 00:39:41 UTC (rev 170782)
</span><span class="lines">@@ -1099,7 +1099,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><del>-    void showSelectionServiceMenu(const IPC::DataReference&amp; selectionAsRTFD, bool isEditable, const WebCore::IntPoint&amp;);
</del><ins>+    void showSelectionServiceMenu(const IPC::DataReference&amp; selectionAsRTFD, const Vector&lt;String&gt;&amp; telephoneNumbers, bool isEditable, const WebCore::IntPoint&amp;);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     // Search popup results
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (170781 => 170782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-07-04 00:36:07 UTC (rev 170781)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2014-07-04 00:39:41 UTC (rev 170782)
</span><span class="lines">@@ -396,7 +396,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><del>-    ShowSelectionServiceMenu(IPC::DataReference selectionAsRTFD, bool isEditable, WebCore::IntPoint point)
</del><ins>+    ShowSelectionServiceMenu(IPC::DataReference selectionAsRTFD, Vector&lt;String&gt; telephoneNumbers, bool isEditable, WebCore::IntPoint point)
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if USE(QUICK_LOOK)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWebContextMenuProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm (170781 => 170782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm        2014-07-04 00:36:07 UTC (rev 170781)
+++ trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm        2014-07-04 00:39:41 UTC (rev 170782)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> 
</span><span class="cx"> #import &quot;DataReference.h&quot;
</span><ins>+#import &quot;MenuUtilities.h&quot;
</ins><span class="cx"> #import &quot;PageClientImpl.h&quot;
</span><span class="cx"> #import &quot;ShareableBitmap.h&quot;
</span><span class="cx"> #import &quot;StringUtilities.h&quot;
</span><span class="lines">@@ -398,6 +399,16 @@
</span><span class="cx"> 
</span><span class="cx">     m_servicesMenu = [picker menu];
</span><span class="cx"> 
</span><ins>+    // Explicitly add a menu item for each telephone number that is in the selection.
+    const Vector&lt;String&gt;&amp; selectedTelephoneNumbers = context.selectedTelephoneNumbers();
+    if (!selectedTelephoneNumbers.isEmpty()) {
+        [m_servicesMenu.get() addItem:[NSMenuItem separatorItem]];
+        for (auto&amp; telephoneNumber : selectedTelephoneNumbers) {
+            if (NSMenuItem *item = menuItemForTelephoneNumber(telephoneNumber))
+                [m_servicesMenu.get() addItem:item];
+        }
+    }
+
</ins><span class="cx">     // If there is no services menu, then the existing services on the system have changed.
</span><span class="cx">     // Ask the UIProcess to refresh that list of services.
</span><span class="cx">     // If &lt;rdar://problem/16776831&gt; is resolved then we can more accurately keep the list up to date without this call.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWebPageProxyMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (170781 => 170782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2014-07-04 00:36:07 UTC (rev 170781)
+++ trunk/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm        2014-07-04 00:39:41 UTC (rev 170782)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> #import &quot;DictionaryPopupInfo.h&quot;
</span><span class="cx"> #import &quot;EditingRange.h&quot;
</span><span class="cx"> #import &quot;EditorState.h&quot;
</span><ins>+#import &quot;MenuUtilities.h&quot;
</ins><span class="cx"> #import &quot;NativeWebKeyboardEvent.h&quot;
</span><span class="cx"> #import &quot;PageClient.h&quot;
</span><span class="cx"> #import &quot;PageClientImpl.h&quot;
</span><span class="lines">@@ -49,10 +50,8 @@
</span><span class="cx"> #import &lt;WebCore/GraphicsLayer.h&gt;
</span><span class="cx"> #import &lt;WebCore/RuntimeApplicationChecks.h&gt;
</span><span class="cx"> #import &lt;WebCore/SharedBuffer.h&gt;
</span><del>-#import &lt;WebCore/SoftLinking.h&gt;
</del><span class="cx"> #import &lt;WebCore/TextAlternativeWithRange.h&gt;
</span><span class="cx"> #import &lt;WebCore/UserAgent.h&gt;
</span><del>-#import &lt;WebKitSystemInterface.h&gt;
</del><span class="cx"> #import &lt;mach-o/dyld.h&gt;
</span><span class="cx"> #import &lt;wtf/NeverDestroyed.h&gt;
</span><span class="cx"> #import &lt;wtf/text/StringConcatenate.h&gt;
</span><span class="lines">@@ -61,17 +60,6 @@
</span><span class="cx"> - (void)speakString:(NSString *)string;
</span><span class="cx"> @end
</span><span class="cx"> 
</span><del>-SOFT_LINK_PRIVATE_FRAMEWORK_OPTIONAL(DataDetectors)
-SOFT_LINK_CLASS(DataDetectors, DDActionsManager)
-SOFT_LINK_CONSTANT(DataDetectors, DDBinderPhoneNumberKey, CFStringRef)
-
-typedef void* DDActionContext;
-
-@interface DDActionsManager : NSObject
-+ (DDActionsManager *) sharedManager;
-- (NSArray *) menuItemsForValue:(NSString *)value type:(CFStringRef)type service:(NSString *)service context:(DDActionContext *)context;
-@end
-
</del><span class="cx"> #define MESSAGE_CHECK(assertion) MESSAGE_CHECK_BASE(assertion, process().connection())
</span><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="lines">@@ -647,8 +635,7 @@
</span><span class="cx"> #if ENABLE(TELEPHONE_NUMBER_DETECTION)
</span><span class="cx"> void WebPageProxy::showTelephoneNumberMenu(const String&amp; telephoneNumber, const WebCore::IntPoint&amp; point)
</span><span class="cx"> {
</span><del>-    NSArray *menuItems = [[getDDActionsManagerClass() sharedManager] menuItemsForValue:(NSString *)telephoneNumber type:getDDBinderPhoneNumberKey() service:nil context:nil];
-    menuItems = WKTelephoneNumberMenuFromProposedMenu(menuItems, telephoneNumber);
</del><ins>+    NSArray *menuItems = menuItemsForTelephoneNumber(telephoneNumber);
</ins><span class="cx"> 
</span><span class="cx">     Vector&lt;WebContextMenuItemData&gt; items;
</span><span class="cx">     for (NSMenuItem *item in menuItems) {
</span><span class="lines">@@ -667,10 +654,10 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><del>-void WebPageProxy::showSelectionServiceMenu(const IPC::DataReference&amp; selectionAsRTFD, bool isEditable, const IntPoint&amp; point)
</del><ins>+void WebPageProxy::showSelectionServiceMenu(const IPC::DataReference&amp; selectionAsRTFD, const Vector&lt;String&gt;&amp; telephoneNumbers, bool isEditable, const IntPoint&amp; point)
</ins><span class="cx"> {
</span><span class="cx">     Vector&lt;WebContextMenuItemData&gt; items;
</span><del>-    ContextMenuContextData contextData(selectionAsRTFD.vector(), isEditable);
</del><ins>+    ContextMenuContextData contextData(selectionAsRTFD.vector(), telephoneNumbers, isEditable);
</ins><span class="cx"> 
</span><span class="cx">     internalShowContextMenu(point, contextData, items, ContextMenuClientEligibility::NotEligibleForClient, nullptr);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebKit2xcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj (170781 => 170782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-07-04 00:36:07 UTC (rev 170781)
+++ trunk/Source/WebKit2/WebKit2.xcodeproj/project.pbxproj        2014-07-04 00:39:41 UTC (rev 170782)
</span><span class="lines">@@ -915,6 +915,8 @@
</span><span class="cx">                 518E8F0C16B2093700E91429 /* DownloadManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 518E8F0316B2093700E91429 /* DownloadManager.h */; };
</span><span class="cx">                 518E8F0D16B2093700E91429 /* DownloadMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 518E8F0516B2093700E91429 /* DownloadMac.mm */; };
</span><span class="cx">                 5192D5761961FD0300CD19AA /* ServicesOverlayController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5192D5751961FD0300CD19AA /* ServicesOverlayController.mm */; };
</span><ins>+                51933DEF1965EB31008AC3EA /* MenuUtilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 51933DEB1965EB24008AC3EA /* MenuUtilities.h */; };
+                51933DF01965EB31008AC3EA /* MenuUtilities.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51933DEC1965EB24008AC3EA /* MenuUtilities.mm */; };
</ins><span class="cx">                 51A4D5A916CAC4FF000E615E /* StatisticsRequest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A4D5A816CAC4FF000E615E /* StatisticsRequest.cpp */; };
</span><span class="cx">                 51A555F5128C6C47009ABCEC /* WKContextMenuItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51A555F3128C6C47009ABCEC /* WKContextMenuItem.cpp */; };
</span><span class="cx">                 51A555F6128C6C47009ABCEC /* WKContextMenuItem.h in Headers */ = {isa = PBXBuildFile; fileRef = 51A555F4128C6C47009ABCEC /* WKContextMenuItem.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="lines">@@ -2917,6 +2919,8 @@
</span><span class="cx">                 518E8F0516B2093700E91429 /* DownloadMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DownloadMac.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5192D5711961FA2F00CD19AA /* ServicesOverlayController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ServicesOverlayController.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 5192D5751961FD0300CD19AA /* ServicesOverlayController.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ServicesOverlayController.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                51933DEB1965EB24008AC3EA /* MenuUtilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MenuUtilities.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                51933DEC1965EB24008AC3EA /* MenuUtilities.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MenuUtilities.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 51A4D5A816CAC4FF000E615E /* StatisticsRequest.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StatisticsRequest.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51A555F3128C6C47009ABCEC /* WKContextMenuItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKContextMenuItem.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 51A555F4128C6C47009ABCEC /* WKContextMenuItem.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKContextMenuItem.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -4256,6 +4260,8 @@
</span><span class="cx">                                 BCE0937514FB128B001138D9 /* LayerHostingContext.mm */,
</span><span class="cx">                                 1A24B5F011F531E800C38269 /* MachUtilities.cpp */,
</span><span class="cx">                                 1A24B5F111F531E800C38269 /* MachUtilities.h */,
</span><ins>+                                51933DEB1965EB24008AC3EA /* MenuUtilities.h */,
+                                51933DEC1965EB24008AC3EA /* MenuUtilities.mm */,
</ins><span class="cx">                                 1A24BF39120896A600FBB059 /* SharedMemoryMac.cpp */,
</span><span class="cx">                                 296BD85B15019BC30071F424 /* StringUtilities.h */,
</span><span class="cx">                                 296BD85C15019BC30071F424 /* StringUtilities.mm */,
</span><span class="lines">@@ -7624,6 +7630,7 @@
</span><span class="cx">                                 BC5C75C814954DA600BC4775 /* WKConnectionInternal.h in Headers */,
</span><span class="cx">                                 BC4A6297147313A0006C681A /* WKConnectionRef.h in Headers */,
</span><span class="cx">                                 BCB9E24B1120E15C00A137E0 /* WKContext.h in Headers */,
</span><ins>+                                51933DEF1965EB31008AC3EA /* MenuUtilities.h in Headers */,
</ins><span class="cx">                                 3795789C18AD4F1900B9ED2E /* WKWebProcessPlugInFormDelegatePrivate.h in Headers */,
</span><span class="cx">                                 51A555F6128C6C47009ABCEC /* WKContextMenuItem.h in Headers */,
</span><span class="cx">                                 51A55601128C6D92009ABCEC /* WKContextMenuItemTypes.h in Headers */,
</span><span class="lines">@@ -9000,6 +9007,7 @@
</span><span class="cx">                                 51A4D5A916CAC4FF000E615E /* StatisticsRequest.cpp in Sources */,
</span><span class="cx">                                 1AD3306E16B1D991004F60E7 /* StorageAreaImpl.cpp in Sources */,
</span><span class="cx">                                 1ACECD2417162DB1001FC9EF /* StorageAreaMap.cpp in Sources */,
</span><ins>+                                51933DF01965EB31008AC3EA /* MenuUtilities.mm in Sources */,
</ins><span class="cx">                                 1A334DED16DE8F88006A8E38 /* StorageAreaMapMessageReceiver.cpp in Sources */,
</span><span class="cx">                                 1A44B95B16B73F9F00B7BBD8 /* StorageManager.cpp in Sources */,
</span><span class="cx">                                 1AB31A9616BC688100F6DBC9 /* StorageManagerMessageReceiver.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (170781 => 170782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-07-04 00:36:07 UTC (rev 170781)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2014-07-04 00:39:41 UTC (rev 170782)
</span><span class="lines">@@ -830,7 +830,7 @@
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION) 
</span><span class="cx">     ServicesOverlayController&amp; servicesOverlayController();
</span><span class="cx">     void handleTelephoneNumberClick(const String&amp; number, const WebCore::IntPoint&amp;);
</span><del>-    void handleSelectionServiceClick(WebCore::FrameSelection&amp;, const WebCore::IntPoint&amp;);
</del><ins>+    void handleSelectionServiceClick(WebCore::FrameSelection&amp;, const Vector&lt;String&gt;&amp; telephoneNumbers, const WebCore::IntPoint&amp;);
</ins><span class="cx">     bool serviceControlsEnabled() const { return m_serviceControlsEnabled; }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacServicesOverlayControllermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm (170781 => 170782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm        2014-07-04 00:36:07 UTC (rev 170781)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm        2014-07-04 00:39:41 UTC (rev 170782)
</span><span class="lines">@@ -278,8 +278,12 @@
</span><span class="cx"> void ServicesOverlayController::drawSelectionHighlight(WebCore::GraphicsContext&amp; graphicsContext, const WebCore::IntRect&amp; dirtyRect)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!m_drawingTelephoneNumberHighlight);
</span><del>-    ASSERT(m_currentSelectionRects.size());
</del><span class="cx"> 
</span><ins>+    // It's possible to end up drawing the selection highlight before we've actually received the selection rects.
+    // If that happens we'll end up here again once we have the rects.
+    if (m_currentSelectionRects.isEmpty())
+        return;
+
</ins><span class="cx">     // If there are no installed selection services and we have no phone numbers detected, then we have nothing to draw.
</span><span class="cx">     if (!WebProcess::shared().hasSelectionServices() &amp;&amp; m_currentTelephoneNumberRanges.isEmpty())
</span><span class="cx">         return;
</span><span class="lines">@@ -430,8 +434,12 @@
</span><span class="cx">         ASSERT(m_currentTelephoneNumberRanges.size() == 1);
</span><span class="cx">         m_webPage-&gt;handleTelephoneNumberClick(m_currentTelephoneNumberRanges[0]-&gt;text(), point);
</span><span class="cx">     } else {
</span><del>-        // FIXME: Include all selected telephone numbers so they can be added to the menu as well.
-        m_webPage-&gt;handleSelectionServiceClick(m_webPage-&gt;corePage()-&gt;mainFrame().selection(), point);
</del><ins>+        Vector&lt;String&gt; selectedTelephoneNumbers;
+        selectedTelephoneNumbers.reserveCapacity(m_currentTelephoneNumberRanges.size());
+        for (auto&amp; range : m_currentTelephoneNumberRanges)
+            selectedTelephoneNumbers.append(range-&gt;text());
+
+        m_webPage-&gt;handleSelectionServiceClick(m_webPage-&gt;corePage()-&gt;mainFrame().selection(), selectedTelephoneNumbers, point);
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacWebPageMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (170781 => 170782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2014-07-04 00:36:07 UTC (rev 170781)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm        2014-07-04 00:39:41 UTC (rev 170782)
</span><span class="lines">@@ -1022,7 +1022,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><del>-void WebPage::handleSelectionServiceClick(FrameSelection&amp; selection, const IntPoint&amp; point)
</del><ins>+void WebPage::handleSelectionServiceClick(FrameSelection&amp; selection, const Vector&lt;String&gt;&amp; phoneNumbers, const IntPoint&amp; point)
</ins><span class="cx"> {
</span><span class="cx">     RefPtr&lt;Range&gt; range = selection.selection().firstRange();
</span><span class="cx">     if (!range)
</span><span class="lines">@@ -1036,7 +1036,7 @@
</span><span class="cx">     IPC::DataReference data = IPC::DataReference(reinterpret_cast&lt;const uint8_t*&gt;([selectionData bytes]), [selectionData length]);
</span><span class="cx">     bool isEditable = selection.selection().isContentRichlyEditable();
</span><span class="cx"> 
</span><del>-    send(Messages::WebPageProxy::ShowSelectionServiceMenu(data, isEditable, point));
</del><ins>+    send(Messages::WebPageProxy::ShowSelectionServiceMenu(data, phoneNumbers, isEditable, point));
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>