⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 176415 in webkit


Ignore:
Timestamp:
Nov 20, 2014, 2:16:55 PM (12 years ago)
Author:
timothy_horton@apple.com
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.

Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/mac/ChangeLog

    r176412 r176415  
     12014-11-20  Tim Horton  <timothy_horton@apple.com>
     2
     3        Cancel DataDetectors menu earlier if we know it can't be presented
     4        https://bugs.webkit.org/show_bug.cgi?id=138922
     5        <rdar://problem/18950441>
     6
     7        Reviewed by Beth Dakin.
     8
     9        * WebView/WebActionMenuController.mm:
     10        (-[WebActionMenuController prepareForMenu:withEvent:]):
     11        Move our call to shouldUseActionsWithContext earlier, to menuNeedsUpdate,
     12        and use a bigger hammer (removeAllItems).
     13
     14        (-[WebActionMenuController willOpenMenu:withEvent:]):
     15        If we end up with a menu with no items, don't change selection or anything.
     16
    1172014-11-20  Beth Dakin  <bdakin@apple.com>
    218
  • trunk/Source/WebKit/mac/WebView/WebActionMenuController.mm

    r176412 r176415  
    151151    for (NSMenuItem *item in menuItems)
    152152        [actionMenu addItem:item];
     153
     154    if (_type == WebActionMenuDataDetectedItem && _currentActionContext && ![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()]) {
     155        [menu cancelTracking];
     156        [menu removeAllItems];
     157    }
    153158}
    154159
     
    183188        return;
    184189
     190    if (!menu.numberOfItems)
     191        return;
     192
    185193    if (_type == WebActionMenuDataDetectedItem) {
    186         if (![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()]) {
    187             [menu cancelTracking];
    188             return;
    189         }
    190 
    191194        if (menu.numberOfItems == 1)
    192195            [[_webView _selectedOrMainFrame] _clearSelection];
  • trunk/Source/WebKit2/ChangeLog

    r176414 r176415  
     12014-11-20  Tim Horton  <timothy_horton@apple.com>
     2
     3        Cancel DataDetectors menu earlier if we know it can't be presented
     4        https://bugs.webkit.org/show_bug.cgi?id=138922
     5        <rdar://problem/18950441>
     6
     7        Reviewed by Beth Dakin.
     8
     9        * UIProcess/mac/WKActionMenuController.mm:
     10        (-[WKActionMenuController willOpenMenu:withEvent:]):
     11        If we end up with a menu with no items, don't change selection or anything.
     12
     13        (-[WKActionMenuController menuNeedsUpdate:]):
     14        Move our call to shouldUseActionsWithContext earlier, to menuNeedsUpdate,
     15        and use a bigger hammer (removeAllItems).
     16
    1172014-11-20  Tim Horton  <timothy_horton@apple.com>
    218
  • trunk/Source/WebKit2/UIProcess/mac/WKActionMenuController.mm

    r176414 r176415  
    193193        return;
    194194
     195    if (!menu.numberOfItems)
     196        return;
     197
    195198    if (_type == kWKActionMenuDataDetectedItem) {
    196         if (_currentActionContext && ![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()]) {
    197             [menu cancelTracking];
    198             return;
    199         }
    200199        if (menu.numberOfItems == 1)
    201200            _page->clearSelection();
     
    727726    if (_state != ActionMenuState::Ready)
    728727        [self _updateActionMenuItems];
     728
     729    if (_type == kWKActionMenuDataDetectedItem && _currentActionContext && ![getDDActionsManagerClass() shouldUseActionsWithContext:_currentActionContext.get()]) {
     730        [menu cancelTracking];
     731        [menu removeAllItems];
     732    }
    729733}
    730734
Note: See TracChangeset for help on using the changeset viewer.