diff --git a/layout/style/PreferenceSheet.h b/layout/style/PreferenceSheet.h index 02241e232fae..c9fcf4e820e9 100644 --- a/layout/style/PreferenceSheet.h +++ b/layout/style/PreferenceSheet.h @@ -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); diff --git a/layout/style/test/test_dont_use_document_colors.html b/layout/style/test/test_dont_use_document_colors.html index 401f66d2442e..7148d950b19e 100644 --- a/layout/style/test/test_dont_use_document_colors.html +++ b/layout/style/test/test_dont_use_document_colors.html @@ -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");