WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
238551
[css-ui] alias appearance <compat-auto> keywords to 'auto' for textfield
https://bugs.webkit.org/show_bug.cgi?id=238551
Summary
[css-ui] alias appearance <compat-auto> keywords to 'auto' for textfield
zsun
Reported
2022-03-30 07:08:14 PDT
Add support for alias appearance <compat-auto> keywords to 'auto' for textfield
Attachments
Patch
(4.68 KB, patch)
2022-03-30 07:18 PDT
,
zsun
no flags
Details
Formatted Diff
Diff
Patch
(3.02 KB, patch)
2022-04-01 05:16 PDT
,
zsun
no flags
Details
Formatted Diff
Diff
Patch
(1.55 KB, patch)
2022-05-16 03:10 PDT
,
zsun
no flags
Details
Formatted Diff
Diff
Patch
(3.51 KB, patch)
2022-05-16 03:29 PDT
,
zsun
no flags
Details
Formatted Diff
Diff
[fast-cq] Patch
(3.74 KB, patch)
2022-05-16 05:40 PDT
,
zsun
no flags
Details
Formatted Diff
Diff
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
zsun
Comment 1
2022-03-30 07:18:43 PDT
Created
attachment 456118
[details]
Patch
zsun
Comment 2
2022-04-01 05:16:17 PDT
Created
attachment 456350
[details]
Patch
Tim Nguyen (:ntim)
Comment 3
2022-04-02 19:01:15 PDT
Comment on
attachment 456350
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=456350&action=review
> Source/WebCore/ChangeLog:15 > + The test failures though, are not fully fixed. The issue left is that the search cancel button > + for input type="search" still present while it is expected to disappear.
Can we try to get the 2 tests passing? Just to match WebKit's policy of having tests that start passing for every patch. Maybe this is a good place to start looking:
https://webkit-search.igalia.com/webkit/source/Source/WebCore/html/shadow/TextControlInnerElements.cpp#290-315
Radar WebKit Bug Importer
Comment 4
2022-04-04 11:39:06 PDT
<
rdar://problem/91252542
>
Tim Nguyen (:ntim)
Comment 5
2022-04-04 11:55:07 PDT
I filed
bug 238751
for input[type=search]
Tim Nguyen (:ntim)
Comment 6
2022-04-04 13:46:32 PDT
This is a good starting point: diff --git a/Source/WebCore/html/shadow/TextControlInnerElements.cpp b/Source/WebCore/html/shadow/TextControlInnerElements.cpp index c0e8fee503fe..0098997ddc63 100644 --- a/Source/WebCore/html/shadow/TextControlInnerElements.cpp +++ b/Source/WebCore/html/shadow/TextControlInnerElements.cpp @@ -306,11 +306,13 @@ Ref<SearchFieldCancelButtonElement> SearchFieldCancelButtonElement::create(Docum return element; } -std::optional<Style::ElementStyle> SearchFieldCancelButtonElement::resolveCustomStyle(const Style::ResolutionContext& resolutionContext, const RenderStyle*) +std::optional<Style::ElementStyle> SearchFieldCancelButtonElement::resolveCustomStyle(const Style::ResolutionContext& resolutionContext, const RenderStyle* shadowHostStyle) { auto elementStyle = resolveStyle(resolutionContext); auto& inputElement = downcast<HTMLInputElement>(*shadowHost()); elementStyle.renderStyle->setVisibility(elementStyle.renderStyle->visibility() == Visibility::Hidden || inputElement.value().isEmpty() ? Visibility::Hidden : Visibility::Visible); + if (shadowHostStyle->effectiveAppearance() == TextFieldPart) + elementStyle.renderStyle->setEffectiveDisplay(DisplayType::None); return elementStyle; } Remaining issues are: - width is too large compared to <input type="text"> (not quite sure why) - focusring offset is too large compared to <input type="text"> (html.css sets input[type=text] outline-offset to -2px, but [type=search] to 0, outline-offset needs to be tied to appearance: textfield instead of input[type]) It would be good to fix this first in
bug 238751
Tim Nguyen (:ntim)
Comment 7
2022-05-13 23:07:49 PDT
Comment on
attachment 456350
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=456350&action=review
> Source/WebCore/rendering/RenderTheme.cpp:98 > + if (part == AutoPart || part == SearchFieldPart || part == SearchFieldCancelButtonPart || part == TextAreaPart || part == CheckboxPart || part == RadioPart || part == ListboxPart || part == MeterPart || part == ProgressBarPart
I unexposed SearchFieldCancelButtonPart in
bug 240384
, this isn't needed
> Source/WebCore/rendering/RenderTheme.cpp:128 > +#if ENABLE(INPUT_TYPE_COLOR) > + // Add restriction of using appearances of `textfield` for color element. See > + //
https://bugs.webkit.org/show_bug.cgi?id=191279
> + if (is<HTMLInputElement>(*element) && downcast<HTMLInputElement>(*element).isColorControl()) > + return part; > +#endif
I'm not really sure this behavior is worth preserving. It doesn't match the spec and I don't see the point of setting appearance: textfield on <input type=color>. data:text/html,<input%20type=color%20style="appearance:textfield"> Aditya/Wenson, what do you think?
Tim Nguyen (:ntim)
Comment 8
2022-05-13 23:11:59 PDT
> > Source/WebCore/rendering/RenderTheme.cpp:128 > > +#if ENABLE(INPUT_TYPE_COLOR) > > + // Add restriction of using appearances of `textfield` for color element. See > > + //
https://bugs.webkit.org/show_bug.cgi?id=191279
> > + if (is<HTMLInputElement>(*element) && downcast<HTMLInputElement>(*element).isColorControl()) > > + return part; > > +#endif > > I'm not really sure this behavior is worth preserving. It doesn't match the > spec and I don't see the point of setting appearance: textfield on <input > type=color>. > > data:text/html,<input%20type=color%20style="appearance:textfield"> > > Aditya/Wenson, what do you think?
Fwiw, the relevant test (fast/forms/color/color-input-uses-color-well-appearance.html) argues that <input type=color> and <input type=color style="appearance:textfield"> should look different. The spec argues for otherwise. Looking at the original bug (
bug 191279
), I don't think testing this was necessarily the intent.
Aditya Keerthi
Comment 9
2022-05-13 23:36:14 PDT
(In reply to Tim Nguyen (:ntim) from
comment #7
)
> Comment on
attachment 456350
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=456350&action=review
> > > Source/WebCore/rendering/RenderTheme.cpp:98 > > + if (part == AutoPart || part == SearchFieldPart || part == SearchFieldCancelButtonPart || part == TextAreaPart || part == CheckboxPart || part == RadioPart || part == ListboxPart || part == MeterPart || part == ProgressBarPart > > I unexposed SearchFieldCancelButtonPart in
bug 240384
, this isn't needed > > > Source/WebCore/rendering/RenderTheme.cpp:128 > > +#if ENABLE(INPUT_TYPE_COLOR) > > + // Add restriction of using appearances of `textfield` for color element. See > > + //
https://bugs.webkit.org/show_bug.cgi?id=191279
> > + if (is<HTMLInputElement>(*element) && downcast<HTMLInputElement>(*element).isColorControl()) > > + return part; > > +#endif > > I'm not really sure this behavior is worth preserving. It doesn't match the > spec and I don't see the point of setting appearance: textfield on <input > type=color>. > > data:text/html,<input%20type=color%20style="appearance:textfield"> > > Aditya/Wenson, what do you think?
Agreed. This appears to be an artifact of the time when <input type=color> was just a text box with a hex color code. We can remove the test, or change '-expected-mismatch.html' to '-expected.html', if this is not already covered by a WPT.
Tim Nguyen (:ntim)
Comment 10
2022-05-16 00:27:09 PDT
(In reply to Aditya Keerthi from
comment #9
)
> (In reply to Tim Nguyen (:ntim) from
comment #7
) > > Comment on
attachment 456350
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=456350&action=review
> > > > > Source/WebCore/rendering/RenderTheme.cpp:98 > > > + if (part == AutoPart || part == SearchFieldPart || part == SearchFieldCancelButtonPart || part == TextAreaPart || part == CheckboxPart || part == RadioPart || part == ListboxPart || part == MeterPart || part == ProgressBarPart > > > > I unexposed SearchFieldCancelButtonPart in
bug 240384
, this isn't needed > > > > > Source/WebCore/rendering/RenderTheme.cpp:128 > > > +#if ENABLE(INPUT_TYPE_COLOR) > > > + // Add restriction of using appearances of `textfield` for color element. See > > > + //
https://bugs.webkit.org/show_bug.cgi?id=191279
> > > + if (is<HTMLInputElement>(*element) && downcast<HTMLInputElement>(*element).isColorControl()) > > > + return part; > > > +#endif > > > > I'm not really sure this behavior is worth preserving. It doesn't match the > > spec and I don't see the point of setting appearance: textfield on <input > > type=color>. > > > > data:text/html,<input%20type=color%20style="appearance:textfield"> > > > > Aditya/Wenson, what do you think? > > Agreed. This appears to be an artifact of the time when <input type=color> > was just a text box with a hex color code. > > We can remove the test, or change '-expected-mismatch.html' to > '-expected.html', if this is not already covered by a WPT.
I'd be ok with the renaming option, given we don't fully pass the corresponding WPT for other reasons (
bug 238751
), and that would allow us to have a test for this change. Ziran, does that plan sound ok to you?
zsun
Comment 11
2022-05-16 03:10:36 PDT
Created
attachment 459411
[details]
Patch
zsun
Comment 12
2022-05-16 03:29:28 PDT
Created
attachment 459412
[details]
Patch
Tim Nguyen (:ntim)
Comment 13
2022-05-16 03:31:27 PDT
Comment on
attachment 459412
[details]
Patch r=me if EWS is green
zsun
Comment 14
2022-05-16 05:40:51 PDT
Created
attachment 459418
[details]
[fast-cq] Patch
EWS
Comment 15
2022-05-16 12:01:22 PDT
Committed
r294249
(
250605@main
): <
https://commits.webkit.org/250605@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 459418
[details]
.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug