Bug 210613 - Date and Time form controls not showing correct initial values on immediate second invocation.
Summary: Date and Time form controls not showing correct initial values on immediate s...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Megan Gardner
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-04-16 11:09 PDT by Megan Gardner
Modified: 2020-04-20 14:46 PDT (History)
3 users (show)

See Also:


Attachments
Patch (22.16 KB, patch)
2020-04-17 17:00 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff
Patch for landing (22.10 KB, patch)
2020-04-20 14:17 PDT, Megan Gardner
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Megan Gardner 2020-04-16 11:09:34 PDT
Date and Time form controls not showing correct initial values on immediate second invocation.
Comment 1 Megan Gardner 2020-04-17 17:00:13 PDT
Created attachment 396817 [details]
Patch
Comment 2 Wenson Hsieh 2020-04-17 17:26:20 PDT
Comment on attachment 396817 [details]
Patch

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

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:4325
> +- (void)updateValueAsNumberForViewController:(double)value

Nit - the “ForViewController:" suffix makes it sound like the argument should be a `UIViewController *`, but instead it’s a value.

What about naming these -updateFocusedElementValueAsNumber: and -updateFocusedElementValue: instead?

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:8488
> +#elif PLATFORM(IOS)

This excludes Mac Catalyst — is that intentional?

> Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm:153
> +    NSDateComponents *components = [calendar components:(NSCalendarUnitHour) fromDate:[_datePicker date]];

Nit - don’t need () around NSCalendarUnitMinute.

> Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm:161
> +    NSDateComponents *components = [calendar components:(NSCalendarUnitMinute) fromDate:[_datePicker date]];

Nit - ditto regarding the ().

> Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm:280
> +    date = [[self dateFormatterForPicker] dateFromString:timeString];

Nit - I don’t think the date local variable adds much value here, but if you prefer to include it, I’d move this down so that it’s just:

NSDate *date = [[self dateFormatterForPicker] dateFromString:timeString];

> Source/WebKit/UIProcess/ios/forms/WKFormInputControl.mm:328
> +    if ([self.control isKindOfClass:WKDateTimePopover.class])

Nit - WKDateTimePopover and WKDateTimePicker are not subclasses of each other, so you don’t need the return statements here.
Comment 3 Megan Gardner 2020-04-20 14:17:35 PDT
Created attachment 397014 [details]
Patch for landing
Comment 4 EWS 2020-04-20 14:45:07 PDT
Committed r260402: <https://trac.webkit.org/changeset/260402>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 397014 [details].
Comment 5 Radar WebKit Bug Importer 2020-04-20 14:46:19 PDT
<rdar://problem/62076826>