<!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>[176063] 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/176063">176063</a></dd>
<dt>Author</dt> <dd>matthew_hanson@apple.com</dd>
<dt>Date</dt> <dd>2014-11-12 19:19:33 -0800 (Wed, 12 Nov 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Merged <a href="http://trac.webkit.org/projects/webkit/changeset/176041">r176041</a>. rdar://problems/18785434</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="#branchessafari6003branchSourceWebKitmacChangeLog">branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacWebViewWebActionMenuControllerh">branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.h</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacWebViewWebActionMenuControllermm">branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm</a></li>
<li><a href="#branchessafari6003branchSourceWebKitmacWebViewWebUIDelegatePrivateh">branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h</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 (176062 => 176063)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/ChangeLog        2014-11-13 02:52:26 UTC (rev 176062)
+++ branches/safari-600.3-branch/Source/WebCore/ChangeLog        2014-11-13 03:19:33 UTC (rev 176063)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-11-12  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+        WK1: Support default actions for images
+        https://bugs.webkit.org/show_bug.cgi?id=138668
+        -and corresponding-
+        rdar://problem/18785434
+
+        Reviewed by Tim Horton.
+
+        Symbol needed for copying image.
+        * WebCore.exp.in:
+
</ins><span class="cx"> 2014-11-12  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r175966. &lt;rdar://problem/18866308&gt;
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebCoreWebCoreexpin"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in (176062 => 176063)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in        2014-11-13 02:52:26 UTC (rev 176062)
+++ branches/safari-600.3-branch/Source/WebCore/WebCore.exp.in        2014-11-13 03:19:33 UTC (rev 176063)
</span><span class="lines">@@ -1267,6 +1267,7 @@
</span><span class="cx"> __ZN7WebCore6Editor7commandERKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore6Editor7copyURLERKNS_3URLERKN3WTF6StringE
</span><span class="cx"> __ZN7WebCore6Editor7outdentEv
</span><ins>+__ZN7WebCore6Editor9copyImageERKNS_13HitTestResultE
</ins><span class="cx"> __ZN7WebCore6JSNode6s_infoE
</span><span class="cx"> __ZN7WebCore6LengthC1EN3WTF7PassRefINS_16CalculationValueEEE
</span><span class="cx"> __ZN7WebCore6Region21updateBoundsFromShapeEv
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog (176062 => 176063)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog        2014-11-13 02:52:26 UTC (rev 176062)
+++ branches/safari-600.3-branch/Source/WebKit/mac/ChangeLog        2014-11-13 03:19:33 UTC (rev 176063)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2014-11-12  Beth Dakin  &lt;bdakin@apple.com&gt;
+
+        WK1: Support default actions for images
+        https://bugs.webkit.org/show_bug.cgi?id=138668
+        -and corresponding-
+        rdar://problem/18785434
+
+        Reviewed by Tim Horton.
+
+        * WebView/WebActionMenuController.h:
+        * WebView/WebActionMenuController.mm:
+        (-[WebActionMenuController didCloseMenu:withEvent:]):
+        (-[WebActionMenuController _defaultMenuItemsForImage:]):
+        (-[WebActionMenuController _copyImage:]):
+        (temporaryPhotosDirectoryPath):
+        (pathToPhotoOnDisk):
+        (-[WebActionMenuController _canAddMediaToPhotos]):
+        (-[WebActionMenuController _addImageToPhotos:]):
+        (-[WebActionMenuController _saveImageToDownloads:]):
+        (-[WebActionMenuController sharingServicePicker:sharingServicesForItems:mask:proposedSharingServices:]):
+        (-[WebActionMenuController sharingServicePicker:delegateForSharingService:]):
+        (-[WebActionMenuController sharingService:sourceWindowForShareItems:sharingContentScope:]):
+        (-[WebActionMenuController _createActionMenuItemForTag:withHitTestResult:]):
+        (-[WebActionMenuController _defaultMenuItemsForHitTestResult:]):
+        * WebView/WebUIDelegatePrivate.h:
+
</ins><span class="cx"> 2014-11-12  Matthew Hanson  &lt;matthew_hanson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Merge r175962. &lt;rdar://problem/18815343&gt;
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacWebViewWebActionMenuControllerh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.h (176062 => 176063)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.h        2014-11-13 02:52:26 UTC (rev 176062)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.h        2014-11-13 03:19:33 UTC (rev 176063)
</span><span class="lines">@@ -24,15 +24,19 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #import &quot;WebUIDelegatePrivate.h&quot;
</span><ins>+
+#import &lt;AppKit/NSSharingService.h&gt;
</ins><span class="cx"> #import &lt;WebCore/HitTestResult.h&gt;
</span><ins>+#import &lt;wtf/RetainPtr.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> @class WebView;
</span><span class="cx"> 
</span><del>-@interface WebActionMenuController : NSObject {
</del><ins>+@interface WebActionMenuController : NSObject &lt;NSSharingServiceDelegate, NSSharingServicePickerDelegate&gt; {
</ins><span class="cx"> @private
</span><span class="cx">     WebView *_webView;
</span><span class="cx">     WebActionMenuType _type;
</span><span class="cx">     WebCore::HitTestResult _hitTestResult;
</span><ins>+    RetainPtr&lt;NSSharingServicePicker&gt; _sharingServicePicker;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> - (id)initWithWebView:(WebView *)webView;
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacWebViewWebActionMenuControllermm"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm (176062 => 176063)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm        2014-11-13 02:52:26 UTC (rev 176062)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebActionMenuController.mm        2014-11-13 03:19:33 UTC (rev 176063)
</span><span class="lines">@@ -35,6 +35,8 @@
</span><span class="cx"> #import &quot;WebSystemInterface.h&quot;
</span><span class="cx"> #import &quot;WebUIDelegatePrivate.h&quot;
</span><span class="cx"> #import &quot;WebViewInternal.h&quot;
</span><ins>+#import &lt;ImageIO/ImageIO.h&gt;
+#import &lt;ImageKit/ImageKit.h&gt;
</ins><span class="cx"> #import &lt;WebCore/DictionaryLookup.h&gt;
</span><span class="cx"> #import &lt;WebCore/Editor.h&gt;
</span><span class="cx"> #import &lt;WebCore/Element.h&gt;
</span><span class="lines">@@ -43,6 +45,8 @@
</span><span class="cx"> #import &lt;WebCore/FrameView.h&gt;
</span><span class="cx"> #import &lt;WebCore/HTMLConverter.h&gt;
</span><span class="cx"> #import &lt;WebCore/LocalizedStrings.h&gt;
</span><ins>+#import &lt;WebCore/NSSharingServicePickerSPI.h&gt;
+#import &lt;WebCore/NSSharingServiceSPI.h&gt;
</ins><span class="cx"> #import &lt;WebCore/NSViewSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/Page.h&gt;
</span><span class="cx"> #import &lt;WebCore/Range.h&gt;
</span><span class="lines">@@ -57,6 +61,9 @@
</span><span class="cx"> SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, QuickLookUI)
</span><span class="cx"> SOFT_LINK_CLASS(QuickLookUI, QLPreviewBubble)
</span><span class="cx"> 
</span><ins>+SOFT_LINK_FRAMEWORK_IN_UMBRELLA(Quartz, ImageKit)
+SOFT_LINK_CLASS(ImageKit, IKSlideshow)
+
</ins><span class="cx"> @class QLPreviewBubble;
</span><span class="cx"> @interface NSObject (WKQLPreviewBubbleDetails)
</span><span class="cx"> @property (copy) NSArray * controls;
</span><span class="lines">@@ -156,6 +163,7 @@
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     _type = WebActionMenuNone;
</span><ins>+    _sharingServicePicker = nil;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #pragma mark Link actions
</span><span class="lines">@@ -257,6 +265,127 @@
</span><span class="cx">     return @[ openLinkItem.get(), previewLinkItem.get(), [NSMenuItem separatorItem], readingListItem.get() ];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#pragma mark Image actions
+
+- (NSArray *)_defaultMenuItemsForImage:(WebElementDictionary *)hitTestResult
+{
+    RetainPtr&lt;NSMenuItem&gt; copyImageItem = [self _createActionMenuItemForTag:WebActionMenuItemTagCopyImage withHitTestResult:hitTestResult];
+
+    RetainPtr&lt;NSMenuItem&gt; addToPhotosItem;
+    if ([self _canAddMediaToPhotos])
+        addToPhotosItem = [self _createActionMenuItemForTag:WebActionMenuItemTagAddImageToPhotos withHitTestResult:hitTestResult];
+    else
+        addToPhotosItem = [NSMenuItem separatorItem];
+
+    RetainPtr&lt;NSMenuItem&gt; saveToDownloadsItem = [self _createActionMenuItemForTag:WebActionMenuItemTagSaveImageToDownloads withHitTestResult:hitTestResult];
+    if (!_webView.downloadDelegate)
+        [saveToDownloadsItem setEnabled:NO];
+
+
+    RetainPtr&lt;NSMenuItem&gt; shareItem = [self _createActionMenuItemForTag:WebActionMenuItemTagShareImage withHitTestResult:hitTestResult];
+    if (Image* image = _hitTestResult.image()) {
+        RetainPtr&lt;CGImageRef&gt; cgImage = image-&gt;getCGImageRef();
+        RetainPtr&lt;NSImage&gt; nsImage = adoptNS([[NSImage alloc] initWithCGImage:cgImage.get() size:NSZeroSize]);
+        _sharingServicePicker = adoptNS([[NSSharingServicePicker alloc] initWithItems:@[ nsImage.get() ]]);
+        [_sharingServicePicker setDelegate:self];
+        [shareItem setSubmenu:[_sharingServicePicker menu]];
+    }
+
+    return @[ copyImageItem.get(), addToPhotosItem.get(), saveToDownloadsItem.get(), shareItem.get() ];
+}
+
+- (void)_copyImage:(id)sender
+{
+    Frame* frame = core([_webView _selectedOrMainFrame]);
+    if (!frame)
+        return;
+    frame-&gt;editor().copyImage(_hitTestResult);
+}
+
+static NSString *temporaryPhotosDirectoryPath()
+{
+    static NSString *temporaryPhotosDirectoryPath;
+
+    if (!temporaryPhotosDirectoryPath) {
+        NSString *temporaryDirectoryTemplate = [NSTemporaryDirectory() stringByAppendingPathComponent:@&quot;WebKitPhotos-XXXXXX&quot;];
+        CString templateRepresentation = [temporaryDirectoryTemplate fileSystemRepresentation];
+
+        if (mkdtemp(templateRepresentation.mutableData()))
+            temporaryPhotosDirectoryPath = [[[NSFileManager defaultManager] stringWithFileSystemRepresentation:templateRepresentation.data() length:templateRepresentation.length()] copy];
+    }
+
+    return temporaryPhotosDirectoryPath;
+}
+
+static NSString *pathToPhotoOnDisk(NSString *suggestedFilename)
+{
+    NSString *photoDirectoryPath = temporaryPhotosDirectoryPath();
+    if (!photoDirectoryPath) {
+        WTFLogAlways(&quot;Cannot create temporary photo download directory.&quot;);
+        return nil;
+    }
+
+    NSString *path = [photoDirectoryPath stringByAppendingPathComponent:suggestedFilename];
+
+    NSFileManager *fileManager = [NSFileManager defaultManager];
+    if ([fileManager fileExistsAtPath:path]) {
+        NSString *pathTemplatePrefix = [photoDirectoryPath stringByAppendingPathComponent:@&quot;XXXXXX-&quot;];
+        NSString *pathTemplate = [pathTemplatePrefix stringByAppendingString:suggestedFilename];
+        CString pathTemplateRepresentation = [pathTemplate fileSystemRepresentation];
+
+        int fd = mkstemps(pathTemplateRepresentation.mutableData(), pathTemplateRepresentation.length() - strlen([pathTemplatePrefix fileSystemRepresentation]) + 1);
+        if (fd &lt; 0) {
+            WTFLogAlways(&quot;Cannot create photo file in the temporary directory (%@).&quot;, suggestedFilename);
+            return nil;
+        }
+
+        close(fd);
+        path = [fileManager stringWithFileSystemRepresentation:pathTemplateRepresentation.data() length:pathTemplateRepresentation.length()];
+    }
+
+    return path;
+}
+
+- (BOOL)_canAddMediaToPhotos
+{
+    return [getIKSlideshowClass() canExportToApplication:@&quot;com.apple.Photos&quot;];
+}
+
+- (void)_addImageToPhotos:(id)sender
+{
+    if (![self _canAddMediaToPhotos])
+        return;
+
+    Image* image = _hitTestResult.image();
+    if (!image)
+        return;
+
+    RetainPtr&lt;CGImageRef&gt; cgImage = image-&gt;getCGImageRef();
+
+    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
+        NSString * const suggestedFilename = @&quot;image.jpg&quot;;
+
+        NSString *filePath = pathToPhotoOnDisk(suggestedFilename);
+        if (!filePath)
+            return;
+
+        NSURL *fileURL = [NSURL fileURLWithPath:filePath];
+        auto dest = adoptCF(CGImageDestinationCreateWithURL((CFURLRef)fileURL, kUTTypeJPEG, 1, nullptr));
+        CGImageDestinationAddImage(dest.get(), cgImage.get(), nullptr);
+        CGImageDestinationFinalize(dest.get());
+
+        dispatch_async(dispatch_get_main_queue(), ^{
+            // This API provides no way to report failure, but if 18420778 is fixed so that it does, we should handle this.
+            [getIKSlideshowClass() exportSlideshowItem:filePath toApplication:@&quot;com.apple.Photos&quot;];
+        });
+    });
+}
+
+- (void)_saveImageToDownloads:(id)sender
+{
+    [_webView _downloadURL:_hitTestResult.absoluteImageURL()];
+}
+
</ins><span class="cx"> #pragma mark Text actions
</span><span class="cx"> 
</span><span class="cx"> - (NSArray *)_defaultMenuItemsForText:(WebElementDictionary *)hitTestResult
</span><span class="lines">@@ -432,6 +561,33 @@
</span><span class="cx">     return @[ [NSMenuItem separatorItem], [NSMenuItem separatorItem], pasteItem.get() ];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#pragma mark NSSharingServicePickerDelegate implementation
+
+- (NSArray *)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker sharingServicesForItems:(NSArray *)items mask:(NSSharingServiceMask)mask proposedSharingServices:(NSArray *)proposedServices
+{
+    RetainPtr&lt;NSMutableArray&gt; services = adoptNS([[NSMutableArray alloc] initWithCapacity:proposedServices.count]);
+
+    for (NSSharingService *service in proposedServices) {
+        if ([service.name isEqualToString:NSSharingServiceNameAddToIPhoto])
+            continue;
+        [services addObject:service];
+    }
+
+    return services.autorelease();
+}
+
+- (id &lt;NSSharingServiceDelegate&gt;)sharingServicePicker:(NSSharingServicePicker *)sharingServicePicker delegateForSharingService:(NSSharingService *)sharingService
+{
+    return self;
+}
+
+#pragma mark NSSharingServiceDelegate implementation
+
+- (NSWindow *)sharingService:(NSSharingService *)sharingService sourceWindowForShareItems:(NSArray *)items sharingContentScope:(NSSharingContentScope *)sharingContentScope
+{
+    return _webView.window;
+}
+
</ins><span class="cx"> #pragma mark Menu Items
</span><span class="cx"> 
</span><span class="cx"> - (RetainPtr&lt;NSMenuItem&gt;)_createActionMenuItemForTag:(uint32_t)tag withHitTestResult:(WebElementDictionary *)hitTestResult
</span><span class="lines">@@ -486,6 +642,29 @@
</span><span class="cx">         image = [NSImage imageNamed:@&quot;NSActionMenuSpelling&quot;];
</span><span class="cx">         break;
</span><span class="cx"> 
</span><ins>+    case WebActionMenuItemTagCopyImage:
+        selector = @selector(_copyImage:);
+        title = WEB_UI_STRING_KEY(&quot;Copy&quot;, &quot;Copy (image action menu item)&quot;, &quot;image action menu item&quot;);
+        image = [NSImage imageNamed:@&quot;NSActionMenuCopy&quot;];
+        break;
+
+    case WebActionMenuItemTagAddImageToPhotos:
+        selector = @selector(_addImageToPhotos:);
+        title = WEB_UI_STRING_KEY(&quot;Add to Photos&quot;, &quot;Add to Photos (action menu item)&quot;, &quot;action menu item&quot;);
+        image = [NSImage imageNamed:@&quot;NSActionMenuAddToPhotos&quot;];
+        break;
+
+    case WebActionMenuItemTagSaveImageToDownloads:
+        selector = @selector(_saveImageToDownloads:);
+        title = WEB_UI_STRING_KEY(&quot;Save to Downloads&quot;, &quot;Save to Downloads (image action menu item)&quot;, &quot;image action menu item&quot;);
+        image = [NSImage imageNamed:@&quot;NSActionMenuSaveToDownloads&quot;];
+        break;
+
+    case WebActionMenuItemTagShareImage:
+        title = WEB_UI_STRING_KEY(&quot;Share (image action menu item)&quot;, &quot;Share (image action menu item)&quot;, &quot;image action menu item&quot;);
+        image = [NSImage imageNamed:@&quot;NSActionMenuShare&quot;];
+        break;
+
</ins><span class="cx">     default:
</span><span class="cx">         ASSERT_NOT_REACHED();
</span><span class="cx">         return nil;
</span><span class="lines">@@ -512,6 +691,11 @@
</span><span class="cx">         return [self _defaultMenuItemsForLink:hitTestResult];
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (_hitTestResult.image() &amp;&amp; !_hitTestResult.absoluteImageURL().isEmpty()) {
+        _type = WebActionMenuImage;
+        return [self _defaultMenuItemsForImage:hitTestResult];
+    }
+
</ins><span class="cx">     Node* node = _hitTestResult.innerNode();
</span><span class="cx">     if (node &amp;&amp; node-&gt;isTextNode()) {
</span><span class="cx">         if (_hitTestResult.isContentEditable()) {
</span></span></pre></div>
<a id="branchessafari6003branchSourceWebKitmacWebViewWebUIDelegatePrivateh"></a>
<div class="modfile"><h4>Modified: branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h (176062 => 176063)</h4>
<pre class="diff"><span>
<span class="info">--- branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h        2014-11-13 02:52:26 UTC (rev 176062)
+++ branches/safari-600.3-branch/Source/WebKit/mac/WebView/WebUIDelegatePrivate.h        2014-11-13 03:19:33 UTC (rev 176063)
</span><span class="lines">@@ -120,7 +120,11 @@
</span><span class="cx">     WebActionMenuItemTagCopyText,
</span><span class="cx">     WebActionMenuItemTagLookupText,
</span><span class="cx">     WebActionMenuItemTagPaste,
</span><del>-    WebActionMenuItemTagTextSuggestions
</del><ins>+    WebActionMenuItemTagTextSuggestions,
+    WebActionMenuItemTagCopyImage,
+    WebActionMenuItemTagAddImageToPhotos,
+    WebActionMenuItemTagSaveImageToDownloads,
+    WebActionMenuItemTagShareImage
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> typedef enum {
</span><span class="lines">@@ -129,7 +133,8 @@
</span><span class="cx">     WebActionMenuReadOnlyText,
</span><span class="cx">     WebActionMenuEditableText,
</span><span class="cx">     WebActionMenuWhitespaceInEditableArea,
</span><del>-    WebActionMenuEditableTextWithSuggestions
</del><ins>+    WebActionMenuEditableTextWithSuggestions,
+    WebActionMenuImage
</ins><span class="cx"> } WebActionMenuType;
</span><span class="cx"> 
</span><span class="cx"> // Message Sources.
</span></span></pre>
</div>
</div>

</body>
</html>