https://bugs.webkit.org/show_bug.cgi?id=244233
rdar://99018889
Reviewed by Aditya Keerthi.
When form control refresh is enabled, controls with tint color now preserve
legibility regardless of any set `accent-color`. To ensure that all controls can display
the same accent-colors, while also taking into account the fact that some controls
may not be able to use certain accent-colors without extensive changes to other parts
of the contol, the visual accent-color is bounded based on whether light mode or dark
mode is being used. In light mode, accent-colors with a luminance greater than 0.5
will have their luminance lowered to 0.5. In dark mode, accent-colors with a luminance
less than or equal to 0.5 will have their luminance increased to 0.5. For both
operations, the color's hue is preserved.
Additionally, checkboxes and radio buttons will now use a dark indicator in
cases where the accent-color luminance is greater than 0.5.
The threshold of 0.5 luminance was chosen to match AppKit's threshold for switching
indicator colors for checkboxes and radio buttons.
`setInsideDisabledSubmitButton` is now `setInsideSubmitButton` and is applied to
all submit buttons, regardless of enabled/disabled state in order to properly set
the text color based on enablement, the window active state, and the controls tint
color in order to preserve contrast.
Affected controls:
* <input type=range> (sliders)
* <input type=checkbox>
* <input type=radio>
* <input type=text list=somedatalist> (list buttons)
* <input type="submit">
* <progress>
* LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-checkbox-radio-do-not-disappear-dark-mode-expected-mismatch.html: Added.
* LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-checkbox-radio-do-not-disappear-dark-mode.html: Added.
* LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-checkbox-radio-do-not-disappear-light-mode-expected-mismatch.html: Added.
* LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-checkbox-radio-do-not-disappear-light-mode.html: Added.
* LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-does-not-affect-inactive-window-dark-mode-expected.html: Added.
* LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-does-not-affect-inactive-window-dark-mode.html: Added.
* LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-does-not-affect-inactive-window-light-mode-expected.html: Added.
* LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-does-not-affect-inactive-window-light-mode.html: Added.
* LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-submit-does-not-disappear-expected-mismatch.html: Added.
* LayoutTests/fast/forms/form-control-refresh/accent-color-contrast-submit-does-not-disappear.html: Added.
* Source/WebCore/rendering/RenderTheme.h:
(WebCore::RenderTheme::submitButtonTextColor const):
(WebCore::RenderTheme::disabledSubmitButtonTextColor const): Deleted.
* Source/WebCore/rendering/TextPaintStyle.cpp:
(WebCore::computeTextPaintStyle):
* Source/WebCore/rendering/cocoa/RenderThemeCocoa.h:
* Source/WebCore/rendering/cocoa/RenderThemeCocoa.mm:
(WebCore::foregroundColorForBackgroundColor):
(WebCore::colorWithTargetLuminance):
(WebCore::checkboxRadioIndicatorColorForVectorBasedControls):
(WebCore::adjustCheckboxRadioBackgroundColorDisabledState):
(WebCore::RenderThemeCocoa::checkboxRadioBackgroundColorForVectorBasedControls const):
(WebCore::RenderThemeCocoa::paintCheckboxForVectorBasedControls):
(WebCore::RenderThemeCocoa::paintRadioForVectorBasedControls):
(WebCore::RenderThemeCocoa::paintButtonForVectorBasedControls):
(WebCore::RenderThemeCocoa::adjustButtonStyleForVectorBasedControls const):
(WebCore::RenderThemeCocoa::controlTintColorWithContrast const):
(WebCore::RenderThemeCocoa::paintListButtonForVectorBasedControls):
(WebCore::RenderThemeCocoa::paintProgressBarForVectorBasedControls):
(WebCore::paintSliderTicksForVectorBasedControls):
(WebCore::RenderThemeCocoa::paintSliderTrackForVectorBasedControls):
(WebCore::RenderThemeCocoa::submitButtonTextColor const):
(WebCore::RenderThemeCocoa::disabledSubmitButtonTextColor const): Deleted.
* Source/WebCore/rendering/style/RenderStyle.cpp:
(WebCore::rareInheritedDataChangeRequiresRepaint):
* Source/WebCore/rendering/style/RenderStyle.h:
* Source/WebCore/rendering/style/RenderStyleInlines.h:
(WebCore::RenderStyle::insideSubmitButton const):
(WebCore::RenderStyle::insideDisabledSubmitButton const): Deleted.
* Source/WebCore/rendering/style/RenderStyleSetters.h:
(WebCore::RenderStyle::setInsideSubmitButton):
(WebCore::RenderStyle::setInsideDisabledSubmitButton): Deleted.
* Source/WebCore/rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::StyleRareInheritedData):
(WebCore::StyleRareInheritedData::operator== const):
(WebCore::StyleRareInheritedData::dumpDifferences const):
* Source/WebCore/rendering/style/StyleRareInheritedData.h:
Canonical link: https://commits.webkit.org/298318@main
4f0c0eb
0a8e48e
🛠 win🧪 win-tests🧪 ios-wk2🧪 api-mac🧪 ios-wk2-wpt🧪 mac-wk1🧪 api-ios🧪 mac-wk2🛠 gtk🧪 mac-AS-debug-wk2🧪 gtk-wk2🧪 mac-wk2-stress🧪 api-gtk🧪 vision-wk2🧪 mac-intel-wk2🛠 playstation🛠 tv-sim🛠 watch🛠 watch-sim