Title: [172498] trunk/Source/WebKit2
Revision
172498
Author
[email protected]
Date
2014-08-12 15:42:41 -0700 (Tue, 12 Aug 2014)

Log Message

REGRESSION (r172424): Extra menu header in combined telephone number menu when no phone paired
https://bugs.webkit.org/show_bug.cgi?id=135854
<rdar://problem/17996339>

Reviewed by Enrica Casucci.

* UIProcess/mac/WebContextMenuProxyMac.mm:
(WebKit::WebContextMenuProxyMac::setupServicesMenu):
Get all the menu items ahead of time, and only add the shared header
if there are any telephone number menu items.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (172497 => 172498)


--- trunk/Source/WebKit2/ChangeLog	2014-08-12 22:32:43 UTC (rev 172497)
+++ trunk/Source/WebKit2/ChangeLog	2014-08-12 22:42:41 UTC (rev 172498)
@@ -1,3 +1,16 @@
+2014-08-12  Tim Horton  <[email protected]>
+
+        REGRESSION (r172424): Extra menu header in combined telephone number menu when no phone paired
+        https://bugs.webkit.org/show_bug.cgi?id=135854
+        <rdar://problem/17996339>
+
+        Reviewed by Enrica Casucci.
+
+        * UIProcess/mac/WebContextMenuProxyMac.mm:
+        (WebKit::WebContextMenuProxyMac::setupServicesMenu):
+        Get all the menu items ahead of time, and only add the shared header
+        if there are any telephone number menu items.
+
 2014-08-12  Enrica Casucci  <[email protected]>
 
         Crash at com.apple.WebKit.WebContent at com.apple.WebKit: WebKit::expandForGap

Modified: trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm (172497 => 172498)


--- trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm	2014-08-12 22:32:43 UTC (rev 172497)
+++ trunk/Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm	2014-08-12 22:42:41 UTC (rev 172498)
@@ -405,7 +405,15 @@
 
     // Explicitly add a menu item for each telephone number that is in the selection.
     const Vector<String>& selectedTelephoneNumbers = context.selectedTelephoneNumbers();
-    if (!selectedTelephoneNumbers.isEmpty()) {
+    Vector<RetainPtr<NSMenuItem>> telephoneNumberMenuItems;
+    for (auto& telephoneNumber : selectedTelephoneNumbers) {
+        if (NSMenuItem *item = menuItemForTelephoneNumber(telephoneNumber)) {
+            [item setIndentationLevel:1];
+            telephoneNumberMenuItems.append(item);
+        }
+    }
+
+    if (!telephoneNumberMenuItems.isEmpty()) {
         if (m_servicesMenu)
             [m_servicesMenu insertItem:[NSMenuItem separatorItem] atIndex:0];
         else
@@ -414,12 +422,8 @@
         NSMenuItem *groupEntry = [[NSMenuItem alloc] initWithTitle:menuItemTitleForTelephoneNumberGroup() action:nil keyEquivalent:@""];
         [groupEntry setEnabled:NO];
         [m_servicesMenu insertItem:groupEntry atIndex:itemPosition++];
-        for (auto& telephoneNumber : selectedTelephoneNumbers) {
-            if (NSMenuItem *item = menuItemForTelephoneNumber(telephoneNumber)) {
-                [item setIndentationLevel:1];
-                [m_servicesMenu insertItem:item atIndex:itemPosition++];
-            }
-        }
+        for (auto& menuItem : telephoneNumberMenuItems)
+            [m_servicesMenu insertItem:menuItem.get() atIndex:itemPosition++];
     }
 
     // If there is no services menu, then the existing services on the system have changed, so refresh that list of services.
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to