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

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

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/176999">r176999</a>. rdar://problems/19149219</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="#branchessafari6003branchSourceWebCorerenderingHitTestResultcpp">branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.cpp</a></li>
<li><a href="#branchessafari6003branchSourceWebCorerenderingHitTestResulth">branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacChangeLog">branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacWebViewWebActionMenuControllermm">branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacWebViewWebViewmm">branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2ChangeLog">branches/safari-600.3-branch/Source/WebKit2/ChangeLog</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="#branchessafari6003branchSourceWebKit2UIProcessAPImacWKViewmm">branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKit2UIProcessmacWKActionMenuControllermm">branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchessafari6003branchSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/ChangeLog (177108 => 177109)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/ChangeLog        2014-12-10 23:31:09 UTC (rev 177108)
+++ branches/safari-600.3-branch/Source/WebCore/ChangeLog        2014-12-10 23:35:26 UTC (rev 177109)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2014-12-10  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r176999. rdar://problem/19149219
+
+    2014-12-08  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+            Copy and Lookup menu items should be disabled when something is not copyable
+            https://bugs.webkit.org/show_bug.cgi?id=139423
+
+            Reviewed by Tim Horton.
+
+            New function allowCopy() indicates whether the HitTestResult would allow itself to 
+            be copied onto the pasteboard.
+            * WebCore.exp.in:
+            * rendering/HitTestResult.cpp:
+            (WebCore::HitTestResult::allowsCopy):
+            * rendering/HitTestResult.h:
+
</ins><span class="cx"> 2014-10-29  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Crash in CachedRawResource::canReuse() when reloading http://dnd.wizards.com/dungeons-and-dragons/story
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in (177108 => 177109)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in        2014-12-10 23:31:09 UTC (rev 177108)
+++ branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in        2014-12-10 23:35:26 UTC (rev 177109)
</span><span class="lines">@@ -1665,6 +1665,7 @@
</span><span class="cx"> __ZNK7WebCore13GraphicsLayer26backingStoreMemoryEstimateEv
</span><span class="cx"> __ZNK7WebCore13HTTPHeaderMap3getENS_14HTTPHeaderNameE
</span><span class="cx"> __ZNK7WebCore13HTTPHeaderMap3getERKN3WTF6StringE
</span><ins>+__ZNK7WebCore13HitTestResult10allowsCopyEv
</ins><span class="cx"> __ZNK7WebCore13HitTestResult10isLiveLinkEv
</span><span class="cx"> __ZNK7WebCore13HitTestResult10isSelectedEv
</span><span class="cx"> __ZNK7WebCore13HitTestResult11targetFrameEv
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCorerenderingHitTestResultcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.cpp (177108 => 177109)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.cpp        2014-12-10 23:31:09 UTC (rev 177108)
+++ branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.cpp        2014-12-10 23:35:26 UTC (rev 177109)
</span><span class="lines">@@ -544,6 +544,21 @@
</span><span class="cx">     return !wordRange-&gt;text().isEmpty();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool HitTestResult::allowsCopy() const
+{
+    Node* node = innerNode();
+    if (!node)
+        return false;
+
+    RenderObject* renderer = node-&gt;renderer();
+    if (!renderer)
+        return false;
+
+    bool isUserSelectNone = renderer-&gt;style().userSelect() == SELECT_NONE;
+    bool isPasswordField = isHTMLInputElement(node) &amp;&amp; toHTMLInputElement(node)-&gt;isPasswordField();
+    return !isPasswordField &amp;&amp; !isUserSelectNone;
+}
+
</ins><span class="cx"> URL HitTestResult::absoluteLinkURL() const
</span><span class="cx"> {
</span><span class="cx">     if (m_innerURLElement)
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCorerenderingHitTestResulth"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.h (177108 => 177109)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.h        2014-12-10 23:31:09 UTC (rev 177108)
+++ branches/safari-600.3-branch/Source/WebCore/rendering/HitTestResult.h        2014-12-10 23:35:26 UTC (rev 177109)
</span><span class="lines">@@ -126,6 +126,7 @@
</span><span class="cx">     void toggleMediaMuteState() const;
</span><span class="cx">     bool isDownloadableMedia() const;
</span><span class="cx">     bool isOverTextInsideFormControlElement() const;
</span><ins>+    bool allowsCopy() const;
</ins><span class="cx"> 
</span><span class="cx">     // Returns true if it is rect-based hit test and needs to continue until the rect is fully
</span><span class="cx">     // enclosed by the boundaries of a node.
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog (177108 => 177109)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog        2014-12-10 23:31:09 UTC (rev 177108)
+++ branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog        2014-12-10 23:35:26 UTC (rev 177109)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2014-12-10  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r176999. rdar://problem/19149219
+
+    2014-12-08  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+            Copy and Lookup menu items should be disabled when something is not copyable
+            https://bugs.webkit.org/show_bug.cgi?id=139423
+
+            Reviewed by Tim Horton.
+
+            Disable both lookup and copy when a HitTestResult does not allow copy.
+            * WebView/WebActionMenuController.mm:
+
+            Set autoenablesItems to NO. It’s messing with our ability to control the enable/
+            disable state otherwise.
+            * WebView/WebView.mm:
+            (-[WebView _commonInitializationWithFrameName:groupName:]):
+
</ins><span class="cx"> 2014-12-08  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r176856. &lt;rdar://problem/19157955&gt;
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacWebViewWebActionMenuControllermm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm (177108 => 177109)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm        2014-12-10 23:31:09 UTC (rev 177108)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm        2014-12-10 23:35:26 UTC (rev 177109)
</span><span class="lines">@@ -764,13 +764,14 @@
</span><span class="cx">         selector = @selector(_copySelection:);
</span><span class="cx">         title = WEB_UI_STRING_KEY(&quot;Copy&quot;, &quot;Copy (text action menu item)&quot;, &quot;text action menu item&quot;);
</span><span class="cx">         image = [NSImage imageNamed:@&quot;NSActionMenuCopy&quot;];
</span><ins>+        enabled = _hitTestResult.allowsCopy();
</ins><span class="cx">         break;
</span><span class="cx"> 
</span><span class="cx">     case WebActionMenuItemTagLookupText:
</span><span class="cx">         selector = @selector(_lookupText:);
</span><span class="cx">         title = WEB_UI_STRING_KEY(&quot;Look Up&quot;, &quot;Look Up (action menu item)&quot;, &quot;action menu item&quot;);
</span><span class="cx">         image = [NSImage imageNamed:@&quot;NSActionMenuLookup&quot;];
</span><del>-        enabled = getLULookupDefinitionModuleClass();
</del><ins>+        enabled = getLULookupDefinitionModuleClass() &amp;&amp; _hitTestResult.allowsCopy();
</ins><span class="cx">         break;
</span><span class="cx"> 
</span><span class="cx">     case WebActionMenuItemTagPaste:
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm (177108 => 177109)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm        2014-12-10 23:31:09 UTC (rev 177108)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebView.mm        2014-12-10 23:35:26 UTC (rev 177109)
</span><span class="lines">@@ -893,6 +893,7 @@
</span><span class="cx">         RetainPtr&lt;NSMenu&gt; actionMenu = adoptNS([[NSMenu alloc] init]);
</span><span class="cx">         self.actionMenu = actionMenu.get();
</span><span class="cx">         _private-&gt;actionMenuController = [[WebActionMenuController alloc] initWithWebView:self];
</span><ins>+        self.actionMenu.autoenablesItems = NO;
</ins><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/ChangeLog (177108 => 177109)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/ChangeLog        2014-12-10 23:31:09 UTC (rev 177108)
+++ branches/safari-600.3-branch/Source/WebKit2/ChangeLog        2014-12-10 23:35:26 UTC (rev 177109)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2014-12-10  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
+
+        Merge r176999. rdar://problem/19149219
+
+    2014-12-08  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+            Copy and Lookup menu items should be disabled when something is not copyable
+            https://bugs.webkit.org/show_bug.cgi?id=139423
+
+            Reviewed by Tim Horton.
+
+            Add allowsCopy to the WebHitTestResult.
+            * Shared/WebHitTestResult.cpp:
+            (WebKit::WebHitTestResult::Data::Data):
+            (WebKit::WebHitTestResult::Data::encode):
+            (WebKit::WebHitTestResult::Data::decode):
+            * Shared/WebHitTestResult.h:
+            (WebKit::WebHitTestResult::allowsCopy):
+
+            Set autoenablesItems to NO. It’s messing with our ability to control the enable/
+            disable state otherwise.
+            * UIProcess/API/mac/WKView.mm:
+            (-[WKView initWithFrame:context:configuration:webView:]):
+
+            Disable both lookup and copy when a WebHitTestResult does not allow copy.
+            * UIProcess/mac/WKActionMenuController.mm:
+
</ins><span class="cx"> 2014-12-08  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r176883. &lt;rdar://problem/19158331&gt;
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2SharedWebHitTestResultcpp"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.cpp (177108 => 177109)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.cpp        2014-12-10 23:31:09 UTC (rev 177108)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.cpp        2014-12-10 23:35:26 UTC (rev 177109)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx">     , isSelected(hitTestResult.isSelected())
</span><span class="cx">     , isTextNode(hitTestResult.innerNode() &amp;&amp; hitTestResult.innerNode()-&gt;isTextNode())
</span><span class="cx">     , isOverTextInsideFormControlElement(hitTestResult.isOverTextInsideFormControlElement())
</span><ins>+    , allowsCopy(hitTestResult.allowsCopy())
</ins><span class="cx">     , isDownloadableMedia(hitTestResult.isDownloadableMedia())
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="lines">@@ -77,6 +78,7 @@
</span><span class="cx">     encoder &lt;&lt; isSelected;
</span><span class="cx">     encoder &lt;&lt; isTextNode;
</span><span class="cx">     encoder &lt;&lt; isOverTextInsideFormControlElement;
</span><ins>+    encoder &lt;&lt; allowsCopy;
</ins><span class="cx">     encoder &lt;&lt; isDownloadableMedia;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -94,6 +96,7 @@
</span><span class="cx">         || !decoder.decode(hitTestResultData.isSelected)
</span><span class="cx">         || !decoder.decode(hitTestResultData.isTextNode)
</span><span class="cx">         || !decoder.decode(hitTestResultData.isOverTextInsideFormControlElement)
</span><ins>+        || !decoder.decode(hitTestResultData.allowsCopy)
</ins><span class="cx">         || !decoder.decode(hitTestResultData.isDownloadableMedia))
</span><span class="cx">         return false;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2SharedWebHitTestResulth"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.h (177108 => 177109)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.h        2014-12-10 23:31:09 UTC (rev 177108)
+++ branches/safari-600.3-branch/Source/WebKit2/Shared/WebHitTestResult.h        2014-12-10 23:35:26 UTC (rev 177109)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx">         bool isSelected;
</span><span class="cx">         bool isTextNode;
</span><span class="cx">         bool isOverTextInsideFormControlElement;
</span><ins>+        bool allowsCopy;
</ins><span class="cx">         bool isDownloadableMedia;
</span><span class="cx"> 
</span><span class="cx">         Data();
</span><span class="lines">@@ -89,6 +90,8 @@
</span><span class="cx"> 
</span><span class="cx">     bool isOverTextInsideFormControlElement() const { return m_data.isOverTextInsideFormControlElement; }
</span><span class="cx"> 
</span><ins>+    bool allowsCopy() const { return m_data.allowsCopy; }
+
</ins><span class="cx">     bool isDownloadableMedia() const { return m_data.isDownloadableMedia; }
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2UIProcessAPImacWKViewmm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm (177108 => 177109)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-12-10 23:31:09 UTC (rev 177108)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/API/mac/WKView.mm        2014-12-10 23:35:26 UTC (rev 177109)
</span><span class="lines">@@ -3600,6 +3600,7 @@
</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><span class="cx">         self.actionMenu.delegate = _data-&gt;_actionMenuController.get();
</span><ins>+        self.actionMenu.autoenablesItems = NO;
</ins><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKit2UIProcessmacWKActionMenuControllermm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (177108 => 177109)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm        2014-12-10 23:31:09 UTC (rev 177108)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm        2014-12-10 23:35:26 UTC (rev 177109)
</span><span class="lines">@@ -981,6 +981,7 @@
</span><span class="cx">     NSString *title = nil;
</span><span class="cx">     NSImage *image = nil;
</span><span class="cx">     bool enabled = true;
</span><ins>+    RefPtr&lt;WebHitTestResult&gt; hitTestResult = [self _webHitTestResult];
</ins><span class="cx"> 
</span><span class="cx">     switch (tag) {
</span><span class="cx">     case kWKContextActionItemTagOpenLinkInDefaultBrowser:
</span><span class="lines">@@ -1030,13 +1031,14 @@
</span><span class="cx">         selector = @selector(_copySelection:);
</span><span class="cx">         title = WEB_UI_STRING_KEY(&quot;Copy&quot;, &quot;Copy (text action menu item)&quot;, &quot;text action menu item&quot;);
</span><span class="cx">         image = [NSImage imageNamed:@&quot;NSActionMenuCopy&quot;];
</span><ins>+        enabled = hitTestResult-&gt;allowsCopy();
</ins><span class="cx">         break;
</span><span class="cx"> 
</span><span class="cx">     case kWKContextActionItemTagLookupText:
</span><span class="cx">         selector = @selector(_lookupText:);
</span><span class="cx">         title = WEB_UI_STRING_KEY(&quot;Look Up&quot;, &quot;Look Up (action menu item)&quot;, &quot;action menu item&quot;);
</span><span class="cx">         image = [NSImage imageNamed:@&quot;NSActionMenuLookup&quot;];
</span><del>-        enabled = getLULookupDefinitionModuleClass();
</del><ins>+        enabled = getLULookupDefinitionModuleClass() &amp;&amp; hitTestResult-&gt;allowsCopy();
</ins><span class="cx">         break;
</span><span class="cx"> 
</span><span class="cx">     case kWKContextActionItemTagPaste:
</span></span></pre>
</div>
</div>

</body>
</html>