Summary: | Provide a way for WebKit1 clients to override default action menu items | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Beth Dakin <bdakin> | ||||||||
Component: | WebKit API | Assignee: | Nobody <webkit-unassigned> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | andersca, bdakin, commit-queue, mitz, thorton | ||||||||
Priority: | P2 | ||||||||||
Version: | 528+ (Nightly build) | ||||||||||
Hardware: | Unspecified | ||||||||||
OS: | Unspecified | ||||||||||
Attachments: |
|
Description
Beth Dakin
2014-10-24 17:16:19 PDT
Created attachment 240447 [details]
Patch
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? (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. (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! Created attachment 240495 [details]
Patch that uses WebUIDelegate
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.
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: 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. Created attachment 240496 [details]
Patch
Thank you! http://trac.webkit.org/changeset/175229 |