-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[macOS] Fix input[type=search] rendering in vertical writing mode #20146
Conversation
EWS run on previous version of this PR (hash ae41bd8) |
auto effectiveAppearance = shadowHostStyle->effectiveAppearance(); | ||
if (effectiveAppearance == StyleAppearance::TextField && shadowHostStyle->appearance() == StyleAppearance::TextField) { | ||
auto elementStyle = resolveStyle(resolutionContext); | ||
elementStyle.style->setDisplay(DisplayType::None); | ||
return elementStyle; | ||
} | ||
if (appearance != StyleAppearance::SearchField) { | ||
if (effectiveAppearance != StyleAppearance::SearchField && effectiveAppearance != StyleAppearance::TextField) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These checks are not super pretty nor self explanatory IMO.
We should probably have a static method in this file that takes a RenderStyle and says whether the effectiveAppearance is default based on the writing mode and the effectiveAppearance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll add a static method with a good name for clarity. Though the method won't consider writing-mode
, since that's a macOS specific behavior. It's more about the original appearance the author specified.
if (appearance == StyleAppearance::SearchField && searchFieldShouldAppearAsTextField(style)) { | ||
appearance = StyleAppearance::TextField; | ||
style.setEffectiveAppearance(appearance); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I somewhat wished we had all of this logic in autoAppearanceForElement
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wanted to keep the special case separate, similar to the isControlStyled
cases. Going to leave this as-is unless you feel strongly.
EWS run on previous version of this PR (hash 6bd2088)
|
EWS run on current version of this PR (hash 2998648) |
https://bugs.webkit.org/show_bug.cgi?id=248334 rdar://102658361 Reviewed by Tim Nguyen. Native search fields are not height resizable, and have shadows, preventing their use in vertical writing mode. Instead, fall back to drawing native text fields, which are height resizable. Additionally, ensure that the cancel and results buttons are displayed correctly in vertical writing mode. * Source/WebCore/html/shadow/TextControlInnerElements.cpp: 253691@main introduced logic to hide the cancel and results buttons when authors specify `appearance: textfield` on search inputs. Preserve this functionality, but also allow cases where the user agent applies `appearance: textfield` for rendering purposes (in this case, in vertical writing mode), by comparing `appearance` in addition to `effectiveAppearance`. (WebCore::searchFieldStyleHasExplicitlySpecifiedTextFieldAppearance): (WebCore::SearchFieldResultsButtonElement::resolveCustomStyle): (WebCore::SearchFieldCancelButtonElement::resolveCustomStyle): * Source/WebCore/rendering/RenderTheme.cpp: (WebCore::RenderTheme::adjustStyle): Set an effective appearance of `TextField` for search fields using a vertical writing mode. * Source/WebCore/rendering/RenderTheme.h: (WebCore::RenderTheme::searchFieldShouldAppearAsTextField const): * Source/WebCore/rendering/RenderThemeMac.h: * Source/WebCore/rendering/RenderThemeMac.mm: (WebCore::RenderThemeMac::searchFieldShouldAppearAsTextField const): (WebCore::RenderThemeMac::adjustSearchFieldDecorationPartStyle const): While the results and cancel buttons are not being rotated, ensure there is not an excessive amount of padding at the logical top of the control in cases where the results button is hidden. Canonical link: https://commits.webkit.org/270415@main
2998648
to
64d1b1b
Compare
Committed 270415@main (64d1b1b): https://commits.webkit.org/270415@main Reviewed commits have been landed. Closing PR #20146 and removing active labels. |
64d1b1b
2998648