Bug 1728187 - Make the non-native theme not use standins for system colors if forcing colors. r=morgan

We allow using system colors when forcing colors so it makes sense to do this.

Differential Revision: https://phabricator.services.mozilla.com/D125271
This commit is contained in:
Emilio Cobos Álvarez 2021-09-10 23:10:52 +00:00
Родитель cb73f03ff7
Коммит 694fef2dcb
2 изменённых файлов: 16 добавлений и 19 удалений

Просмотреть файл

@ -37,11 +37,11 @@ struct PreferenceSheet {
bool mUseDocumentColors = true;
// Whether the non-native theme should use system colors for widgets.
// We only do that if we have a high-contrast theme _and_ we are overriding
// the document colors. Otherwise it causes issues when pages only override
// some of the system colors, specially in dark themes mode.
// We only do that if we are overriding the document colors. Otherwise it
// causes issues when pages only override some of the system colors,
// specially in dark themes mode.
bool NonNativeThemeShouldUseSystemColors() const {
return mUseAccessibilityTheme && !mUseDocumentColors;
return !mUseDocumentColors;
}
void Load(bool aIsChrome);

Просмотреть файл

@ -70,8 +70,6 @@ function pushPrefEnvAndWait(args, cb) {
pushPrefEnvAndWait({'set': [['browser.display.document_color_use', 1]]}, part1);
var transparentBackgroundColor;
var inputBackgroundColor, inputColor, inputBorderTopColor;
var inputBorderRightColor, inputBorderLeftColor, inputBorderBottomColor;
function part1()
{
@ -106,7 +104,7 @@ function part1()
isnot(cs5.borderRightColor, cs2.borderRightColor,
"border-inline-end-color applies");
isnot(cs5.borderLeftColor, cs2.borderLeftColor,
"border-inline-start-color applies");
"border-inline-start-color applies");
isnot(cs6.borderRightColor, cs2.borderRightColor,
"border-inline-start-color applies");
isnot(cs6.borderLeftColor, cs2.borderLeftColor,
@ -124,15 +122,14 @@ function part1()
"border-bottom-color applies");
isnot(cs8.borderImageSource, cs9.borderImageSource, "border-image-source applies");
transparentBackgroundColor = cs2.backgroundColor;
inputBackgroundColor = cs4.backgroundColor;
inputColor = cs4.color;
inputBorderTopColor = cs4.borderTopColor;
inputBorderRightColor = cs4.borderRightColor;
inputBorderLeftColor = cs4.borderLeftColor;
inputBorderBottomColor = cs4.borderBottomColor;
pushPrefEnvAndWait({'set': [['browser.display.document_color_use', 2]]}, part2);
}
function systemColor(c) {
let {r, g, b, a} = SpecialPowers.wrap(window).InspectorUtils.colorToRGBA(c, document);
return a != 1 ? `rgba(${r}, ${g}, ${b}, ${a})` : `rgb(${r}, ${g}, ${b})`;
}
function part2()
{
isnot(cs1.backgroundColor, cs2.backgroundColor, "background-color transparency preserved (opaque)");
@ -168,14 +165,14 @@ function part2()
"border-left-color is blocked");
is(cs3.borderBottomColor, cs4.borderBottomColor,
"border-bottom-color is blocked");
is(cs4.backgroundColor, inputBackgroundColor, "background-color not broken on inputs");
is(cs4.color, inputColor, "color not broken on inputs");
is(cs4.borderTopColor, inputBorderTopColor, "border-top-color not broken on inputs");
is(cs4.borderRightColor, inputBorderRightColor,
is(cs4.backgroundColor, systemColor("ButtonFace"), "background-color not broken on inputs");
is(cs4.color, systemColor("ButtonText"), "color not broken on inputs");
is(cs4.borderTopColor, systemColor("ThreeDLightShadow"), "border-top-color not broken on inputs");
is(cs4.borderRightColor, systemColor("ThreeDLightShadow"),
"border-right-color not broken on inputs");
is(cs4.borderLeftColor, inputBorderLeftColor,
is(cs4.borderLeftColor, systemColor("ThreeDLightShadow"),
"border-left-color not broken on inputs");
is(cs4.borderBottomColor, inputBorderBottomColor,
is(cs4.borderBottomColor, systemColor("ThreeDLightShadow"),
"border-bottom-color not broken on inputs");
is(cs8.borderImageSource, cs9.borderImageSource, "border-image-source is blocked");