<!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>[172303] branches/safari-600.1-branch/Source</title>
</head>
<body>

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

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/172301">r172301</a></pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchessafari6001branchSourceWebCoreChangeLog">branches/safari-600.1-branch/Source/WebCore/ChangeLog</a></li>
<li><a href="#branchessafari6001branchSourceWebCoreeditingSelectionRectGatherercpp">branches/safari-600.1-branch/Source/WebCore/editing/SelectionRectGatherer.cpp</a></li>
<li><a href="#branchessafari6001branchSourceWebCoreeditingSelectionRectGathererh">branches/safari-600.1-branch/Source/WebCore/editing/SelectionRectGatherer.h</a></li>
<li><a href="#branchessafari6001branchSourceWebCorepageEditorClienth">branches/safari-600.1-branch/Source/WebCore/page/EditorClient.h</a></li>
<li><a href="#branchessafari6001branchSourceWebCorerenderingRenderViewcpp">branches/safari-600.1-branch/Source/WebCore/rendering/RenderView.cpp</a></li>
<li><a href="#branchessafari6001branchSourceWebKit2ChangeLog">branches/safari-600.1-branch/Source/WebKit2/ChangeLog</a></li>
<li><a href="#branchessafari6001branchSourceWebKit2SharedWebProcessCreationParameterscpp">branches/safari-600.1-branch/Source/WebKit2/Shared/WebProcessCreationParameters.cpp</a></li>
<li><a href="#branchessafari6001branchSourceWebKit2SharedWebProcessCreationParametersh">branches/safari-600.1-branch/Source/WebKit2/Shared/WebProcessCreationParameters.h</a></li>
<li><a href="#branchessafari6001branchSourceWebKit2UIProcessmacServicesControllerh">branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ServicesController.h</a></li>
<li><a href="#branchessafari6001branchSourceWebKit2UIProcessmacServicesControllermm">branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ServicesController.mm</a></li>
<li><a href="#branchessafari6001branchSourceWebKit2WebProcessWebCoreSupportWebEditorClientcpp">branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp</a></li>
<li><a href="#branchessafari6001branchSourceWebKit2WebProcessWebCoreSupportWebEditorClienth">branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h</a></li>
<li><a href="#branchessafari6001branchSourceWebKit2WebProcessWebPageServicesOverlayControllerh">branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/ServicesOverlayController.h</a></li>
<li><a href="#branchessafari6001branchSourceWebKit2WebProcessWebPagemacServicesOverlayControllermm">branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm</a></li>
<li><a href="#branchessafari6001branchSourceWebKit2WebProcessWebProcesscpp">branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebProcess.cpp</a></li>
<li><a href="#branchessafari6001branchSourceWebKit2WebProcessWebProcessh">branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebProcess.h</a></li>
<li><a href="#branchessafari6001branchSourceWebKit2WebProcessWebProcessmessagesin">branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebProcess.messages.in</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6001branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebCore/ChangeLog (172302 => 172303)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebCore/ChangeLog        2014-08-07 23:08:59 UTC (rev 172302)
+++ branches/safari-600.1-branch/Source/WebCore/ChangeLog        2014-08-07 23:21:14 UTC (rev 172303)
</span><span class="lines">@@ -1,5 +1,33 @@
</span><span class="cx"> 2014-08-07  Dana Burkart &lt;dburkart@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r172301
+
+    2014-08-07  Enrica Casucci  &lt;enrica@apple.com&gt;
+
+            [Services with UI] Action menu does not appear if selection includes both text and an image.
+            https://bugs.webkit.org/show_bug.cgi?id=135731
+            &lt;rdar://problem/17837491&gt;
+
+            Reviewed by Brady Eidson.
+
+            When collecting selection rects via SelectionRectGatherer we should also note if the selection
+            contains non text elements. This way the Notifier class can send that information to ServicesOverlayController
+            to properly handle the highlight for the service.
+
+            * editing/SelectionRectGatherer.cpp:
+            (WebCore::SelectionRectGatherer::SelectionRectGatherer):
+            (WebCore::SelectionRectGatherer::Notifier::~Notifier):
+            (WebCore::SelectionRectGatherer::clearAndCreateNotifier):
+            * editing/SelectionRectGatherer.h:
+            (WebCore::SelectionRectGatherer::setTextOnly):
+            (WebCore::SelectionRectGatherer::isTextOnly):
+            * page/EditorClient.h:
+            (WebCore::EditorClient::selectionRectsDidChange):
+            * rendering/RenderView.cpp:
+            (WebCore::RenderView::applySubtreeSelection):
+
+2014-08-07  Dana Burkart &lt;dburkart@apple.com&gt;
+
</ins><span class="cx">         Merge r172293
</span><span class="cx"> 
</span><span class="cx">     2014-08-07  Andy Estes  &lt;aestes@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebCoreeditingSelectionRectGatherercpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebCore/editing/SelectionRectGatherer.cpp (172302 => 172303)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebCore/editing/SelectionRectGatherer.cpp        2014-08-07 23:08:59 UTC (rev 172302)
+++ branches/safari-600.1-branch/Source/WebCore/editing/SelectionRectGatherer.cpp        2014-08-07 23:21:14 UTC (rev 172303)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> 
</span><span class="cx"> SelectionRectGatherer::SelectionRectGatherer(RenderView&amp; renderView)
</span><span class="cx">     : m_renderView(renderView)
</span><ins>+    , m_isTextOnly(true)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -70,13 +71,14 @@
</span><span class="cx"> SelectionRectGatherer::Notifier::~Notifier()
</span><span class="cx"> {
</span><span class="cx">     if (EditorClient* client = m_gatherer.m_renderView.view().frame().editor().client())
</span><del>-        client-&gt;selectionRectsDidChange(m_gatherer.m_rects, m_gatherer.m_gapRects);
</del><ins>+        client-&gt;selectionRectsDidChange(m_gatherer.m_rects, m_gatherer.m_gapRects, m_gatherer.isTextOnly());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;SelectionRectGatherer::Notifier&gt; SelectionRectGatherer::clearAndCreateNotifier()
</span><span class="cx"> {
</span><span class="cx">     m_rects.clear();
</span><span class="cx">     m_gapRects.clear();
</span><ins>+    m_isTextOnly = true;
</ins><span class="cx"> 
</span><span class="cx">     return std::make_unique&lt;Notifier&gt;(*this);
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebCoreeditingSelectionRectGathererh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebCore/editing/SelectionRectGatherer.h (172302 => 172303)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebCore/editing/SelectionRectGatherer.h        2014-08-07 23:08:59 UTC (rev 172302)
+++ branches/safari-600.1-branch/Source/WebCore/editing/SelectionRectGatherer.h        2014-08-07 23:21:14 UTC (rev 172303)
</span><span class="lines">@@ -47,6 +47,8 @@
</span><span class="cx"> 
</span><span class="cx">     void addRect(RenderLayerModelObject *repaintContainer, const LayoutRect&amp;);
</span><span class="cx">     void addGapRects(RenderLayerModelObject *repaintContainer, const GapRects&amp;);
</span><ins>+    void setTextOnly(bool isTextOnly) { m_isTextOnly = isTextOnly; }
+    bool isTextOnly() const { return m_isTextOnly; }
</ins><span class="cx"> 
</span><span class="cx">     class Notifier {
</span><span class="cx">         WTF_MAKE_NONCOPYABLE(Notifier);
</span><span class="lines">@@ -66,6 +68,7 @@
</span><span class="cx">     // All rects are in RenderView coordinates.
</span><span class="cx">     Vector&lt;LayoutRect&gt; m_rects;
</span><span class="cx">     Vector&lt;GapRects&gt; m_gapRects;
</span><ins>+    bool m_isTextOnly;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebCorepageEditorClienth"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebCore/page/EditorClient.h (172302 => 172303)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebCore/page/EditorClient.h        2014-08-07 23:08:59 UTC (rev 172302)
+++ branches/safari-600.1-branch/Source/WebCore/page/EditorClient.h        2014-08-07 23:21:14 UTC (rev 172303)
</span><span class="lines">@@ -183,7 +183,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS) || ENABLE(TELEPHONE_NUMBER_DETECTION)
</span><span class="cx">     virtual void selectedTelephoneNumberRangesChanged(const Vector&lt;RefPtr&lt;Range&gt;&gt;&amp;) { }
</span><del>-    virtual void selectionRectsDidChange(const Vector&lt;LayoutRect&gt;&amp;, const Vector&lt;GapRects&gt;&amp;) { }
</del><ins>+    virtual void selectionRectsDidChange(const Vector&lt;LayoutRect&gt;&amp;, const Vector&lt;GapRects&gt;&amp;, bool) { }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     // Support for global selections, used on platforms like the X Window System that treat
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebCorerenderingRenderViewcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebCore/rendering/RenderView.cpp (172302 => 172303)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebCore/rendering/RenderView.cpp        2014-08-07 23:08:59 UTC (rev 172302)
+++ branches/safari-600.1-branch/Source/WebCore/rendering/RenderView.cpp        2014-08-07 23:21:14 UTC (rev 172303)
</span><span class="lines">@@ -996,6 +996,8 @@
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><span class="cx">             for (auto&amp; rect : selectionInfo-&gt;rects())
</span><span class="cx">                 m_selectionRectGatherer.addRect(selectionInfo-&gt;repaintContainer(), rect);
</span><ins>+            if (!o-&gt;isTextOrLineBreak())
+                m_selectionRectGatherer.setTextOnly(false);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">             newSelectedObjects.set(o, WTF::move(selectionInfo));
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebKit2/ChangeLog (172302 => 172303)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebKit2/ChangeLog        2014-08-07 23:08:59 UTC (rev 172302)
+++ branches/safari-600.1-branch/Source/WebKit2/ChangeLog        2014-08-07 23:21:14 UTC (rev 172303)
</span><span class="lines">@@ -1,5 +1,48 @@
</span><span class="cx"> 2014-08-07  Dana Burkart &lt;dburkart@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Merge r172301
+
+    2014-08-07  Enrica Casucci  &lt;enrica@apple.com&gt;
+
+            [Services with UI] Action menu does not appear if selection includes both text and an image.
+            https://bugs.webkit.org/show_bug.cgi?id=135731
+            &lt;rdar://problem/17837491&gt;
+
+            Reviewed by Brady Eidson.
+
+            Adding a new setting to ServicesController to communicate to the WebProcess if
+            there are services installed that can handle a combination of text and images.
+            This way ServicesOverlayController can decide if it appropriate to show the hightlight
+            based on the type of selection (text only or non text only). This information is retrieved
+            when the selection rects are collected by SelectionGatherer and used by
+            SelectionGatherer::Notifier to communicate the selection change.
+
+            * Shared/WebProcessCreationParameters.cpp:
+            (WebKit::WebProcessCreationParameters::WebProcessCreationParameters):
+            * Shared/WebProcessCreationParameters.h:
+            * UIProcess/mac/ServicesController.h:
+            (WebKit::ServicesController::hasRichContentServices):
+            * UIProcess/mac/ServicesController.mm:
+            (WebKit::ServicesController::ServicesController):
+            (WebKit::ServicesController::refreshExistingServices):
+            * WebProcess/WebCoreSupport/WebEditorClient.cpp:
+            (WebKit::WebEditorClient::selectionRectsDidChange):
+            * WebProcess/WebCoreSupport/WebEditorClient.h:
+            * WebProcess/WebPage/ServicesOverlayController.h:
+            * WebProcess/WebPage/mac/ServicesOverlayController.mm:
+            (WebKit::ServicesOverlayController::ServicesOverlayController):
+            (WebKit::ServicesOverlayController::selectionRectsDidChange):
+            (WebKit::ServicesOverlayController::drawSelectionHighlight):
+            * WebProcess/WebProcess.cpp:
+            (WebKit::WebProcess::WebProcess):
+            (WebKit::WebProcess::initializeWebProcess):
+            (WebKit::WebProcess::setEnabledServices):
+            * WebProcess/WebProcess.h:
+            (WebKit::WebProcess::hasRichContentServices):
+            * WebProcess/WebProcess.messages.in:
+
+2014-08-07  Dana Burkart &lt;dburkart@apple.com&gt;
+
</ins><span class="cx">         Merge r172241
</span><span class="cx"> 
</span><span class="cx">     2014-08-07  Timothy Hatcher  &lt;timothy@apple.com&gt;
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebKit2SharedWebProcessCreationParameterscpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebKit2/Shared/WebProcessCreationParameters.cpp (172302 => 172303)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebKit2/Shared/WebProcessCreationParameters.cpp        2014-08-07 23:08:59 UTC (rev 172302)
+++ branches/safari-600.1-branch/Source/WebKit2/Shared/WebProcessCreationParameters.cpp        2014-08-07 23:21:14 UTC (rev 172303)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><span class="cx">     , hasImageServices(false)
</span><span class="cx">     , hasSelectionServices(false)
</span><ins>+    , hasRichContentServices(false)
</ins><span class="cx"> #endif
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebKit2SharedWebProcessCreationParametersh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebKit2/Shared/WebProcessCreationParameters.h (172302 => 172303)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebKit2/Shared/WebProcessCreationParameters.h        2014-08-07 23:08:59 UTC (rev 172302)
+++ branches/safari-600.1-branch/Source/WebKit2/Shared/WebProcessCreationParameters.h        2014-08-07 23:21:14 UTC (rev 172303)
</span><span class="lines">@@ -168,6 +168,7 @@
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><span class="cx">     bool hasImageServices;
</span><span class="cx">     bool hasSelectionServices;
</span><ins>+    bool hasRichContentServices;
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebKit2UIProcessmacServicesControllerh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ServicesController.h (172302 => 172303)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ServicesController.h        2014-08-07 23:08:59 UTC (rev 172302)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ServicesController.h        2014-08-07 23:21:14 UTC (rev 172303)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool hasImageServices() const { return m_hasImageServices; }
</span><span class="cx">     bool hasSelectionServices() const { return m_hasSelectionServices; }
</span><ins>+    bool hasRichContentServices() const { return m_hasRichContentServices; }
</ins><span class="cx"> 
</span><span class="cx">     void refreshExistingServices(WebContext*);
</span><span class="cx"> 
</span><span class="lines">@@ -58,6 +59,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool m_hasImageServices;
</span><span class="cx">     bool m_hasSelectionServices;
</span><ins>+    bool m_hasRichContentServices;
</ins><span class="cx"> 
</span><span class="cx">     HashSet&lt;RefPtr&lt;WebContext&gt;&gt; m_contextsToNotify;
</span><span class="cx"> };
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebKit2UIProcessmacServicesControllermm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ServicesController.mm (172302 => 172303)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ServicesController.mm        2014-08-07 23:08:59 UTC (rev 172302)
+++ branches/safari-600.1-branch/Source/WebKit2/UIProcess/mac/ServicesController.mm        2014-08-07 23:21:14 UTC (rev 172303)
</span><span class="lines">@@ -61,6 +61,7 @@
</span><span class="cx">     , m_isRefreshing(false)
</span><span class="cx">     , m_hasImageServices(false)
</span><span class="cx">     , m_hasSelectionServices(false)
</span><ins>+    , m_hasRichContentServices(false)
</ins><span class="cx"> {
</span><span class="cx">     refreshExistingServices();
</span><span class="cx"> }
</span><span class="lines">@@ -93,14 +94,30 @@
</span><span class="cx"> 
</span><span class="cx">         bool hasSelectionServices = picker.get().menu;
</span><span class="cx"> 
</span><ins>+        static NSAttributedString *attributedStringWithRichContent;
+        if (!attributedStringWithRichContent) {
+            NSTextAttachment *attachment = [[NSTextAttachment alloc] init];
+            NSTextAttachmentCell *cell = [[NSTextAttachmentCell alloc] initImageCell:image.get()];
+            [attachment setAttachmentCell:cell];
+            NSMutableAttributedString *richString = (NSMutableAttributedString *)[NSMutableAttributedString attributedStringWithAttachment:attachment];
+            [richString appendAttributedString: attributedString];
+            attributedStringWithRichContent = [richString retain];
+        }
+
+        picker = adoptNS([[NSSharingServicePicker alloc] initWithItems:@[ attributedStringWithRichContent ]]);
+        [picker setStyle:NSSharingServicePickerStyleTextSelection];
+
+        bool hasRichContentServices = picker.get().menu;
+        
</ins><span class="cx">         dispatch_async(dispatch_get_main_queue(), ^{
</span><del>-            bool notifyContexts = (hasImageServices != m_hasImageServices) || (hasSelectionServices != m_hasSelectionServices);
</del><ins>+            bool notifyContexts = (hasImageServices != m_hasImageServices) || (hasSelectionServices != m_hasSelectionServices) || (hasRichContentServices != m_hasRichContentServices);
</ins><span class="cx">             m_hasSelectionServices = hasSelectionServices;
</span><span class="cx">             m_hasImageServices = hasImageServices;
</span><ins>+            m_hasRichContentServices = hasRichContentServices;
</ins><span class="cx"> 
</span><span class="cx">             if (notifyContexts) {
</span><span class="cx">                 for (const RefPtr&lt;WebContext&gt;&amp; context : m_contextsToNotify)
</span><del>-                    context-&gt;sendToAllProcesses(Messages::WebProcess::SetEnabledServices(m_hasImageServices, m_hasSelectionServices));
</del><ins>+                    context-&gt;sendToAllProcesses(Messages::WebProcess::SetEnabledServices(m_hasImageServices, m_hasSelectionServices, m_hasRichContentServices));
</ins><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             m_contextsToNotify.clear();
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebKit2WebProcessWebCoreSupportWebEditorClientcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp (172302 => 172303)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp        2014-08-07 23:08:59 UTC (rev 172302)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.cpp        2014-08-07 23:21:14 UTC (rev 172303)
</span><span class="lines">@@ -538,11 +538,11 @@
</span><span class="cx">     m_page-&gt;servicesOverlayController().selectedTelephoneNumberRangesChanged(ranges);
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><del>-void WebEditorClient::selectionRectsDidChange(const Vector&lt;LayoutRect&gt;&amp; rects, const Vector&lt;GapRects&gt;&amp; gapRects)
</del><ins>+void WebEditorClient::selectionRectsDidChange(const Vector&lt;LayoutRect&gt;&amp; rects, const Vector&lt;GapRects&gt;&amp; gapRects, bool isTextOnly)
</ins><span class="cx"> {
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     if (m_page-&gt;serviceControlsEnabled())
</span><del>-        m_page-&gt;servicesOverlayController().selectionRectsDidChange(rects, gapRects);
</del><ins>+        m_page-&gt;servicesOverlayController().selectionRectsDidChange(rects, gapRects, isTextOnly);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> #endif // ENABLE(SERVICE_CONTROLS) &amp;&amp; ENABLE(TELEPHONE_NUMBER_DETECTION)
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebKit2WebProcessWebCoreSupportWebEditorClienth"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h (172302 => 172303)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h        2014-08-07 23:08:59 UTC (rev 172302)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebCoreSupport/WebEditorClient.h        2014-08-07 23:21:14 UTC (rev 172303)
</span><span class="lines">@@ -170,7 +170,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(TELEPHONE_NUMBER_DETECTION) || ENABLE(SERVICE_CONTROLS)
</span><span class="cx">     virtual void selectedTelephoneNumberRangesChanged(const Vector&lt;RefPtr&lt;WebCore::Range&gt;&gt;&amp;) override;
</span><del>-    virtual void selectionRectsDidChange(const Vector&lt;WebCore::LayoutRect&gt;&amp;, const Vector&lt;WebCore::GapRects&gt;&amp;) override;
</del><ins>+    virtual void selectionRectsDidChange(const Vector&lt;WebCore::LayoutRect&gt;&amp;, const Vector&lt;WebCore::GapRects&gt;&amp;, bool isTextOnly) override;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     WebPage* m_page;
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebKit2WebProcessWebPageServicesOverlayControllerh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/ServicesOverlayController.h (172302 => 172303)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/ServicesOverlayController.h        2014-08-07 23:08:59 UTC (rev 172302)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/ServicesOverlayController.h        2014-08-07 23:21:14 UTC (rev 172303)
</span><span class="lines">@@ -63,7 +63,7 @@
</span><span class="cx">     ~ServicesOverlayController();
</span><span class="cx"> 
</span><span class="cx">     void selectedTelephoneNumberRangesChanged(const Vector&lt;RefPtr&lt;WebCore::Range&gt;&gt;&amp;);
</span><del>-    void selectionRectsDidChange(const Vector&lt;WebCore::LayoutRect&gt;&amp;, const Vector&lt;WebCore::GapRects&gt;&amp;);
</del><ins>+    void selectionRectsDidChange(const Vector&lt;WebCore::LayoutRect&gt;&amp;, const Vector&lt;WebCore::GapRects&gt;&amp;, bool isTextOnly);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     void createOverlayIfNeeded();
</span><span class="lines">@@ -95,6 +95,7 @@
</span><span class="cx">     
</span><span class="cx">     Vector&lt;WebCore::LayoutRect&gt; m_currentSelectionRects;
</span><span class="cx">     RetainPtr&lt;DDHighlightRef&gt; m_selectionHighlight;
</span><ins>+    bool m_isTextOnly;
</ins><span class="cx">     std::chrono::steady_clock::time_point m_lastSelectionChangeTime;
</span><span class="cx">     std::chrono::steady_clock::time_point m_lastHoveredHighlightChangeTime;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebKit2WebProcessWebPagemacServicesOverlayControllermm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm (172302 => 172303)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm        2014-08-07 23:08:59 UTC (rev 172302)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm        2014-08-07 23:21:14 UTC (rev 172303)
</span><span class="lines">@@ -76,6 +76,7 @@
</span><span class="cx"> ServicesOverlayController::ServicesOverlayController(WebPage&amp; webPage)
</span><span class="cx">     : m_webPage(&amp;webPage)
</span><span class="cx">     , m_servicesOverlay(nullptr)
</span><ins>+    , m_isTextOnly(false)
</ins><span class="cx">     , m_repaintHighlightTimer(this, &amp;ServicesOverlayController::repaintHighlightTimerFired)
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -211,11 +212,12 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ServicesOverlayController::selectionRectsDidChange(const Vector&lt;LayoutRect&gt;&amp; rects, const Vector&lt;GapRects&gt;&amp; gapRects)
</del><ins>+void ServicesOverlayController::selectionRectsDidChange(const Vector&lt;LayoutRect&gt;&amp; rects, const Vector&lt;GapRects&gt;&amp; gapRects, bool isTextOnly)
</ins><span class="cx"> {
</span><span class="cx"> #if __MAC_OS_X_VERSION_MIN_REQUIRED &gt; 1090
</span><span class="cx">     clearSelectionHighlight();
</span><span class="cx">     m_currentSelectionRects = rects;
</span><ins>+    m_isTextOnly = isTextOnly;
</ins><span class="cx"> 
</span><span class="cx">     m_lastSelectionChangeTime = std::chrono::steady_clock::now();
</span><span class="cx"> 
</span><span class="lines">@@ -271,7 +273,7 @@
</span><span class="cx"> {
</span><span class="cx">     // It's possible to end up drawing the selection highlight before we've actually received the selection rects.
</span><span class="cx">     // If that happens we'll end up here again once we have the rects.
</span><del>-    if (m_currentSelectionRects.isEmpty())
</del><ins>+    if (m_currentSelectionRects.isEmpty() || (!WebProcess::shared().hasRichContentServices() &amp;&amp; !m_isTextOnly))
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><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></pre></div>
<a id="branchessafari6001branchSourceWebKit2WebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebProcess.cpp (172302 => 172303)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebProcess.cpp        2014-08-07 23:08:59 UTC (rev 172302)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebProcess.cpp        2014-08-07 23:21:14 UTC (rev 172303)
</span><span class="lines">@@ -174,6 +174,7 @@
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><span class="cx">     , m_hasImageServices(false)
</span><span class="cx">     , m_hasSelectionServices(false)
</span><ins>+    , m_hasRichContentServices(false)
</ins><span class="cx"> #endif
</span><span class="cx">     , m_nonVisibleProcessCleanupTimer(this, &amp;WebProcess::nonVisibleProcessCleanupTimerFired)
</span><span class="cx"> {
</span><span class="lines">@@ -364,7 +365,7 @@
</span><span class="cx">     setMemoryCacheDisabled(parameters.memoryCacheDisabled);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><del>-    setEnabledServices(parameters.hasImageServices, parameters.hasSelectionServices);
</del><ins>+    setEnabledServices(parameters.hasImageServices, parameters.hasSelectionServices, parameters.hasRichContentServices);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(REMOTE_INSPECTOR)
</span><span class="lines">@@ -1251,10 +1252,11 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><del>-void WebProcess::setEnabledServices(bool hasImageServices, bool hasSelectionServices)
</del><ins>+void WebProcess::setEnabledServices(bool hasImageServices, bool hasSelectionServices, bool hasRichContentServices)
</ins><span class="cx"> {
</span><span class="cx">     m_hasImageServices = hasImageServices;
</span><span class="cx">     m_hasSelectionServices = hasSelectionServices;
</span><ins>+    m_hasRichContentServices = hasRichContentServices;
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebKit2WebProcessWebProcessh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebProcess.h (172302 => 172303)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebProcess.h        2014-08-07 23:08:59 UTC (rev 172302)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebProcess.h        2014-08-07 23:21:14 UTC (rev 172303)
</span><span class="lines">@@ -189,6 +189,7 @@
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><span class="cx">     bool hasImageServices() const { return m_hasImageServices; }
</span><span class="cx">     bool hasSelectionServices() const { return m_hasSelectionServices; }
</span><ins>+    bool hasRichContentServices() const { return m_hasRichContentServices; }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -252,7 +253,7 @@
</span><span class="cx">     void setMemoryCacheDisabled(bool);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><del>-    void setEnabledServices(bool hasImageServices, bool hasSelectionServices);
</del><ins>+    void setEnabledServices(bool hasImageServices, bool hasSelectionServices, bool hasRichContentServices);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     void postInjectedBundleMessage(const IPC::DataReference&amp; messageData);
</span><span class="lines">@@ -339,6 +340,7 @@
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><span class="cx">     bool m_hasImageServices;
</span><span class="cx">     bool m_hasSelectionServices;
</span><ins>+    bool m_hasRichContentServices;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     HashSet&lt;uint64_t&gt; m_pagesInWindows;
</span></span></pre></div>
<a id="branchessafari6001branchSourceWebKit2WebProcessWebProcessmessagesin"></a>
<div class="modfile"><h4>Modified: branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebProcess.messages.in (172302 => 172303)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebProcess.messages.in        2014-08-07 23:08:59 UTC (rev 172302)
+++ branches/safari-600.1-branch/Source/WebKit2/WebProcess/WebProcess.messages.in        2014-08-07 23:21:14 UTC (rev 172303)
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx">     SetMemoryCacheDisabled(bool disabled);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(SERVICE_CONTROLS)
</span><del>-    SetEnabledServices(bool hasImageServices, bool hasSelectionServices)
</del><ins>+    SetEnabledServices(bool hasImageServices, bool hasSelectionServices, bool hasRichContentServices)
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     ProcessWillSuspend()
</span></span></pre>
</div>
</div>

</body>
</html>