RESOLVED FIXED 138066
Provide a way for WebKit1 clients to override default action menu items
https://bugs.webkit.org/show_bug.cgi?id=138066
Summary Provide a way for WebKit1 clients to override default action menu items
Beth Dakin
Reported 2014-10-24 17:16:19 PDT
Provide a way for WebKit1 clients to override default action menu items rdar://problem/18451638
Attachments
Patch (5.55 KB, patch)
2014-10-24 17:19 PDT, Beth Dakin
no flags
Patch that uses WebUIDelegate (4.88 KB, patch)
2014-10-27 12:51 PDT, Beth Dakin
no flags
Patch (4.87 KB, patch)
2014-10-27 13:06 PDT, Beth Dakin
andersca: review+
Beth Dakin
Comment 1 2014-10-24 17:19:30 PDT
mitz
Comment 2 2014-10-24 18:43:42 PDT
I know that the patch is similar to how we do things in WebKit2’s C SPI, but in WebKit1, could we do something more similar to how context menus are handled, with a delegate? Would that be significantly harder to implement or for clients to adopt?
mitz
Comment 3 2014-10-25 09:36:00 PDT
(In reply to comment #2) > I know that the patch is similar to how we do things in WebKit2’s C SPI, but > in WebKit1, could we do something more similar to how context menus are > handled, with a delegate? Would that be significantly harder to implement or > for clients to adopt? For context menus, there is -webView:contextMenuItemsForElement:defaultMenuItems: in WebUIDelegate. It seems like something similar could work here (in WebUIDelegatePrivate), and will not require clients to subclass WebView if they want to implement this.
Beth Dakin
Comment 4 2014-10-25 12:13:53 PDT
(In reply to comment #3) > (In reply to comment #2) > > I know that the patch is similar to how we do things in WebKit2’s C SPI, but > > in WebKit1, could we do something more similar to how context menus are > > handled, with a delegate? Would that be significantly harder to implement or > > for clients to adopt? > > For context menus, there is > -webView:contextMenuItemsForElement:defaultMenuItems: in WebUIDelegate. It > seems like something similar could work here (in WebUIDelegatePrivate), and > will not require clients to subclass WebView if they want to implement this. I think that sounds very reasonable! Honestly, I was torn between the two spots since I took a look at the context menu stuff as well. Will move!
Beth Dakin
Comment 5 2014-10-27 12:51:07 PDT
Created attachment 240495 [details] Patch that uses WebUIDelegate
WebKit Commit Bot
Comment 6 2014-10-27 12:53:51 PDT
Attachment 240495 [details] did not pass style-queue: ERROR: Source/WebKit/mac/WebView/WebActionMenuController.mm:89: The parameter name "]" adds no information, so it should be removed. [readability/parameter_name] [5] Total errors found: 1 in 4 files If any of these errors are false positives, please file a bug against check-webkit-style.
Anders Carlsson
Comment 7 2014-10-27 12:55:48 PDT
Comment on attachment 240495 [details] Patch that uses WebUIDelegate View in context: https://bugs.webkit.org/attachment.cgi?id=240495&action=review > Source/WebKit/mac/WebView/WebUIDelegatePrivate.h:208 > +- (NSArray *)webView:(WebView *)sender _actionMenuItemsForHitTestResult:(NSDictionary *)hitTestResult withType:(WebActionMenuType)type defaultActionMenuItems:(NSArray *)defaultMenuItems; Underscore should be at the start of the method name, _webView:
Anders Carlsson
Comment 8 2014-10-27 12:56:38 PDT
Comment on attachment 240495 [details] Patch that uses WebUIDelegate View in context: https://bugs.webkit.org/attachment.cgi?id=240495&action=review > Source/WebKit/mac/WebView/WebActionMenuController.mm:90 > + menuItems = [[_webView _UIDelegateForwarder] webView:_webView _actionMenuItemsForHitTestResult:hitTestResult withType:_type defaultActionMenuItems:menuItems]; I don't think you need the UIDelegateForwarder here - you can just call the method directly since you check respondsToSelector already.
Beth Dakin
Comment 9 2014-10-27 13:06:11 PDT
Beth Dakin
Comment 10 2014-10-27 13:08:47 PDT
Note You need to log in before you can comment on or make changes to this bug.