REGRESSION (r172301): Combined phone number highlight doesn't appear if rich content...
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 10 Aug 2014 01:04:23 +0000 (01:04 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 10 Aug 2014 01:04:23 +0000 (01:04 +0000)
https://bugs.webkit.org/show_bug.cgi?id=135785
<rdar://problem/17969843>

Reviewed by Brady Eidson.

* WebProcess/WebPage/mac/ServicesOverlayController.mm:
(WebKit::ServicesOverlayController::drawSelectionHighlight):
We can't early return in the rich-content-but-no-rich-services case
if we have telephone numbers in the selection, because we want to offer
them up in the combined menu.

* UIProcess/mac/WebContextMenuProxyMac.mm:
If we end up with no menu, because there were no services available,
make a fresh one that we can fill with combined telephone number items.

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

Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm
Source/WebKit2/WebProcess/WebPage/mac/ServicesOverlayController.mm

index 2ad23507cb6154e91cf9fcbfac697fd3924b1964..52c278871ccff6c69d471d91f8afb5333c3358c5 100644 (file)
@@ -1,3 +1,21 @@
+2014-08-09  Tim Horton  <timothy_horton@apple.com>
+
+        REGRESSION (r172301): Combined phone number highlight doesn't appear if rich content is selected and we have no rich content services
+        https://bugs.webkit.org/show_bug.cgi?id=135785
+        <rdar://problem/17969843>
+
+        Reviewed by Brady Eidson.
+
+        * WebProcess/WebPage/mac/ServicesOverlayController.mm:
+        (WebKit::ServicesOverlayController::drawSelectionHighlight):
+        We can't early return in the rich-content-but-no-rich-services case
+        if we have telephone numbers in the selection, because we want to offer
+        them up in the combined menu.
+
+        * UIProcess/mac/WebContextMenuProxyMac.mm:
+        If we end up with no menu, because there were no services available,
+        make a fresh one that we can fill with combined telephone number items.
+
 2014-08-08  Grzegorz Czajkowski  <g.czajkowski@samsung.com>
 
         [EFL] Do not initialize g_type in WebProcessMain::platformInitialize()
index 78cfe3d92dbf636dd0da13384b4db61de0f70f19..ecc99448e1c04e283253536aa82d6898d5d670ee 100644 (file)
@@ -406,7 +406,10 @@ void WebContextMenuProxyMac::setupServicesMenu(const ContextMenuContextData& con
     // 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]];
+        if (m_servicesMenu)
+            [m_servicesMenu addItem:[NSMenuItem separatorItem]];
+        else
+            m_servicesMenu = adoptNS([[NSMenu alloc] init]);
         for (auto& telephoneNumber : selectedTelephoneNumbers) {
             if (NSMenuItem *item = menuItemForTelephoneNumber(telephoneNumber))
                 [m_servicesMenu addItem:item];
index 1abcc383f7335b04fe77320f107acdefbe8fcdac..cf8c8d72007055d0dd4c06645d1438c653d56983 100644 (file)
@@ -273,11 +273,11 @@ void ServicesOverlayController::drawSelectionHighlight(WebCore::GraphicsContext&
 {
     // It's possible to end up drawing the selection highlight before we've actually received the selection rects.
     // If that happens we'll end up here again once we have the rects.
-    if (m_currentSelectionRects.isEmpty() || (!WebProcess::shared().hasRichContentServices() && !m_isTextOnly))
+    if (m_currentSelectionRects.isEmpty())
         return;
 
-    // If there are no installed selection services and we have no phone numbers detected, then we have nothing to draw.
-    if (!WebProcess::shared().hasSelectionServices() && m_currentTelephoneNumberRanges.isEmpty())
+    // If there are no appropriate installed selection services and we have no phone numbers detected, then we have nothing to draw.
+    if ((!WebProcess::shared().hasSelectionServices() || (!WebProcess::shared().hasRichContentServices() && !m_isTextOnly)) && m_currentTelephoneNumberRanges.isEmpty())
         return;
 
     if (!m_selectionHighlight)