Title: [176415] trunk/Source
Revision
176415
Author
[email protected]
Date
2014-11-20 14:16:55 -0800 (Thu, 20 Nov 2014)

Log Message

Cancel DataDetectors menu earlier if we know it can't be presented
https://bugs.webkit.org/show_bug.cgi?id=138922
<rdar://problem/18950441>

Reviewed by Beth Dakin.

* UIProcess/mac/WKActionMenuController.mm:
(-[WKActionMenuController willOpenMenu:withEvent:]):
If we end up with a menu with no items, don't change selection or anything.

(-[WKActionMenuController menuNeedsUpdate:]):
Move our call to shouldUseActionsWithContext earlier, to menuNeedsUpdate,
and use a bigger hammer (removeAllItems).

* WebView/WebActionMenuController.mm:
(-[WebActionMenuController prepareForMenu:withEvent:]):
Move our call to shouldUseActionsWithContext earlier, to menuNeedsUpdate,
and use a bigger hammer (removeAllItems).

(-[WebActionMenuController willOpenMenu:withEvent:]):
If we end up with a menu with no items, don't change selection or anything.

Modified Paths

Diff

Modified: trunk/Source/WebKit/mac/ChangeLog (176414 => 176415)


--- trunk/Source/WebKit/mac/ChangeLog	2014-11-20 22:10:58 UTC (rev 176414)
+++ trunk/Source/WebKit/mac/ChangeLog	2014-11-20 22:16:55 UTC (rev 176415)
@@ -1,3 +1,19 @@
+2014-11-20  Tim Horton  <[email protected]>
+
+        Cancel DataDetectors menu earlier if we know it can't be presented
+        https://bugs.webkit.org/show_bug.cgi?id=138922
+        <rdar://problem/18950441>
+
+        Reviewed by Beth Dakin.
+
+        * WebView/WebActionMenuController.mm:
+        (-[WebActionMenuController prepareForMenu:withEvent:]):
+        Move our call to shouldUseActionsWithContext earlier, to menuNeedsUpdate,
+        and use a bigger hammer (removeAllItems).
+
+        (-[WebActionMenuController willOpenMenu:withEvent:]):
+        If we end up with a menu with no items, don't change selection or anything.
+
 2014-11-20  Beth Dakin  <[email protected]>
 
         Invalid message WebPageProxy.DidPerformDictionaryLookup on Google stocks result

Modified: trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm (176414 => 176415)


--- trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm	2014-11-20 22:10:58 UTC (rev 176414)
+++ trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm	2014-11-20 22:16:55 UTC (rev 176415)
@@ -150,6 +150,11 @@
 
     for (NSMenuItem *item in menuItems)
         [actionMenu addItem:item];
+
+    if (_type == WebActionMenuDataDetectedItem && _currentActionContext && ![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()]) {
+        [menu cancelTracking];
+        [menu removeAllItems];
+    }
 }
 
 - (BOOL)isMenuForTextContent
@@ -182,12 +187,10 @@
     if (menu != _webView.actionMenu)
         return;
 
+    if (!menu.numberOfItems)
+        return;
+
     if (_type == WebActionMenuDataDetectedItem) {
-        if (![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()]) {
-            [menu cancelTracking];
-            return;
-        }
-
         if (menu.numberOfItems == 1)
             [[_webView _selectedOrMainFrame] _clearSelection];
         else

Modified: trunk/Source/WebKit2/ChangeLog (176414 => 176415)


--- trunk/Source/WebKit2/ChangeLog	2014-11-20 22:10:58 UTC (rev 176414)
+++ trunk/Source/WebKit2/ChangeLog	2014-11-20 22:16:55 UTC (rev 176415)
@@ -1,5 +1,21 @@
 2014-11-20  Tim Horton  <[email protected]>
 
+        Cancel DataDetectors menu earlier if we know it can't be presented
+        https://bugs.webkit.org/show_bug.cgi?id=138922
+        <rdar://problem/18950441>
+
+        Reviewed by Beth Dakin.
+
+        * UIProcess/mac/WKActionMenuController.mm:
+        (-[WKActionMenuController willOpenMenu:withEvent:]):
+        If we end up with a menu with no items, don't change selection or anything.
+
+        (-[WKActionMenuController menuNeedsUpdate:]):
+        Move our call to shouldUseActionsWithContext earlier, to menuNeedsUpdate,
+        and use a bigger hammer (removeAllItems).
+
+2014-11-20  Tim Horton  <[email protected]>
+
         Don't use a TextIndicator BounceAndCrossfade transition if the selection highlight is never shown
         https://bugs.webkit.org/show_bug.cgi?id=138919
         <rdar://problem/19042207>

Modified: trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm (176414 => 176415)


--- trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-11-20 22:10:58 UTC (rev 176414)
+++ trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm	2014-11-20 22:16:55 UTC (rev 176415)
@@ -192,11 +192,10 @@
     if (menu != _wkView.actionMenu)
         return;
 
+    if (!menu.numberOfItems)
+        return;
+
     if (_type == kWKActionMenuDataDetectedItem) {
-        if (_currentActionContext && ![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()]) {
-            [menu cancelTracking];
-            return;
-        }
         if (menu.numberOfItems == 1)
             _page->clearSelection();
         else
@@ -726,6 +725,11 @@
 
     if (_state != ActionMenuState::Ready)
         [self _updateActionMenuItems];
+
+    if (_type == kWKActionMenuDataDetectedItem && _currentActionContext && ![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()]) {
+        [menu cancelTracking];
+        [menu removeAllItems];
+    }
 }
 
 - (void)menu:(NSMenu *)menu willHighlightItem:(NSMenuItem *)item
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to