Bug 211825

Summary: Change Date/Time popovers to contextMenus.
Product: WebKit Reporter: Megan Gardner <megan_gardner>
Component: New BugsAssignee: Megan Gardner <megan_gardner>
Status: RESOLVED FIXED    
Severity: Normal CC: thorton, webkit-bug-importer, wenson_hsieh
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch
none
Patch for landing none

Description Megan Gardner 2020-05-12 18:56:32 PDT
Change Date/Time popovers to contextMenus.
Comment 1 Megan Gardner 2020-05-12 19:06:44 PDT
Created attachment 399226 [details]
Patch
Comment 2 Megan Gardner 2020-05-12 20:29:43 PDT
Created attachment 399235 [details]
Patch
Comment 3 Megan Gardner 2020-05-12 21:56:45 PDT
Created attachment 399239 [details]
Patch
Comment 4 Wenson Hsieh 2020-05-13 08:03:00 PDT
Comment on attachment 399239 [details]
Patch

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

> Source/WebKit/ChangeLog:9
> +        Removed all the unneded popover code.

Nit - unneeded

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:104
> +@class WKDateTimeInputControl;

Nit - let’s keep this sorted and move it above WKDrawingCoordinator.

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.h:542
> +- (NSString*)inputLabelText;

Nit - space before *

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:8628
> +- (WKDateTimeInputControl *)formInputControl

Should we also rename `-formInputControl` to `-dateTimeInputControl`?

> Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm:44
> +}
> +- (id)init;

Nit - no need for the { }, as well as the -init declaration.

> Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm:67
> +- (id)initWithView:(WKContentView *)view datePickerMode:(UIDatePickerMode)mode;

Let’s use instancetype for the return value.

> Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm:87
> +- (id)init
> +{
> +    if (!(self = [super init]))
> +        return nil;
> +    return self;
> +}

Do we need to override this?

> Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm:175
> +        [_viewController setToolbarItems:@[ [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil], [[UIBarButtonItem alloc] initWithTitle:resetString style:UIBarButtonItemStylePlain target:self action:@selector(reset:)] ]];

The two UIBarButtonItems leak here.

> Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm:182
> +            UILabel *title = [[UILabel alloc] init];

The UILabel leaks here.

> Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm:187
> +            _viewController.get().navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithCustomView:title];

This leaks the UIBarButtonItem.

> Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm:432
> +    RetainPtr<NSObject <WKFormControl>> control;
> +    control = adoptNS([[WKDateTimePicker alloc] initWithView:view datePickerMode:mode]);

Nit - I think you can just return [super initWithView:view control:adoptNS([[WKDateTimePicker alloc] initWithView:view datePickerMode:mode])];
Comment 5 Wenson Hsieh 2020-05-13 08:07:09 PDT
Comment on attachment 399239 [details]
Patch

r=me, with fixes for the memory leaks and style nits
Comment 6 Wenson Hsieh 2020-05-13 08:13:41 PDT
Comment on attachment 399239 [details]
Patch

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

It’s also probably worth running the tests in fast/forms/ios to make sure this doesn’t break any testing infrastructure.

> Source/WebKit/UIProcess/ios/forms/WKDateTimeInputControl.mm:58
> +    WKContentView* _view;

Nit - space before the *
Comment 7 Megan Gardner 2020-05-13 09:06:58 PDT
Created attachment 399267 [details]
Patch
Comment 8 Megan Gardner 2020-05-13 09:18:37 PDT
Created attachment 399272 [details]
Patch
Comment 9 Megan Gardner 2020-05-13 13:56:47 PDT
<rdar://problem/63102524>
Comment 10 Megan Gardner 2020-05-13 14:34:22 PDT
Created attachment 399301 [details]
Patch for landing
Comment 11 EWS 2020-05-13 14:54:55 PDT
Committed r261658: <https://trac.webkit.org/changeset/261658>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 399301 [details].