Bug 1812629 - Remove more_color_4 pref r=emilio,layout-reviewers

Remove the pref that enables additional color-4 colors.

Differential Revision: https://phabricator.services.mozilla.com/D167957
This commit is contained in:
Tiaan Louw 2024-02-01 10:40:38 +00:00
parent e560d55576
commit dc70568658
3 changed files with 22 additions and 30 deletions

View File

@ -35,11 +35,23 @@ function testValues(values, expected) {
}
function do_test() {
var allColors = [ "COLOR", "currentColor", "transparent", "rgb", "rgba", "hsl", "hsla", "hwb", "color-mix"];
var allColors = [
"COLOR",
"currentColor",
"transparent",
"rgb",
"rgba",
"hsl",
"hsla",
"hwb",
"color-mix",
"color",
"lab",
"lch",
"oklab",
"oklch"
];
if (SpecialPowers.getBoolPref("layout.css.more_color_4.enabled", true)) {
allColors.push("color", "lab", "lch", "oklab", "oklch");
}
var allGradients = [
"linear-gradient",
"-webkit-linear-gradient",

View File

@ -8799,13 +8799,6 @@
value: true
mirror: always
# Enable experimental enhanced color CSS color spaces. (lab(), lch(), oklab(), oklch(), color())
- name: layout.css.more_color_4.enabled
type: RelaxedAtomicBool
value: true
mirror: always
rust: true
# The margin used for detecting relevancy for `content-visibility: auto`.
- name: layout.css.content-visibility-relevant-content-margin
type: float

View File

@ -8,7 +8,7 @@ use super::AllowQuirks;
use crate::color::parsing::{
self, AngleOrNumber, Color as CSSParserColor, FromParsedColor, NumberOrPercentage,
};
use crate::color::{mix::ColorInterpolationMethod, AbsoluteColor, ColorFlags, ColorSpace};
use crate::color::{mix::ColorInterpolationMethod, AbsoluteColor, ColorSpace};
use crate::media_queries::Device;
use crate::parser::{Parse, ParserContext};
use crate::values::computed::{Color as ComputedColor, Context, ToComputedValue};
@ -607,21 +607,6 @@ impl Color {
match input.try_parse(|i| parsing::parse_color_with(&color_parser, i)) {
Ok(mut color) => {
if let Color::Absolute(ref mut absolute) = color {
let enabled = {
let is_legacy_color = matches!(
absolute.color.color_space,
ColorSpace::Srgb | ColorSpace::Hsl
);
let is_color_function =
!absolute.color.flags.contains(ColorFlags::IS_LEGACY_SRGB);
let pref_enabled = static_prefs::pref!("layout.css.more_color_4.enabled");
(is_legacy_color && !is_color_function) || pref_enabled
};
if !enabled {
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
}
// Because we can't set the `authored` value at construction time, we have to set it
// here.
absolute.authored = authored.map(|s| s.to_ascii_lowercase().into_boxed_str());
@ -948,10 +933,12 @@ impl SpecifiedValueInfo for Color {
"currentColor",
"transparent",
"color-mix",
"color",
"lab",
"lch",
"oklab",
"oklch",
]);
if static_prefs::pref!("layout.css.more_color_4.enabled") {
f(&["color", "lab", "lch", "oklab", "oklch"]);
}
}
}