Changeset 83464 in webkit


Ignore:
Timestamp:
Apr 11, 2011 11:52:52 AM (13 years ago)
Author:
timothy@apple.com
Message:

Fix a bug where the context menu does not show in PDF documents if there is no
UI delegate or the UI delegate does not respond to the context menu selector.

https://webkit.org/b/57958

Reviewed by Darin Adler.

  • WebView/WebView.mm:

(-[WebView _menuForElement:defaultItems:]): CallUIDelegate returns nil
if UIDelegate is nil or doesn't respond to the selector. So check that
here to distinguish between using defaultMenuItems or the delegate
really returning nil to say "no context menu".

Location:
trunk/Source/WebKit/mac
Files:
2 edited

Legend:

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

    r83458 r83464  
     12011-04-06  Timothy Hatcher  <timothy@apple.com>
     2
     3        Fix a bug where the context menu does not show in PDF documents if there is no
     4        UI delegate or the UI delegate does not respond to the context menu selector.
     5
     6        https://webkit.org/b/57958
     7
     8        Reviewed by Darin Adler.
     9
     10        * WebView/WebView.mm:
     11        (-[WebView _menuForElement:defaultItems:]): CallUIDelegate returns nil
     12        if UIDelegate is nil or doesn't respond to the selector. So check that
     13        here to distinguish between using defaultMenuItems or the delegate
     14        really returning nil to say "no context menu".
     15
    1162011-04-11  Jer Noble  <jer.noble@apple.com>
    217
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r83324 r83464  
    12981298{
    12991299    NSArray *defaultMenuItems = [[WebDefaultUIDelegate sharedUIDelegate] webView:self contextMenuItemsForElement:element defaultMenuItems:items];
    1300 
    1301     NSArray *menuItems = CallUIDelegate(self, @selector(webView:contextMenuItemsForElement:defaultMenuItems:), element, defaultMenuItems);
    1302     if (!menuItems)
    1303         return nil;
     1300    NSArray *menuItems = defaultMenuItems;
     1301
     1302    // CallUIDelegate returns nil if UIDelegate is nil or doesn't respond to the selector. So we need to check that here
     1303    // to distinguish between using defaultMenuItems or the delegate really returning nil to say "no context menu".
     1304    SEL selector = @selector(webView:contextMenuItemsForElement:defaultMenuItems:);
     1305    if (_private->UIDelegate && [_private->UIDelegate respondsToSelector:selector]) {
     1306        menuItems = CallUIDelegate(self, selector, element, defaultMenuItems);
     1307        if (!menuItems)
     1308            return nil;
     1309    }
    13041310
    13051311    unsigned count = [menuItems count];
Note: See TracChangeset for help on using the changeset viewer.