зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1869271 - Use known foreground when accent-color matches the existing AccentColor. r=mstange
Allowing to use two colors for accent-color would be IMO a better solution, but it was rejected by the working group, see https://github.com/w3c/csswg-drafts/issues/6159. Maybe we should make the second color optional? Anyways, this seems reasonable, and avoids weird behavior differences between accent-color: AccentColor and other things... Differential Revision: https://phabricator.services.mozilla.com/D196039
This commit is contained in:
Родитель
b2a8f52ab9
Коммит
98e8fef72f
|
@ -0,0 +1,2 @@
|
|||
<!doctype html>
|
||||
<input type=checkbox checked>
|
|
@ -0,0 +1,2 @@
|
|||
<!doctype html>
|
||||
<input type=checkbox checked style="accent-color: AccentColor">
|
|
@ -16,3 +16,5 @@
|
|||
== checkbox-clamp-01.html checkbox-clamp-01-ref.html
|
||||
== checkbox-clamp-02.html checkbox-clamp-02-ref.html
|
||||
!= checkbox-minimum-size.html checkbox-minimum-size-notref.html
|
||||
|
||||
pref(ui.accentcolor,"#3daee9") pref("ui.accentcolortext","white") == accent-color-accentcolor.html accent-color-accentcolor-ref.html
|
||||
|
|
|
@ -105,16 +105,20 @@ ColorPalette::ColorPalette(nscolor aAccent, nscolor aForeground) {
|
|||
}
|
||||
|
||||
ThemeAccentColor::ThemeAccentColor(const ComputedStyle& aStyle,
|
||||
ColorScheme aScheme) {
|
||||
ColorScheme aScheme)
|
||||
: mDefaultPalette(aScheme == ColorScheme::Light ? &sDefaultLightPalette
|
||||
: &sDefaultDarkPalette) {
|
||||
const auto& color = aStyle.StyleUI()->mAccentColor;
|
||||
if (color.IsColor()) {
|
||||
mAccentColor.emplace(
|
||||
ColorPalette::EnsureOpaque(color.AsColor().CalcColor(aStyle)));
|
||||
} else {
|
||||
MOZ_ASSERT(color.IsAuto());
|
||||
mDefaultPalette = aScheme == ColorScheme::Light ? &sDefaultLightPalette
|
||||
: &sDefaultDarkPalette;
|
||||
if (color.IsAuto()) {
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(color.IsColor());
|
||||
nscolor accentColor =
|
||||
ColorPalette::EnsureOpaque(color.AsColor().CalcColor(aStyle));
|
||||
if (sRGBColor::FromABGR(accentColor) == mDefaultPalette->mAccent) {
|
||||
return;
|
||||
}
|
||||
mAccentColor.emplace(accentColor);
|
||||
}
|
||||
|
||||
sRGBColor ThemeAccentColor::Get() const {
|
||||
|
|
Загрузка…
Ссылка в новой задаче