Additional items added to selection services menus are misaligned
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Aug 2014 16:18:46 +0000 (16:18 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Aug 2014 16:18:46 +0000 (16:18 +0000)
https://bugs.webkit.org/show_bug.cgi?id=135747
<rdar://problem/17933167>

Reviewed by Brady Eidson.

* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::setupServicesMenu):
Use NSSharingServicePickerStyleRollover for the rollover image services menu;
use NSSharingServicePickerStyleTextSelection for the selection services menu.

Set NSMenu's showsStateColumn to YES for selection services menus, so that
other items added to the menu line up correctly.

Remove an unncessary .get()

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@172343 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm

index aa31fd26a104bce397dd0937c29ae73871b5abea..92f00cb5c38b79bb4cd5d64f729d7d12f1808884 100644 (file)
@@ -1,3 +1,21 @@
+2014-08-08  Timothy Horton  <timothy_horton@apple.com>
+
+        Additional items added to selection services menus are misaligned
+        https://bugs.webkit.org/show_bug.cgi?id=135747
+        <rdar://problem/17933167>
+
+        Reviewed by Brady Eidson.
+
+        * UIProcess/mac/WebContextMenuProxyMac.mm:
+        (WebKit::WebContextMenuProxyMac::setupServicesMenu):
+        Use NSSharingServicePickerStyleRollover for the rollover image services menu;
+        use NSSharingServicePickerStyleTextSelection for the selection services menu.
+
+        Set NSMenu's showsStateColumn to YES for selection services menus, so that
+        other items added to the menu line up correctly.
+
+        Remove an unncessary .get()
+
 2014-08-08  Grzegorz Czajkowski  <g.czajkowski@samsung.com>
 
         [EFL] Remove unnecessary ewk_private.h includes
index 09f5d1f95d5ada574fc2b05e7fbbb04eab79db6a..a0745229984befe1f77023a387086b88a9a7e3d1 100644 (file)
@@ -372,8 +372,9 @@ void WebContextMenuProxyMac::setupServicesMenu(const ContextMenuContextData& con
 {
     RetainPtr<NSSharingServicePicker> picker;
     bool includeEditorServices = context.controlledDataIsEditable();
+    bool hasControlledImage = !context.controlledImageHandle().isNull();
     NSArray *items = nil;
-    if (!context.controlledImageHandle().isNull()) {
+    if (hasControlledImage) {
         RefPtr<ShareableBitmap> image = ShareableBitmap::create(context.controlledImageHandle());
         if (!image)
             return;
@@ -392,20 +393,23 @@ void WebContextMenuProxyMac::setupServicesMenu(const ContextMenuContextData& con
     }
 
     picker = adoptNS([[NSSharingServicePicker alloc] initWithItems:items]);
-    [picker setStyle:NSSharingServicePickerStyleRollover];
+    [picker setStyle:hasControlledImage ? NSSharingServicePickerStyleRollover : NSSharingServicePickerStyleTextSelection];
     [picker setDelegate:[WKSharingServicePickerDelegate sharedSharingServicePickerDelegate]];
     [[WKSharingServicePickerDelegate sharedSharingServicePickerDelegate] setPicker:picker.get()];
     [[WKSharingServicePickerDelegate sharedSharingServicePickerDelegate] setIncludeEditorServices:includeEditorServices];
 
     m_servicesMenu = [picker menu];
 
+    if (!hasControlledImage)
+        [m_servicesMenu setShowsStateColumn:YES];
+
     // Explicitly add a menu item for each telephone number that is in the selection.
     const Vector<String>& selectedTelephoneNumbers = context.selectedTelephoneNumbers();
     if (!selectedTelephoneNumbers.isEmpty()) {
         [m_servicesMenu.get() addItem:[NSMenuItem separatorItem]];
         for (auto& telephoneNumber : selectedTelephoneNumbers) {
             if (NSMenuItem *item = menuItemForTelephoneNumber(telephoneNumber))
-                [m_servicesMenu.get() addItem:item];
+                [m_servicesMenu addItem:item];
         }
     }