Bug 213949 - Compile-time enable (but leave disabled at runtime by default) date/time input types on macOS to allow testing of cross platform (e.g. DOM) aspects of the controls
Summary: Compile-time enable (but leave disabled at runtime by default) date/time inpu...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Forms (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Sam Weinig
URL:
Keywords: InRadar
Depends on: 212542
Blocks:
  Show dependency treegraph
 
Reported: 2020-07-03 19:51 PDT by Sam Weinig
Modified: 2020-07-06 16:13 PDT (History)
23 users (show)

See Also:


Attachments
WIP (73.08 KB, patch)
2020-07-04 13:33 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (75.22 KB, patch)
2020-07-04 13:48 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (83.16 KB, patch)
2020-07-04 16:37 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (45.09 KB, patch)
2020-07-04 16:47 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (48.33 KB, patch)
2020-07-04 17:14 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (66.29 KB, patch)
2020-07-04 18:36 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (66.43 KB, patch)
2020-07-04 18:38 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (66.81 KB, patch)
2020-07-04 19:57 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (38.90 KB, patch)
2020-07-05 18:09 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (38.37 KB, patch)
2020-07-05 20:16 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff
Patch (38.81 KB, patch)
2020-07-05 20:54 PDT, Sam Weinig
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sam Weinig 2020-07-03 19:51:23 PDT
We currently have a few of the date/time input types disabled completely on macOS. While we can't enable them completely (they still lack any UI as far as I know), it would be useful to at least have them compiled in and tested via run-webkit-tests for the parts that do work (e.g. the DOM aspects), but runtime disabled everywhere else.

Curious if anyone has objections to this idea (the actual amount of extra code compiled is quite small).
Comment 1 Sam Weinig 2020-07-03 19:51:44 PDT Comment hidden (obsolete)
Comment 2 Sam Weinig 2020-07-03 19:52:03 PDT
Adding folks to get feedback on the idea.
Comment 3 Darin Adler 2020-07-03 21:43:00 PDT
Seems like an obviously good idea.

I seem to recall that we made the decision to compile them out long ago when we couldn’t thoroughly and completely disable such feature at runtime.

Whether the features should show up in the Experimental Features menu seems a separate question. Might be unhelpful if they did at this stage?
Comment 4 Sam Weinig 2020-07-04 11:14:09 PDT
(In reply to Darin Adler from comment #3)
> Seems like an obviously good idea.
> 
> I seem to recall that we made the decision to compile them out long ago when
> we couldn’t thoroughly and completely disable such feature at runtime.

Hm, I am not sure if that is still a problem. It seems like the runtime checks when creating the InputType subclass should be enough. But I will keep this in mind.

> 
> Whether the features should show up in the Experimental Features menu seems
> a separate question. Might be unhelpful if they did at this stage?

Yeah, for now, I was going to keep them off the Experimental Features menu.
Comment 5 Sam Weinig 2020-07-04 11:18:24 PDT
(In reply to Sam Weinig from comment #4)
> (In reply to Darin Adler from comment #3)
> > Seems like an obviously good idea.
> > 
> > I seem to recall that we made the decision to compile them out long ago when
> > we couldn’t thoroughly and completely disable such feature at runtime.
> 
> Hm, I am not sure if that is still a problem. It seems like the runtime
> checks when creating the InputType subclass should be enough. But I will
> keep this in mind.
> 

Hm, I wonder if the issue was with default style sheet. Indeed, enabling the macro, but disabling the runtime feature for, for instance, ENABLE_INPUT_TYPE_DATE, will still have this added to html.css:

input[type="date"] {
    align-items: center;
    -webkit-appearance: menulist-button;
    display: -webkit-inline-flex;
    overflow: hidden;
#if !(defined(WTF_PLATFORM_IOS_FAMILY) && WTF_PLATFORM_IOS_FAMILY)
    width: 10em;
#endif
}

which is likely observable. I am not sure how big a deal this would be in practice.
Comment 6 Sam Weinig 2020-07-04 11:20:48 PDT
(In reply to Sam Weinig from comment #5)
> (In reply to Sam Weinig from comment #4)
> > (In reply to Darin Adler from comment #3)
> > > Seems like an obviously good idea.
> > > 
> > > I seem to recall that we made the decision to compile them out long ago when
> > > we couldn’t thoroughly and completely disable such feature at runtime.
> > 
> > Hm, I am not sure if that is still a problem. It seems like the runtime
> > checks when creating the InputType subclass should be enough. But I will
> > keep this in mind.
> > 
> 
> Hm, I wonder if the issue was with default style sheet. Indeed, enabling the
> macro, but disabling the runtime feature for, for instance,
> ENABLE_INPUT_TYPE_DATE, will still have this added to html.css:
> 
> input[type="date"] {
>     align-items: center;
>     -webkit-appearance: menulist-button;
>     display: -webkit-inline-flex;
>     overflow: hidden;
> #if !(defined(WTF_PLATFORM_IOS_FAMILY) && WTF_PLATFORM_IOS_FAMILY)
>     width: 10em;
> #endif
> }
> 
> which is likely observable. I am not sure how big a deal this would be in
> practice.

If it is an issue, seems like a good time to make see what it would take to allow runtime settings to control what is in the user agent style sheet.
Comment 7 Sam Weinig 2020-07-04 11:25:09 PDT
(In reply to Sam Weinig from comment #6)
> (In reply to Sam Weinig from comment #5)
> > (In reply to Sam Weinig from comment #4)
> > > (In reply to Darin Adler from comment #3)
> > > > Seems like an obviously good idea.
> > > > 
> > > > I seem to recall that we made the decision to compile them out long ago when
> > > > we couldn’t thoroughly and completely disable such feature at runtime.
> > > 
> > > Hm, I am not sure if that is still a problem. It seems like the runtime
> > > checks when creating the InputType subclass should be enough. But I will
> > > keep this in mind.
> > > 
> > 
> > Hm, I wonder if the issue was with default style sheet. Indeed, enabling the
> > macro, but disabling the runtime feature for, for instance,
> > ENABLE_INPUT_TYPE_DATE, will still have this added to html.css:
> > 
> > input[type="date"] {
> >     align-items: center;
> >     -webkit-appearance: menulist-button;
> >     display: -webkit-inline-flex;
> >     overflow: hidden;
> > #if !(defined(WTF_PLATFORM_IOS_FAMILY) && WTF_PLATFORM_IOS_FAMILY)
> >     width: 10em;
> > #endif
> > }
> > 
> > which is likely observable. I am not sure how big a deal this would be in
> > practice.
> 
> If it is an issue, seems like a good time to make see what it would take to
> allow runtime settings to control what is in the user agent style sheet.

Now I am just talking to myself, but it seems like UserAgentStyle::ensureDefaultStyleSheetsForElement() allows for this already.
Comment 8 Sam Weinig 2020-07-04 13:33:28 PDT Comment hidden (obsolete)
Comment 9 Sam Weinig 2020-07-04 13:48:14 PDT Comment hidden (obsolete)
Comment 10 Sam Weinig 2020-07-04 16:37:33 PDT Comment hidden (obsolete)
Comment 11 Sam Weinig 2020-07-04 16:47:09 PDT Comment hidden (obsolete)
Comment 12 Sam Weinig 2020-07-04 17:14:12 PDT Comment hidden (obsolete)
Comment 13 Sam Weinig 2020-07-04 18:36:30 PDT Comment hidden (obsolete)
Comment 14 Sam Weinig 2020-07-04 18:37:55 PDT
Going to wait for https://bugs.webkit.org/show_bug.cgi?id=213964 to land, as that will conflict, and allow this to be a bit smaller (won't have to change all those FeatureDefines.xcconfigs).
Comment 15 Sam Weinig 2020-07-04 18:38:59 PDT Comment hidden (obsolete)
Comment 16 Darin Adler 2020-07-04 19:15:52 PDT
You will want to wait until the patch from bug 212542 lands; after that one, you can definitely flip these flags without touching FeatureDefines.xcconfig. Before that one, PlatformEnableCocoa.h and FeatureDefines.xcconfig both define the same thing, and it would likely be confusing to only edit PlatformEnableCocoa.h, even though it would likely work as long as it’s enabling something *more*.
Comment 17 Sam Weinig 2020-07-04 19:57:04 PDT Comment hidden (obsolete)
Comment 18 Darin Adler 2020-07-05 13:22:34 PDT
Comment on attachment 403544 [details]
Patch

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

> Source/WebKit/Shared/WebPreferencesDefaultValues.h:241
> +#if !PLATFORM(COCOA) || PLATFORM(IOS) || PLATFORM(WATCHOS)

I would write this the opposite way.

    #if !PLATFORM(MAC) && !PLATFORM(MACCATALYST) && !PLATFORM(APPLETV)

That should be the entire list!
Comment 19 Darin Adler 2020-07-05 13:23:51 PDT
Comment on attachment 403544 [details]
Patch

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

> Source/WebCore/ChangeLog:29
> +        Switch from using RuntimeEnabledFeatures to Settings for checking for enabling (Settings allows

Why we do we even have RuntimeEnableFeatures? In what cases does it outshine Settings?

> Source/WebCore/ChangeLog:30
> +        us to write less boilerplait code and is more versitile for testing) and switch to checking the

misspellings: boilerplate and versatile
Comment 20 Sam Weinig 2020-07-05 15:47:21 PDT
(In reply to Darin Adler from comment #19)
> Comment on attachment 403544 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=403544&action=review
> 
> > Source/WebCore/ChangeLog:29
> > +        Switch from using RuntimeEnabledFeatures to Settings for checking for enabling (Settings allows
> 
> Why we do we even have RuntimeEnableFeatures? In what cases does it outshine
> Settings?

The only thing RuntimeEnabledFeatures offers that Settings doesn't, is that they are global, whereas as Settings requires access to a Document or Page. Like most other mutable globals in WebKit, I don't think we should have RuntimeEnabledFeatures (and argued at length when they were added). Any runtime mutation of them is likely wrong with respect to at least Legacy WebKit, as you might have multiple WebViews in a process with different needs.

> 
> > Source/WebCore/ChangeLog:30
> > +        us to write less boilerplait code and is more versitile for testing) and switch to checking the
> 
> misspellings: boilerplate and versatile

I really need to get a text editor with spellcheck one of these days (or learn to spell, though I don't see that happening anytime soon). Maybe I should make the style checker spell check sentences in ChangeLog for me.
Comment 21 Sam Weinig 2020-07-05 18:09:30 PDT Comment hidden (obsolete)
Comment 22 Sam Weinig 2020-07-05 20:16:18 PDT Comment hidden (obsolete)
Comment 23 Sam Weinig 2020-07-05 20:54:40 PDT
Created attachment 403572 [details]
Patch
Comment 24 Darin Adler 2020-07-06 11:35:00 PDT
Comment on attachment 403572 [details]
Patch

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

> Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:-544
> -        _type = WKInputTypeDateTime;

Is there deprecation or removal needed for "WKInputTypeDateTime".
Comment 25 EWS 2020-07-06 12:01:42 PDT
Committed r263977: <https://trac.webkit.org/changeset/263977>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 403572 [details].
Comment 26 Radar WebKit Bug Importer 2020-07-06 12:02:21 PDT
<rdar://problem/65142171>
Comment 27 Sam Weinig 2020-07-06 12:28:45 PDT
(In reply to Darin Adler from comment #24)
> Comment on attachment 403572 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=403572&action=review
> 
> > Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm:-544
> > -        _type = WKInputTypeDateTime;
> 
> Is there deprecation or removal needed for "WKInputTypeDateTime".

There likely should be. I need find out what the current process for removing this kind of SPI is.
Comment 28 Karl Rackler 2020-07-06 15:50:14 PDT
It looks like commit r263977 caused 36 fast form and web-platform test consistently crashing.  Tracking the issue here: https://bugs.webkit.org/show_bug.cgi?id=214009
Comment 29 Darin Adler 2020-07-06 16:03:20 PDT
Comment on attachment 403572 [details]
Patch

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

> Source/WebCore/rendering/RenderTheme.cpp:1089
> +    return ""_s;

IOS_FAMILY builds are crashing here. That’s because this needs to be:

    return emptyString();
Comment 30 Sam Weinig 2020-07-06 16:13:54 PDT
(In reply to Darin Adler from comment #29)
> Comment on attachment 403572 [details]
> Patch
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=403572&action=review
> 
> > Source/WebCore/rendering/RenderTheme.cpp:1089
> > +    return ""_s;
> 
> IOS_FAMILY builds are crashing here. That’s because this needs to be:
> 
>     return emptyString();

Thanks, landed r263993 with the fix <https://trac.webkit.org/changeset/263993>.