Bug 190402 - [iOS] Cleanup -[WAKView _selfHandleEvent:] and -[WAKWindow sendEventSynchronously:]
Summary: [iOS] Cleanup -[WAKView _selfHandleEvent:] and -[WAKWindow sendEventSynchrono...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Local Build
Hardware: All iOS 12
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords: InRadar
Depends on:
Blocks: 190571
  Show dependency treegraph
 
Reported: 2018-10-09 09:56 PDT by Daniel Bates
Modified: 2018-10-14 22:02 PDT (History)
4 users (show)

See Also:


Attachments
Patch (5.04 KB, patch)
2018-10-09 09:59 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch (5.17 KB, patch)
2018-10-09 10:07 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch (5.11 KB, patch)
2018-10-09 10:13 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch (5.11 KB, patch)
2018-10-09 10:46 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
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>