Bug 1917034 - Remove some related always-on prefs. r=firefox-style-system-reviewers,zrhoffman

Differential Revision: https://phabricator.services.mozilla.com/D221769
This commit is contained in:
Emilio Cobos Álvarez 2024-09-12 11:25:35 +00:00
Родитель f299fb9ba0
Коммит 99662b69fb
13 изменённых файлов: 22 добавлений и 129 удалений

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

@ -76,24 +76,6 @@ if (!Services.prefs.getBoolPref("layout.css.scroll-anchoring.enabled")) {
});
}
if (!Services.prefs.getBoolPref("layout.css.forced-colors.enabled")) {
ignoreList.push({
sourceName: /pdf\.js\/web\/viewer\.css$/,
errorMessage: /Expected media feature name but found forced-colors*/i,
isFromDevTools: false,
});
}
if (!Services.prefs.getBoolPref("layout.css.forced-color-adjust.enabled")) {
// PDF.js uses a property that is currently not enabled.
ignoreList.push({
sourceName: /web\/viewer\.css$/i,
errorMessage:
/Unknown property forced-color-adjust\. {2}Declaration dropped\./i,
isFromDevTools: false,
});
}
let propNameAllowlist = [
// These custom properties are retrieved directly from CSSOM
// in videocontrols.xml to get pre-defined style instead of computed

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

@ -9,15 +9,9 @@
add_common_setup();
const HIGH_CONTRAST_MODE_OFF = [
[PREFS.USE_ACCESSIBILITY_THEME, 0],
[PREFS.PREFERS_CONTRAST_ENABLED, true],
];
const HIGH_CONTRAST_MODE_OFF = [[PREFS.USE_ACCESSIBILITY_THEME, 0]];
const HIGH_CONTRAST_MODE_ON = [
[PREFS.USE_ACCESSIBILITY_THEME, 1],
[PREFS.PREFERS_CONTRAST_ENABLED, true],
];
const HIGH_CONTRAST_MODE_ON = [[PREFS.USE_ACCESSIBILITY_THEME, 1]];
add_task(async function testReportSentViewBGColor() {
ensureReportBrokenSitePreffedOn();

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

@ -31,7 +31,6 @@ const PREFS = {
SEND_MORE_INFO: "ui.new-webcompat-reporter.send-more-info-link",
NEW_REPORT_ENDPOINT: "ui.new-webcompat-reporter.new-report-endpoint",
REPORT_SITE_ISSUE_ENABLED: "extensions.webcompat-reporter.enabled",
PREFERS_CONTRAST_ENABLED: "layout.css.prefers-contrast.enabled",
TOUCH_EVENTS: "dom.w3c_touch_events.enabled",
USE_ACCESSIBILITY_THEME: "ui.useAccessibilityTheme",
};

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

@ -572,9 +572,6 @@ void nsPresContext::PreferenceChanged(const char* aPrefName) {
auto restyleHint = RestyleHint{0};
// Changing any of these potentially changes the value of @media
// (prefers-contrast).
// The layout.css.prefers-contrast.enabled pref itself is not handled here,
// because that pref doesn't just affect the "live" value of the media query;
// it affects whether it is parsed at all.
if (prefName.EqualsLiteral("browser.display.document_color_use") ||
prefName.EqualsLiteral("browser.display.foreground_color") ||
prefName.EqualsLiteral("browser.display.background_color")) {

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

@ -1,5 +1,5 @@
# This pref enables high-contrast mode in the testcases here:
defaults test-pref(browser.display.document_color_use,2) test-pref(browser.display.permit_backplate,true) test-pref(layout.css.prefers-contrast.enabled,true) test-pref(layout.css.forced-colors.enabled,true) test-pref(browser.display.foreground_color,"#000000") test-pref(browser.display.background_color,"#FFFFFF") pref(ui.use_standins_for_native_colors,true) pref(widget.non-native-theme.always-high-contrast,true)
defaults test-pref(browser.display.document_color_use,2) test-pref(browser.display.permit_backplate,true) test-pref(browser.display.foreground_color,"#000000") test-pref(browser.display.background_color,"#FFFFFF") pref(ui.use_standins_for_native_colors,true) pref(widget.non-native-theme.always-high-contrast,true)
# There are several platform-specific fuzzy-if notations below due to
# anti-aliasing, extra ink overflow, and slightly inacurate reftest
@ -66,9 +66,6 @@ test-pref(privacy.resistFingerprinting,true) != prefers-contrast-001.html prefer
# high should not match when RFP is enabled.
test-pref(ui.windowForeground,"black") test-pref(ui.windowBackground,"white") test-pref(privacy.resistFingerprinting,true) test-pref(ui.useAccessibilityTheme,1) != prefers-contrast-002.html prefers-contrast-black-ref.html
# Should only be enabled behind preference.
test-pref(layout.css.prefers-contrast.enabled,false) != prefers-contrast-001.html prefers-contrast-black-ref.html
# a prefers-contrast value of no-preference should evaluate to false
# in the boolean context
test-pref(browser.display.document_color_use,0) != prefers-contrast-001.html prefers-contrast-black-ref.html
@ -105,7 +102,7 @@ pref(ui.use_standins_for_native_colors,false) pref(browser.display.use_system_co
pref(ui.use_standins_for_native_colors,false) pref(browser.display.use_system_colors,false) pref(browser.display.background_color,"white") pref(browser.display.foreground_color,"black") == prefers-color-scheme.html prefers-color-scheme-light.html
# Forced color adjust
pref(layout.css.forced-color-adjust.enabled,true) == backplate-force-color-adjust.html backplate-force-color-adjust-ref.html
== backplate-force-color-adjust.html backplate-force-color-adjust-ref.html
== transparent-textarea.html transparent-textarea-ref.html
== color-scheme.html color-scheme-ref.html

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

@ -8,23 +8,6 @@ const SHEET = document.querySelector('style');
SimpleTest.waitForExplicitFinish();
async function testWithPref() {
await new Promise(r => {
SpecialPowers.pushPrefEnv(
{
set: [
["layout.css.forced-colors.enabled", false],
],
},
r
);
});
expectKnown("(forced-colors: none)");
expectKnown("(forced-colors: active)");
expectKnown("(forced-colors)");
SimpleTest.finish();
}
function expect(q, shouldBeKnown) {
is(matchMedia(q).media, q, "Serialization should roundtrip");
is(matchMedia(`${q} or (not ${q})`).matches, shouldBeKnown, `Query should${shouldBeKnown ? "" : " not"} be known`);
@ -80,5 +63,5 @@ expectKnown("(forced-colors)");
expectUnkown("(-moz-platform: )");
testWithPref();
SimpleTest.finish();
</script>

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

@ -13830,16 +13830,14 @@ gCSSProperties["math-style"] = {
invalid_values: [],
};
if (IsCSSPropertyPrefEnabled("layout.css.forced-color-adjust.enabled")) {
gCSSProperties["forced-color-adjust"] = {
gCSSProperties["forced-color-adjust"] = {
domProp: "forcedColorAdjust",
inherited: true,
type: CSS_TYPE_LONGHAND,
initial_values: ["auto"],
other_values: ["none"],
invalid_values: [],
};
}
};
if (IsCSSPropertyPrefEnabled("layout.css.animation-composition.enabled")) {
gCSSProperties["animation-composition"] = {

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

@ -710,25 +710,15 @@ function run() {
expression_should_not_be_known(query);
}
{
let should_be_parseable_if_enabled = SpecialPowers.getBoolPref('layout.css.prefers-contrast.enabled')
? expression_should_be_known
: expression_should_not_be_known;
should_be_parseable_if_enabled("prefers-contrast");
should_be_parseable_if_enabled("prefers-contrast: more");
should_be_parseable_if_enabled("prefers-contrast: less");
should_be_parseable_if_enabled("prefers-contrast: custom");
should_be_parseable_if_enabled("prefers-contrast: no-preference");
}
expression_should_be_known("prefers-contrast");
expression_should_be_known("prefers-contrast: more");
expression_should_be_known("prefers-contrast: less");
expression_should_be_known("prefers-contrast: custom");
expression_should_be_known("prefers-contrast: no-preference");
{
let should_be_parseable_if_enabled = SpecialPowers.getBoolPref('layout.css.forced-colors.enabled')
? expression_should_be_known
: expression_should_not_be_known;
should_be_parseable_if_enabled("forced-colors");
should_be_parseable_if_enabled("forced-colors: none");
should_be_parseable_if_enabled("forced-colors: active");
}
expression_should_be_known("forced-colors");
expression_should_be_known("forced-colors: none");
expression_should_be_known("forced-colors: active");
// OpenType SVG media features
expression_should_not_be_known("(-moz-is-glyph)");

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

@ -35,7 +35,6 @@ function promiseForChange(mediaQuery) {
}
add_task(async () => {
await SpecialPowers.pushPrefEnv({ set: [["layout.css.prefers-contrast.enabled", true]]});
const initiallyMatches =
window.matchMedia("(prefers-contrast: more)").matches;
const changePromise = initiallyMatches ?

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

@ -9229,17 +9229,6 @@
mirror: always
rust: true
# Dictates whether or not the prefers contrast media query will be
# usable.
# true: prefers-contrast will toggle based on OS and browser settings.
# false: prefers-contrast will only parse and toggle in the browser
# chrome and ua.
- name: layout.css.prefers-contrast.enabled
type: RelaxedAtomicBool
value: true
mirror: always
rust: true
# An override for prefers-color-scheme for content documents.
# 0: Dark
# 1: Light
@ -9249,13 +9238,6 @@
value: 2
mirror: always
# Dictates whether or not the forced-colors media query is enabled.
- name: layout.css.forced-colors.enabled
type: RelaxedAtomicBool
value: true
mirror: always
rust: true
# Dictates whether or not the prefers-reduced-transparency media query is enabled.
- name: layout.css.prefers-reduced-transparency.enabled
type: RelaxedAtomicBool
@ -9270,13 +9252,6 @@
mirror: always
rust: true
# Is support for forced-color-adjust properties enabled?
- name: layout.css.forced-color-adjust.enabled
type: RelaxedAtomicBool
value: true
mirror: always
rust: true
# Is support for -moz-prefixed animation properties enabled?
- name: layout.css.prefixes.animations
type: bool

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

@ -835,11 +835,6 @@ pub static MEDIA_FEATURES: [QueryFeatureDescription; 60] = [
atom!("prefers-contrast"),
AllowsRanges::No,
keyword_evaluator!(eval_prefers_contrast, PrefersContrast),
// Note: by default this is only enabled in browser chrome and
// ua. It can be enabled on the web via the
// layout.css.prefers-contrast.enabled preference. See
// disabed_by_pref in media_feature_expression.rs for how that
// is done.
FeatureFlags::empty(),
),
feature!(

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

@ -358,8 +358,6 @@ ${helpers.predefined_type(
"ForcedColorAdjust",
"computed::ForcedColorAdjust::Auto",
engines="gecko",
gecko_pref="layout.css.forced-color-adjust.enabled",
has_effect_on_gecko_scrollbars=False,
animation_type="discrete",
spec="https://drafts.csswg.org/css-color-adjust-1/#forced-color-adjust-prop",
affects="paint",

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

@ -309,20 +309,6 @@ fn consume_operation_or_colon<'i>(
fn disabled_by_pref(feature: &Atom, context: &ParserContext) -> bool {
#[cfg(feature = "gecko")]
{
if *feature == atom!("forced-colors") {
// forced-colors is always enabled in the ua and chrome. On
// the web it is hidden behind a preference, which is defaulted
// to 'true' as of bug 1659511.
return !context.chrome_rules_enabled() &&
!static_prefs::pref!("layout.css.forced-colors.enabled");
}
// prefers-contrast is always enabled in the ua and chrome. On
// the web it is hidden behind a preference.
if *feature == atom!("prefers-contrast") {
return !context.chrome_rules_enabled() &&
!static_prefs::pref!("layout.css.prefers-contrast.enabled");
}
// prefers-reduced-transparency is always enabled in the ua and chrome. On
// the web it is hidden behind a preference (see Bug 1822176).
if *feature == atom!("prefers-reduced-transparency") {
@ -331,7 +317,7 @@ fn disabled_by_pref(feature: &Atom, context: &ParserContext) -> bool {
}
// inverted-colors is always enabled in the ua and chrome. On
// the web it is hidden behind a preferenc.
// the web it is hidden behind a preference.
if *feature == atom!("inverted-colors") {
return !context.chrome_rules_enabled() &&
!static_prefs::pref!("layout.css.inverted-colors.enabled");