Diff
Modified: branches/safari-600.3-branch/Source/WebCore/ChangeLog (176061 => 176062)
--- branches/safari-600.3-branch/Source/WebCore/ChangeLog 2014-11-13 02:31:09 UTC (rev 176061)
+++ branches/safari-600.3-branch/Source/WebCore/ChangeLog 2014-11-13 02:52:26 UTC (rev 176062)
@@ -1,5 +1,21 @@
2014-11-12 Matthew Hanson <[email protected]>
+ Merge r175966. <rdar://problem/18866308>
+
+ 2014-11-11 Tim Horton <[email protected]>
+
+ DataDetectors' menu items aren't presented in the telephone number menu
+ https://bugs.webkit.org/show_bug.cgi?id=138602
+ <rdar://problem/18866308>
+
+ Reviewed by Beth Dakin.
+
+ * English.lproj/Localizable.strings:
+ Remove a now-unused localized string.
+
+
+2014-11-12 Matthew Hanson <[email protected]>
+
Merge r176037. <rdar://problem/18869900>
2014-11-12 Tim Horton <[email protected]>
Modified: branches/safari-600.3-branch/Source/WebCore/English.lproj/Localizable.strings (176061 => 176062)
--- branches/safari-600.3-branch/Source/WebCore/English.lproj/Localizable.strings 2014-11-13 02:31:09 UTC (rev 176061)
+++ branches/safari-600.3-branch/Source/WebCore/English.lproj/Localizable.strings 2014-11-13 02:52:26 UTC (rev 176062)
@@ -121,9 +121,6 @@
/* menu item title for phone number */
"Call Using iPhone:" = "Call Using iPhone:";
-/* menu item for making a telephone call to a telephone number */
-"Call “%@” Using iPhone" = "Call “%@” Using iPhone";
-
/* File Upload alert sheet button string to cancel */
"Cancel (file upload action sheet)" = "Cancel";
Modified: branches/safari-600.3-branch/Source/WebKit2/ChangeLog (176061 => 176062)
--- branches/safari-600.3-branch/Source/WebKit2/ChangeLog 2014-11-13 02:31:09 UTC (rev 176061)
+++ branches/safari-600.3-branch/Source/WebKit2/ChangeLog 2014-11-13 02:52:26 UTC (rev 176062)
@@ -1,5 +1,48 @@
2014-11-12 Matthew Hanson <[email protected]>
+ Merge r175966. <rdar://problem/18866308>
+
+ 2014-11-11 Tim Horton <[email protected]>
+
+ DataDetectors' menu items aren't presented in the telephone number menu
+ https://bugs.webkit.org/show_bug.cgi?id=138602
+ <rdar://problem/18866308>
+
+ Reviewed by Beth Dakin.
+
+ We currently round-trip the DataDetectors telephone number NSMenuItems
+ through the very-lossy WebContextMenuItemData, for no real reason.
+ We should avoid this so that DataDetectors' actual NSMenuItems are
+ presented in the final menu, so that they can adjust their items after
+ providing them to us.
+
+ * Platform/mac/MenuUtilities.h:
+ * Platform/mac/MenuUtilities.mm:
+ (WebKit::menuItemTitleForTelephoneNumber): Deleted.
+ Stop adjusting the menu item titles, as they come correct now.
+
+ (WebKit::menuItemsForTelephoneNumber): Deleted.
+ (WebKit::menuForTelephoneNumber):
+ Return a fully-formed menu for the single telephone number case.
+
+ * UIProcess/mac/WebPageProxyMac.mm:
+ (WebKit::WebPageProxy::showTelephoneNumberMenu):
+ Present the fully-formed menu, without round-tripping through
+ WebContextMenuItemData, because we do not need to hand the items to
+ the context menu client (and indeed, were not), and because this
+ allows us to use the exact items returned by DataDetectors, so they
+ can keep ahold of the items that we actually present.
+
+ * UIProcess/PageClient.h:
+ * UIProcess/mac/PageClientImpl.h:
+ * UIProcess/mac/PageClientImpl.mm:
+ (WebKit::PageClientImpl::showPlatformContextMenu):
+ Add a Mac-only PageClient function for presenting a NSMenu at a
+ WKView-relative point.
+
+
+2014-11-12 Matthew Hanson <[email protected]>
+
Merge r176038. <rdar://problem/18960409>
2014-11-12 Tim Horton <[email protected]>
Modified: branches/safari-600.3-branch/Source/WebKit2/Platform/mac/MenuUtilities.h (176061 => 176062)
--- branches/safari-600.3-branch/Source/WebKit2/Platform/mac/MenuUtilities.h 2014-11-13 02:31:09 UTC (rev 176061)
+++ branches/safari-600.3-branch/Source/WebKit2/Platform/mac/MenuUtilities.h 2014-11-13 02:52:26 UTC (rev 176062)
@@ -32,8 +32,8 @@
namespace WebKit {
#if ENABLE(TELEPHONE_NUMBER_DETECTION) && PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-NSMenuItem *menuItemForTelephoneNumber(const String& telephoneNumberString);
-NSArray *menuItemsForTelephoneNumber(const String& telephoneNumber);
+NSMenuItem *menuItemForTelephoneNumber(const String& telephoneNumber);
+WTF::RetainPtr<NSMenu> menuForTelephoneNumber(const String& telephoneNumber);
NSString *menuItemTitleForTelephoneNumberGroup();
#endif
Modified: branches/safari-600.3-branch/Source/WebKit2/Platform/mac/MenuUtilities.mm (176061 => 176062)
--- branches/safari-600.3-branch/Source/WebKit2/Platform/mac/MenuUtilities.mm 2014-11-13 02:31:09 UTC (rev 176061)
+++ branches/safari-600.3-branch/Source/WebKit2/Platform/mac/MenuUtilities.mm 2014-11-13 02:52:26 UTC (rev 176062)
@@ -27,6 +27,7 @@
#import "MenuUtilities.h"
#import "StringUtilities.h"
+#import <wtf/RetainPtr.h>
#import <WebCore/LocalizedStrings.h>
#import <WebCore/SoftLinking.h>
#import <objc/runtime.h>
@@ -53,11 +54,6 @@
#if ENABLE(TELEPHONE_NUMBER_DETECTION) && PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101000
-static NSString *menuItemTitleForTelephoneNumber(const String& telephoneNumber)
-{
- return [NSString stringWithFormat:WEB_UI_STRING("Call “%@” Using iPhone", "menu item for making a telephone call to a telephone number"), formattedPhoneNumberString(telephoneNumber)];
-}
-
NSString *menuItemTitleForTelephoneNumberGroup()
{
return WEB_UI_STRING("Call Using iPhone:", "menu item title for phone number");
@@ -84,9 +80,9 @@
return nil;
}
-NSArray *menuItemsForTelephoneNumber(const String& telephoneNumber)
+RetainPtr<NSMenu> menuForTelephoneNumber(const String& telephoneNumber)
{
- NSMutableArray *items = [NSMutableArray array];
+ RetainPtr<NSMenu> menu = adoptNS([[NSMenu alloc] init]);
NSMutableArray *faceTimeItems = [NSMutableArray array];
NSMenuItem *dialItem = nil;
@@ -101,7 +97,6 @@
continue;
if ([actionObject.actionUTI hasPrefix:@"com.apple.dial"]) {
- item.title = menuItemTitleForTelephoneNumber(telephoneNumber);
dialItem = item;
continue;
}
@@ -111,15 +106,16 @@
}
if (dialItem)
- [items addObject:dialItem];
+ [menu addItem:dialItem];
if (faceTimeItems.count) {
- if (items.count)
- [items addObject:[NSMenuItem separatorItem]];
- [items addObjectsFromArray:faceTimeItems];
+ if ([menu numberOfItems])
+ [menu addItem:[NSMenuItem separatorItem]];
+ for (NSMenuItem *item in faceTimeItems)
+ [menu addItem:item];
}
- return items.count ? items : nil;
+ return menu;
}
#endif
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/PageClient.h (176061 => 176062)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/PageClient.h 2014-11-13 02:31:09 UTC (rev 176061)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/PageClient.h 2014-11-13 02:52:26 UTC (rev 176062)
@@ -237,6 +237,8 @@
virtual ColorSpaceData colorSpace() = 0;
+ virtual void showPlatformContextMenu(NSMenu *, WebCore::IntPoint) = 0;
+
#if USE(APPKIT)
virtual WKView* wkView() const = 0;
virtual void intrinsicContentSizeDidChange(const WebCore::IntSize& intrinsicContentSize) = 0;
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h (176061 => 176062)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h 2014-11-13 02:31:09 UTC (rev 176061)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.h 2014-11-13 02:52:26 UTC (rev 176062)
@@ -188,6 +188,7 @@
virtual void removeNavigationGestureSnapshot() override;
virtual void didPerformActionMenuHitTest(const ActionMenuHitTestResult&, API::Object*) override;
+ virtual void showPlatformContextMenu(NSMenu *, WebCore::IntPoint) override;
WKView *m_wkView;
WKWebView *m_webView;
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm (176061 => 176062)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2014-11-13 02:31:09 UTC (rev 176061)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/PageClientImpl.mm 2014-11-13 02:52:26 UTC (rev 176062)
@@ -753,6 +753,12 @@
#endif
}
+void PageClientImpl::showPlatformContextMenu(NSMenu *menu, IntPoint location)
+{
+ [menu popUpMenuPositioningItem:nil atLocation:location inView:m_wkView];
+}
+
+
} // namespace WebKit
#endif // PLATFORM(MAC)
Modified: branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm (176061 => 176062)
--- branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm 2014-11-13 02:31:09 UTC (rev 176061)
+++ branches/safari-600.3-branch/Source/WebKit2/UIProcess/mac/WebPageProxyMac.mm 2014-11-13 02:52:26 UTC (rev 176062)
@@ -643,21 +643,8 @@
#if ENABLE(TELEPHONE_NUMBER_DETECTION)
void WebPageProxy::showTelephoneNumberMenu(const String& telephoneNumber, const WebCore::IntPoint& point)
{
- NSArray *menuItems = menuItemsForTelephoneNumber(telephoneNumber);
-
- Vector<WebContextMenuItemData> items;
- for (NSMenuItem *item in menuItems) {
- RetainPtr<NSMenuItem> retainedItem = item;
- std::function<void()> handler = [retainedItem]() {
- NSMenuItem *item = retainedItem.get();
- [[item target] performSelector:[item action] withObject:item];
- };
-
- items.append(WebContextMenuItemData(ContextMenuItem(item), handler));
- }
-
- ContextMenuContextData contextData(TelephoneNumberContext);
- internalShowContextMenu(point, contextData, items, ContextMenuClientEligibility::NotEligibleForClient, nullptr);
+ RetainPtr<NSMenu> menu = menuForTelephoneNumber(telephoneNumber);
+ m_pageClient.showPlatformContextMenu(menu.get(), point);
}
#endif