Title: [191302] trunk/Source/WebKit2
Revision
191302
Author
ander...@apple.com
Date
2015-10-19 11:59:16 -0700 (Mon, 19 Oct 2015)

Log Message

Fix image service menus somewhat
https://bugs.webkit.org/show_bug.cgi?id=150265

Reviewed by Tim Horton.

* Shared/ContextMenuContextData.cpp:
(WebKit::ContextMenuContextData::ContextMenuContextData):
It's a service menu if we have a controlled image.

* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::setupServicesMenu):
Use an item provider.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (191301 => 191302)


--- trunk/Source/WebKit2/ChangeLog	2015-10-19 18:50:26 UTC (rev 191301)
+++ trunk/Source/WebKit2/ChangeLog	2015-10-19 18:59:16 UTC (rev 191302)
@@ -1,3 +1,18 @@
+2015-10-16  Anders Carlsson  <ander...@apple.com>
+
+        Fix image service menus somewhat
+        https://bugs.webkit.org/show_bug.cgi?id=150265
+
+        Reviewed by Tim Horton.
+
+        * Shared/ContextMenuContextData.cpp:
+        (WebKit::ContextMenuContextData::ContextMenuContextData):
+        It's a service menu if we have a controlled image.
+
+        * UIProcess/mac/WebContextMenuProxyMac.mm:
+        (WebKit::WebContextMenuProxyMac::setupServicesMenu):
+        Use an item provider.
+
 2015-10-19  Tim Horton  <timothy_hor...@apple.com>
 
         Add magnify and rotate gesture event support for Mac

Modified: trunk/Source/WebKit2/Shared/ContextMenuContextData.cpp (191301 => 191302)


--- trunk/Source/WebKit2/Shared/ContextMenuContextData.cpp	2015-10-19 18:50:26 UTC (rev 191301)
+++ trunk/Source/WebKit2/Shared/ContextMenuContextData.cpp	2015-10-19 18:59:16 UTC (rev 191302)
@@ -46,7 +46,11 @@
 }
 
 ContextMenuContextData::ContextMenuContextData(const WebCore::IntPoint& menuLocation, const Vector<WebKit::WebContextMenuItemData>& menuItems, const ContextMenuContext& context)
+#if ENABLE(SERVICE_CONTROLS)
+    : m_type(context.controlledImage() ? Type::ServicesMenu : Type::ContextMenu)
+#else
     : m_type(Type::ContextMenu)
+#endif
     , m_menuLocation(menuLocation)
     , m_menuItems(menuItems)
     , m_webHitTestResultData(context.hitTestResult(), true)

Modified: trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm (191301 => 191302)


--- trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm	2015-10-19 18:50:26 UTC (rev 191301)
+++ trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm	2015-10-19 18:59:16 UTC (rev 191302)
@@ -258,9 +258,12 @@
         if (!image)
             return;
 
-        RetainPtr<CGImageRef> cgImage = image->makeCGImage();
-        RetainPtr<NSImage> nsImage = adoptNS([[NSImage alloc] initWithCGImage:cgImage.get() size:image->size()]);
-        items = @[ nsImage.get() ];
+        auto cgImage = image->makeCGImage();
+        auto nsImage = adoptNS([[NSImage alloc] initWithCGImage:cgImage.get() size:image->size()]);
+
+        auto itemProvider = adoptNS([[NSItemProvider alloc] initWithItem:[nsImage TIFFRepresentation] typeIdentifier:(__bridge NSString *)kUTTypeTIFF]);
+
+        items = @[ itemProvider.get() ];
     } else if (!context.controlledSelectionData().isEmpty()) {
         RetainPtr<NSData> selectionData = adoptNS([[NSData alloc] initWithBytes:(void*)context.controlledSelectionData().data() length:context.controlledSelectionData().size()]);
         RetainPtr<NSAttributedString> selection = adoptNS([[NSAttributedString alloc] initWithRTFD:selectionData.get() documentAttributes:nil]);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to