RESOLVED FIXED 210194
[iOS] Date and time form controls are presented at the wrong size in some modes
https://bugs.webkit.org/show_bug.cgi?id=210194
Summary [iOS] Date and time form controls are presented at the wrong size in some modes
Megan Gardner
Reported 2020-04-08 09:59:07 PDT
Update Sizes calculations for Date/Time form controls
Attachments
Patch (4.29 KB, patch)
2020-04-08 10:04 PDT, Megan Gardner
no flags
Patch (4.01 KB, patch)
2020-04-08 10:26 PDT, Megan Gardner
no flags
Patch (4.04 KB, patch)
2020-04-08 10:27 PDT, Megan Gardner
no flags
Patch (4.43 KB, patch)
2020-04-08 11:55 PDT, Megan Gardner
no flags
Megan Gardner
Comment 1 2020-04-08 10:04:03 PDT
Megan Gardner
Comment 2 2020-04-08 10:26:23 PDT
Megan Gardner
Comment 3 2020-04-08 10:27:22 PDT
Megan Gardner
Comment 4 2020-04-08 10:27:54 PDT
Wenson Hsieh
Comment 5 2020-04-08 10:32:30 PDT
Comment on attachment 395831 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=395831&action=review > Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm:120 > + _datePicker = adoptNS([[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]); Nit - this can just be adoptNS([[UIDatePicker alloc] init]);
Tim Horton
Comment 6 2020-04-08 10:35:10 PDT
Comment on attachment 395831 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=395831&action=review > Source/WebKit/ChangeLog:3 > + Update Sizes calculations for Date/Time form controls This is not a great title because it doesn't describe the problem. The radar title is ... better, but not great. Something more descriptive of the problem (like "[iOS] Date and time form controls are presented at the wrong size in some modes") would be A++. > Source/WebKit/ChangeLog:10 > + Better calculations for sizes happen when we set the mode before calling > + sizeToFit. This is not a great description. I think the key is "defaultSizeForInterfaceOrientation is insufficient, we should let the UIDatePicker determine its own size given the configuration we're going to use" (but in different words) > Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm:120 > + _datePicker = adoptNS([[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]); CGRectZero is fine > Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm:130 > + [_datePicker setFrame:CGRectMake(0, 0, size.width, size.height)]; isn't setFrameSize a thing? Or is that only on NSView? > Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm:346 > + [_viewController setPreferredContentSize:datePicker.frame.size]; Is this OK for all modes?
Tim Horton
Comment 7 2020-04-08 10:35:36 PDT
(In reply to Tim Horton from comment #6) > Comment on attachment 395831 [details] > Patch > > > Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm:120 > > + _datePicker = adoptNS([[UIDatePicker alloc] initWithFrame:CGRectMake(0, 0, 0, 0)]); > > CGRectZero is fine Though wenson is also right.
Wenson Hsieh
Comment 8 2020-04-08 10:46:44 PDT
Comment on attachment 395831 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=395831&action=review >> Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm:130 >> + [_datePicker setFrame:CGRectMake(0, 0, size.width, size.height)]; > > isn't setFrameSize a thing? Or is that only on NSView? AFAIK, this only exists as deprecated SPI on UIView (-setSize:).
Megan Gardner
Comment 9 2020-04-08 11:55:06 PDT
EWS
Comment 10 2020-04-09 10:54:59 PDT
Committed r259806: <https://trac.webkit.org/changeset/259806> All reviewed patches have been landed. Closing bug and clearing flags on attachment 395849 [details].
Note You need to log in before you can comment on or make changes to this bug.