RESOLVED FIXED 196021
[iOS] Inline -_ensureFormAccessoryView into -formAccessoryView and have -_updateAccessory ensure we have a form accessory
https://bugs.webkit.org/show_bug.cgi?id=196021
Summary [iOS] Inline -_ensureFormAccessoryView into -formAccessoryView and have -_upd...
Daniel Bates
Reported 2019-03-20 11:49:48 PDT
I don't see much benefit to -formAccessoryView being implemented in terms of -_ensureFormAccessoryView just inline the latter into the former and remove a method. Also, every caller except -formAccessoryView calls -_ensureFormAccessoryView followed immediately by -_updateAccessory. So, let's have -_updateAccessory just ensure we have a form accessory view instead of each caller.
Attachments
Patch (4.32 KB, patch)
2019-03-20 11:55 PDT, Daniel Bates
no flags
To Land (5.04 KB, patch)
2019-03-21 11:14 PDT, Daniel Bates
no flags
Daniel Bates
Comment 1 2019-03-20 11:55:14 PDT
Wenson Hsieh
Comment 2 2019-03-21 10:47:16 PDT
Comment on attachment 365374 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=365374&action=review > Source/WebKit/ChangeLog:9 > + Every caller of -_ensureFormAccessoryView, except -formAccessoryView, immediately the call with > + -_updateAccessory. Let's just have -_updateAccessory ensure we have a form accessory view and Nit - "immediately the call with" > Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:3784 > + [self formAccessoryView]; // Creates one if needed. Nit - we can also do something like: UIWebFormAccessory *accessoryView = [self formAccessoryView]; ...and then just use the accessoryView variable below, instead of _formAccessoryView. I think we wouldn't need the comment if we did this.
Daniel Bates
Comment 3 2019-03-21 11:01:57 PDT
Comment on attachment 365374 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=365374&action=review >> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:3784 >> + [self formAccessoryView]; // Creates one if needed. > > Nit - we can also do something like: > > UIWebFormAccessory *accessoryView = [self formAccessoryView]; > > ...and then just use the accessoryView variable below, instead of _formAccessoryView. I think we wouldn't need the comment if we did this. Of course! What was I thinking!
Daniel Bates
Comment 4 2019-03-21 11:10:07 PDT
Comment on attachment 365374 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=365374&action=review >>> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:3784 >>> + [self formAccessoryView]; // Creates one if needed. >> >> Nit - we can also do something like: >> >> UIWebFormAccessory *accessoryView = [self formAccessoryView]; >> >> ...and then just use the accessoryView variable below, instead of _formAccessoryView. I think we wouldn't need the comment if we did this. > > Of course! What was I thinking! I'm still going to keep the comment though, because it seems subtle and I absolutely can envision a person in the future coming through this code, realizing we have _formAccessoryView and without thinking swap out the self.formAccessoryView with _formAccessoryView.
Daniel Bates
Comment 5 2019-03-21 11:10:58 PDT
(In reply to Daniel Bates from comment #4) > Comment on attachment 365374 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=365374&action=review > > >>> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:3784 > >>> + [self formAccessoryView]; // Creates one if needed. > >> > >> Nit - we can also do something like: > >> > >> UIWebFormAccessory *accessoryView = [self formAccessoryView]; > >> > >> ...and then just use the accessoryView variable below, instead of _formAccessoryView. I think we wouldn't need the comment if we did this. > > > > Of course! What was I thinking! > > I'm still going to keep the comment though, because it seems subtle and I > absolutely can envision a person in the future coming through this code, > realizing we have _formAccessoryView and without thinking swap out the > self.formAccessoryView with _formAccessoryView. Having a test would be better to catch this though :/ Leaving the comment in for now.
Daniel Bates
Comment 6 2019-03-21 11:14:01 PDT
Daniel Bates
Comment 7 2019-03-21 11:15:04 PDT
Radar WebKit Bug Importer
Comment 8 2019-03-21 11:16:17 PDT
Note You need to log in before you can comment on or make changes to this bug.