diff --git a/browser/base/content/test/static/browser_parsable_css.js b/browser/base/content/test/static/browser_parsable_css.js index ad4dc7e45263..be7edc76df63 100644 --- a/browser/base/content/test/static/browser_parsable_css.js +++ b/browser/base/content/test/static/browser_parsable_css.js @@ -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 diff --git a/browser/components/reportbrokensite/test/browser/browser_prefers_contrast.js b/browser/components/reportbrokensite/test/browser/browser_prefers_contrast.js index 68aeae911e9a..b184b514505c 100644 --- a/browser/components/reportbrokensite/test/browser/browser_prefers_contrast.js +++ b/browser/components/reportbrokensite/test/browser/browser_prefers_contrast.js @@ -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(); diff --git a/browser/components/reportbrokensite/test/browser/head.js b/browser/components/reportbrokensite/test/browser/head.js index 08b36f73f38d..59ce1d4d9afa 100644 --- a/browser/components/reportbrokensite/test/browser/head.js +++ b/browser/components/reportbrokensite/test/browser/head.js @@ -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", }; diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index d1faf046f84f..98e9dbb81d22 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -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")) { diff --git a/layout/reftests/high-contrast/reftest.list b/layout/reftests/high-contrast/reftest.list index 7fdc1787e75d..2a03b3652b90 100644 --- a/layout/reftests/high-contrast/reftest.list +++ b/layout/reftests/high-contrast/reftest.list @@ -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 diff --git a/layout/style/test/chrome/test_chrome_only_media_queries.html b/layout/style/test/chrome/test_chrome_only_media_queries.html index 1a2fb098c093..961f2c4c3dd7 100644 --- a/layout/style/test/chrome/test_chrome_only_media_queries.html +++ b/layout/style/test/chrome/test_chrome_only_media_queries.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(); diff --git a/layout/style/test/property_database.js b/layout/style/test/property_database.js index fa14a975bbba..af8e4d3f1d4f 100644 --- a/layout/style/test/property_database.js +++ b/layout/style/test/property_database.js @@ -13830,16 +13830,14 @@ gCSSProperties["math-style"] = { invalid_values: [], }; -if (IsCSSPropertyPrefEnabled("layout.css.forced-color-adjust.enabled")) { - gCSSProperties["forced-color-adjust"] = { - domProp: "forcedColorAdjust", - inherited: true, - type: CSS_TYPE_LONGHAND, - initial_values: ["auto"], - other_values: ["none"], - invalid_values: [], - }; -} +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"] = { diff --git a/layout/style/test/test_media_queries.html b/layout/style/test/test_media_queries.html index 441fc1105a14..032067eb231a 100644 --- a/layout/style/test/test_media_queries.html +++ b/layout/style/test/test_media_queries.html @@ -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)"); diff --git a/layout/style/test/test_mq_prefers_contrast_dynamic.html b/layout/style/test/test_mq_prefers_contrast_dynamic.html index c3ccebbe82c4..1a3bbd1c1912 100644 --- a/layout/style/test/test_mq_prefers_contrast_dynamic.html +++ b/layout/style/test/test_mq_prefers_contrast_dynamic.html @@ -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 ? diff --git a/modules/libpref/init/StaticPrefList.yaml b/modules/libpref/init/StaticPrefList.yaml index 5dc00244d4cb..8a9120fe435a 100644 --- a/modules/libpref/init/StaticPrefList.yaml +++ b/modules/libpref/init/StaticPrefList.yaml @@ -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 diff --git a/servo/components/style/gecko/media_features.rs b/servo/components/style/gecko/media_features.rs index ff6a291b7360..26c19be6e915 100644 --- a/servo/components/style/gecko/media_features.rs +++ b/servo/components/style/gecko/media_features.rs @@ -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!( diff --git a/servo/components/style/properties/longhands/inherited_text.mako.rs b/servo/components/style/properties/longhands/inherited_text.mako.rs index 17b2fbe2e0b0..47d0cac5bd5d 100644 --- a/servo/components/style/properties/longhands/inherited_text.mako.rs +++ b/servo/components/style/properties/longhands/inherited_text.mako.rs @@ -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", diff --git a/servo/components/style/queries/feature_expression.rs b/servo/components/style/queries/feature_expression.rs index 33e104c4844e..f948e40d69b1 100644 --- a/servo/components/style/queries/feature_expression.rs +++ b/servo/components/style/queries/feature_expression.rs @@ -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");