Bug 139564

Summary: WK2: Need new SPI for Webkit clients to override default immediate action
Product: WebKit Reporter: Beth Dakin <bdakin>
Component: WebKit2Assignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: bdakin, commit-queue, eric.carlson, glenn, jer.noble, philipj, sergio, thorton
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch thorton: review+

Description Beth Dakin 2014-12-11 15:07:52 PST
WK2: Need new SPI for Webkit clients to override default immediate action

rdar://problem/19225448
Comment 1 Beth Dakin 2014-12-11 15:15:55 PST
Created attachment 243155 [details]
Patch
Comment 2 Beth Dakin 2014-12-11 15:28:25 PST
Created attachment 243156 [details]
Patch
Comment 3 WebKit Commit Bot 2014-12-11 15:29:27 PST
Attachment 243156 [details] did not pass style-queue:


ERROR: Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm:200:  An else if statement should be written as an if statement when the prior "if" concludes with a return, break, continue or goto statement.  [readability/control_flow] [4]
Total errors found: 1 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 4 Tim Horton 2014-12-11 15:30:20 PST
Comment on attachment 243156 [details]
Patch

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

> Source/WebKit2/UIProcess/API/Cocoa/WKViewPrivate.h:129
> +// do something custom, return an id that conforms to the NSImmediateActionAnimationController protocol.

"an object" instead of "an id", maybe.

> Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm:201
> +    else if (customClientAnimationController && [customClientAnimationController conformsToProtocol:@protocol(NSImmediateActionAnimationController)])

No need for the else if because of the return.
Comment 5 Tim Horton 2014-12-11 15:31:10 PST
Comment on attachment 243156 [details]
Patch

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

> Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm:197
> +    id customClientAnimationController = [_wkView _immediateActionAnimationControllerForHitTestResult:toAPI(hitTestResult.get()) withType:_type userData:toAPI(_userData.get())];

I wonder if we should do this (and the early return) earlier so we avoid building a defaultAnimationController if we don't need it.
Comment 6 Beth Dakin 2014-12-11 16:19:13 PST
(In reply to comment #5)
> Comment on attachment 243156 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=243156&action=review
> 
> > Source/WebKit2/UIProcess/mac/WKImmediateActionController.mm:197
> > +    id customClientAnimationController = [_wkView _immediateActionAnimationControllerForHitTestResult:toAPI(hitTestResult.get()) withType:_type userData:toAPI(_userData.get())];
> 
> I wonder if we should do this (and the early return) earlier so we avoid
> building a defaultAnimationController if we don't need it.

Good idea, but then we won't have the _type set yet!
Comment 7 Tim Horton 2014-12-12 00:27:48 PST
Ah, yes. Nevermind!