Bug 150606

Summary: Stub out more of the context menu SPI
Product: WebKit Reporter: Anders Carlsson <andersca>
Component: New BugsAssignee: Anders Carlsson <andersca>
Status: RESOLVED FIXED    
Severity: Normal CC: bdakin, stefan
Priority: P2    
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch mitz: review+

Description Anders Carlsson 2015-10-27 14:39:45 PDT
Stub out more of the context menu SPI
Comment 1 Anders Carlsson 2015-10-27 14:42:01 PDT
Created attachment 264162 [details]
Patch
Comment 2 Anders Carlsson 2015-10-27 15:18:56 PDT
Created attachment 264166 [details]
Patch
Comment 3 mitz 2015-10-28 10:54:02 PDT
Comment on attachment 264166 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=264166&action=review

> Source/WebKit2/UIProcess/API/Cocoa/_WKContextMenuElementInfo.h:34
> +WK_CLASS_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA)

Should this be available in iOS? Should the entire header be guarded in #if !TARGET_OS_IPHONE?

> Source/WebKit2/UIProcess/API/Cocoa/_WKContextMenuElementInfo.mm:33
> +@implementation _WKContextMenuElementInfo
> +
> +@end

Similarly here, perhaps this should be omitted entirely on non-Mac.

> Source/WebKit2/UIProcess/API/Cocoa/_WKElementInfo.h:33
> +@interface _WKElementInfo : NSObject

<NSCopying>?

> Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm:124
> +    return [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView contextMenu:menu forElement:contextMenuElementInfo.get()];

Even though the return value is nonnull, does this do something reasonable if the delegate returns nil? Should it?

> Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm:383
> +    NSLog(@"menu is %@", m_menu.get());

Please remove this.
Comment 4 Anders Carlsson 2015-10-28 11:02:51 PDT
(In reply to comment #3)
> Comment on attachment 264166 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=264166&action=review
> 
> > Source/WebKit2/UIProcess/API/Cocoa/_WKContextMenuElementInfo.h:34
> > +WK_CLASS_AVAILABLE(WK_MAC_TBA, WK_IOS_TBA)
> 
> Should this be available in iOS? Should the entire header be guarded in #if
> !TARGET_OS_IPHONE?

Yes. I'll change it to

#if WK_API_ENABLED && !TARGET_OS_IPHONE

> 
> > Source/WebKit2/UIProcess/API/Cocoa/_WKContextMenuElementInfo.mm:33
> > +@implementation _WKContextMenuElementInfo
> > +
> > +@end
> 
> Similarly here, perhaps this should be omitted entirely on non-Mac.

Yes. Changing to

#if WK_API_ENABLED && !PLATFORM(IOS)

> 
> > Source/WebKit2/UIProcess/API/Cocoa/_WKElementInfo.h:33
> > +@interface _WKElementInfo : NSObject
> 
> <NSCopying>?

Yes.

> 
> > Source/WebKit2/UIProcess/Cocoa/UIDelegate.mm:124
> > +    return [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView contextMenu:menu forElement:contextMenuElementInfo.get()];
> 
> Even though the return value is nonnull, does this do something reasonable
> if the delegate returns nil? Should it?

Returning nil prohibits the menu from being displayed. I don't want to add WK_ASSUME_NONNNULL to WKUIDelegatePrivate.h for now, but I made sure to change the return type to include WK_NULLABLE.

> 
> > Source/WebKit2/UIProcess/mac/WebContextMenuProxyMac.mm:383
> > +    NSLog(@"menu is %@", m_menu.get());
> 
> Please remove this.
Comment 5 Anders Carlsson 2015-10-28 12:14:03 PDT
Committed r191685: <http://trac.webkit.org/changeset/191685>
Comment 6 Anders Carlsson 2015-10-28 15:53:03 PDT
Committed r191698: <http://trac.webkit.org/changeset/191698>
Comment 7 Stefan Arentz 2015-10-29 07:47:23 PDT
This is great. Two questions:

* Will this become a public API?

* Will this also work for the menu options shown under a 3D Touch Peek?

 S.