Bug 190402

Summary: [iOS] Cleanup -[WAKView _selfHandleEvent:] and -[WAKWindow sendEventSynchronously:]
Product: WebKit Reporter: Daniel Bates <dbates>
Component: WebCore Misc.Assignee: Daniel Bates <dbates>
Status: RESOLVED FIXED    
Severity: Normal CC: aestes, andersca, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Local Build   
Hardware: All   
OS: iOS 12   
Bug Depends on:    
Bug Blocks: 190571    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch none

Description Daniel Bates 2018-10-09 09:56:16 PDT
Cleanup code style in -[WAKView _selfHandleEvent:] and -[WAKWindow sendEventSynchronously:] and remove default case statements with body ASSERT_NOT_REACHED() so as make a missing enumerator a compile-time error instead of a runtime error.
Comment 1 Daniel Bates 2018-10-09 09:59:11 PDT
Created attachment 351884 [details]
Patch
Comment 2 Daniel Bates 2018-10-09 10:07:18 PDT
Created attachment 351885 [details]
Patch

More clean up of -[WAKView _selfHandleEvent:]. Inline a local variable into the swithc condition, change break statements to return statements and remove the return statement at the end of the function as the compiler is capable of verifing that the switch block handles all enumerators.
Comment 3 Daniel Bates 2018-10-09 10:13:26 PDT
Created attachment 351886 [details]
Patch

Tighten up -[WAKView _selfHandleEvent:] some more by removing unncessary braces.
Comment 4 Anders Carlsson 2018-10-09 10:14:15 PDT
Comment on attachment 351886 [details]
Patch

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

> Source/WebCore/platform/ios/wak/WAKView.mm:132
>  - (BOOL)_selfHandleEvent:(WebEvent *)event
>  {

Does _selfHandleEvent ever return NO? I'm guessing there are WAKView subclasses that can return NO.
Comment 5 Daniel Bates 2018-10-09 10:46:06 PDT
Created attachment 351894 [details]
Patch
Comment 6 Daniel Bates 2018-10-09 14:22:36 PDT
(In reply to Anders Carlsson from comment #4)
> Comment on attachment 351886 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=351886&action=review
> 
> > Source/WebCore/platform/ios/wak/WAKView.mm:132
> >  - (BOOL)_selfHandleEvent:(WebEvent *)event
> >  {
> 
> Does _selfHandleEvent ever return NO? I'm guessing there are WAKView
> subclasses that can return NO.

Your intuition is correct. -[WAKScrollView _selfHandleEvent] can return NO: <https://trac.webkit.org/browser/trunk/Source/WebCore/platform/ios/wak/WAKScrollView.mm?rev=236938#L88>.
Comment 7 Daniel Bates 2018-10-10 20:08:39 PDT
Comment on attachment 351894 [details]
Patch

Clearing flags on attachment: 351894

Committed r237027: <https://trac.webkit.org/changeset/237027>
Comment 8 Daniel Bates 2018-10-10 20:08:41 PDT
All reviewed patches have been landed.  Closing bug.
Comment 9 Radar WebKit Bug Importer 2018-10-10 20:09:28 PDT
<rdar://problem/45182678>