Skip to content

Truly independent web browser

LibWeb: Keep missing components of rgb(), hsl() and hwb() colors

Andreas Klingb00867282e86
diff --git a/Libraries/LibWeb/CSS/CSSStyleProperties.cpp b/Libraries/LibWeb/CSS/CSSStyleProperties.cpp
index 0bbc5809863..064f75881d1 100644
--- a/Libraries/LibWeb/CSS/CSSStyleProperties.cpp
+++ b/Libraries/LibWeb/CSS/CSSStyleProperties.cpp
@@ -1016,6 +1016,10 @@ static RefPtr<StyleValue const> resolve_color_style_value(StyleValue const& styl
if (style_value.is_color_function() && as<ColorFunctionStyleValue>(style_value).serializes_as_color_function())
return style_value;
+ // https://drafts.csswg.org/css-color-4/#css-serialization-of-srgb
+ // NB: An sRGB value with missing components serializes them as none, which the used color cannot represent.
+ if (style_value.is_color_function() && StyleValueFFI::rust_color_function_has_missing_component(style_value.rust_style_value_data()))
+ return style_value;
if (style_value.is_color()) {
auto& color_style_value = static_cast<ColorStyleValue const&>(style_value);
if (auto color_type = color_style_value.color_type();
diff --git a/Libraries/LibWeb/Rust/src/css/absolutize.rs b/Libraries/LibWeb/Rust/src/css/absolutize.rs
index 2c3a4f4bbcb..431d8df22ce 100644
--- a/Libraries/LibWeb/Rust/src/css/absolutize.rs
+++ b/Libraries/LibWeb/Rust/src/css/absolutize.rs
@@ -215,10 +215,11 @@ use crate::css::color_resolution::{
resolve_relative_form, resolve_with_reference_value, to_color,
};
use crate::css::css_enums::keyword;
+use crate::css::serialize::color_function_has_missing_component;
use crate::css::style_compute::{FfiLengthResolutionContext, absolutize_length, keyword_is_color};
use crate::css::style_value::{
BasicShapeData, ColorBase, CssString, OwnedBasicShapeData, RetainedGridTrackEntryList, RetainedStyleValueData,
- RetainedStyleValueDataList, StyleValueData, value_depends_on_current_color,
+ RetainedStyleValueDataList, StyleValueData, is_none_keyword, value_depends_on_current_color,
};
use crate::css::value_codes::*;
@@ -523,6 +524,66 @@ fn hwb_to_absolutized_rgb(
)
}
+/// The computed form of an absolute rgb(), hsl() or hwb() function with missing components: the same
+/// function with every present component resolved to a number (hues in degrees, other hsl() and hwb()
+/// components in percent, rgb() components from 0 to 255) and alpha clamped to [0, 1].
+fn resolved_srgb_function_with_missing_components(value: &StyleValueData) -> Option<StyleValueData> {
+ let StyleValueData::ColorFunction {
+ color_base,
+ channel_0,
+ channel_1,
+ channel_2,
+ alpha,
+ ..
+ } = value
+ else {
+ return None;
+ };
+ let descriptor = descriptor_for_color_type(color_base.color_type);
+ let resolve_channel = |channel: &RetainedStyleValueData, index: usize| -> Option<RetainedStyleValueData> {
+ let value = channel.data();
+ if is_none_keyword(value) {
+ return Some(channel.clone_retained());
+ }
+ let channel_descriptor = &descriptor.channels[index];
+ let mut resolved = if channel_descriptor.is_hue {
+ resolve_hue(value, &EMPTY_INPUT)?
+ } else {
+ resolve_with_reference_value(value, f64::from(channel_descriptor.percent_reference), &EMPTY_INPUT)?
+ };
+ if color_base.color_type == crate::css::color_conversion::RGB {
+ resolved = resolved.clamp(0.0, 255.0);
+ }
+ // https://drafts.csswg.org/css-color-4/#the-hsl-notation
+ // For historical reasons, if the saturation is less than 0% it is clamped to 0% at parsed-value time,
+ // before being converted to an sRGB color.
+ if color_base.color_type == crate::css::color_conversion::HSL && index == 1 {
+ resolved = resolved.max(0.0);
+ }
+ Some(retain_new(StyleValueData::Number { value: resolved }))
+ };
+ let alpha = match alpha.optional_data() {
+ None => retained_null(),
+ Some(value) if is_none_keyword(value) => alpha.clone_retained(),
+ Some(value) => retain_new(StyleValueData::Number {
+ value: resolve_alpha(value, &EMPTY_INPUT)?,
+ }),
+ };
+ Some(StyleValueData::ColorFunction {
+ color_base: ColorBase {
+ color_syntax: COLOR_SYNTAX_MODERN,
+ ..*color_base
+ },
+ channel_0: resolve_channel(channel_0, 0)?,
+ channel_1: resolve_channel(channel_1, 1)?,
+ channel_2: resolve_channel(channel_2, 2)?,
+ alpha,
+ has_name: false,
+ name: CssString::none(),
+ origin_color: retained_null(),
+ })
+}
+
/// Port of ColorFunctionStyleValue::absolutized: relative forms recurse their channels, alpha
/// and origin; HSL and HWB resolve and convert to a legacy rgb() form; every other color
/// function recurses its channels and alpha.
@@ -569,6 +630,40 @@ fn absolutize_color_function(value: &StyleValueData, context: &AbsolutizationCon
}
let descriptor = descriptor_for_color_type(color_base.color_type);
+ let rebuilt = StyleValueData::ColorFunction {
+ color_base: *color_base,
+ channel_0: absolutized_c1,
+ channel_1: absolutized_c2,
+ channel_2: absolutized_c3,
+ alpha: absolutized_alpha,
+ has_name: *has_name,
+ name: name.clone(),
+ origin_color: retained_null(),
+ };
+
+ // https://drafts.csswg.org/css-color-4/#css-serialization-of-srgb
+ // An sRGB value with missing components keeps its color function, so that those components serialize as
+ // the none keyword.
+ if matches!(
+ color_base.color_type,
+ crate::css::color_conversion::RGB | crate::css::color_conversion::HSL | crate::css::color_conversion::HWB
+ ) && color_function_has_missing_component(&rebuilt)
+ {
+ return Some(Absolutized::Changed(retain_new(
+ resolved_srgb_function_with_missing_components(&rebuilt)?,
+ )));
+ }
+ let StyleValueData::ColorFunction {
+ channel_0: absolutized_c1,
+ channel_1: absolutized_c2,
+ channel_2: absolutized_c3,
+ alpha: absolutized_alpha,
+ ..
+ } = &rebuilt
+ else {
+ unreachable!();
+ };
+
if descriptor.absolutizes_to_rgb {
// https://drafts.csswg.org/css-color-4/#resolving-sRGB-values
let c1 = if descriptor.channels[0].is_hue {
@@ -603,17 +698,6 @@ fn absolutize_color_function(value: &StyleValueData, context: &AbsolutizationCon
return Some(Absolutized::Changed(retain_new(canonical)));
}
- let rebuilt = StyleValueData::ColorFunction {
- color_base: *color_base,
- channel_0: absolutized_c1,
- channel_1: absolutized_c2,
- channel_2: absolutized_c3,
- alpha: absolutized_alpha,
- has_name: *has_name,
- name: name.clone(),
- origin_color: retained_null(),
- };
-
if color_base.color_type == crate::css::color_conversion::RGB
&& let Some(canonical) = canonical_legacy_rgb(&rebuilt)
{
diff --git a/Libraries/LibWeb/Rust/src/css/color_interpolation.rs b/Libraries/LibWeb/Rust/src/css/color_interpolation.rs
index 80adda0976a..02fdeb0d8ca 100644
--- a/Libraries/LibWeb/Rust/src/css/color_interpolation.rs
+++ b/Libraries/LibWeb/Rust/src/css/color_interpolation.rs
@@ -237,6 +237,22 @@ fn retained_component(value: f32, missing: bool) -> RetainedStyleValueData {
fn make_result(color_type: u8, components: [f32; 4], missing: [bool; 4]) -> StyleValueData {
let (color_type, components, missing) = match color_type {
+ // https://drafts.csswg.org/css-color-5/#serial-color-mix
+ // However, if the result of mixing in the hsl or hwb color space has at least one missing color
+ // component (including a missing alpha carried forward per [[css-color-4#interpolation-missing]]), the
+ // form used is the modern hsl(h s l / a) or hwb(h w b / a) syntax respectively, preserving the original
+ // color function and each none value per [[css-color-4#css-serialization-of-srgb]], rather than
+ // degrading to color(srgb r g b) (which would lose the hsl/hwb identity).
+ color_conversion::HSL | color_conversion::HWB if missing.contains(&true) => (
+ color_type,
+ [
+ components[0],
+ components[1] * 100.0,
+ components[2] * 100.0,
+ components[3],
+ ],
+ missing,
+ ),
color_conversion::HSL | color_conversion::HWB => (
color_conversion::SRGB,
color_conversion::legacy_color_to_srgb(color_type, components).unwrap(),
diff --git a/Libraries/LibWeb/Rust/src/css/color_resolution.rs b/Libraries/LibWeb/Rust/src/css/color_resolution.rs
index ca66a793b39..acb1959f40c 100644
--- a/Libraries/LibWeb/Rust/src/css/color_resolution.rs
+++ b/Libraries/LibWeb/Rust/src/css/color_resolution.rs
@@ -1322,6 +1322,15 @@ fn computed_value_form(value: StyleValueData) -> StyleValueData {
if !matches!(color_type, ct::RGB | ct::HSL | ct::HWB) {
return value;
}
+ // https://drafts.csswg.org/css-color-5/#serial-relative-color
+ // However, if the resolved value of an hsl() or hwb() relative color has at least one missing color
+ // component (including a missing alpha carried forward from the origin color per
+ // [[css-color-4#interpolation-missing]]), the form used is the modern hsl(h s l / a) or hwb(h w b / a)
+ // syntax respectively, preserving the original color function and each none value, rather than
+ // degrading to color(srgb r g b) (which would lose the hsl/hwb identity).
+ if color_type != ct::RGB && crate::css::serialize::color_function_has_missing_component(&value) {
+ return value;
+ }
let number = |channel: &RetainedStyleValueData| match channel.optional_data() {
Some(StyleValueData::Number { value }) => Some(*value),
_ => None,
@@ -1417,6 +1426,16 @@ pub unsafe extern "C" fn rust_color_mix_resolved_value(
}
}
+/// Whether a color function value has a missing color component, which its resolved value keeps.
+///
+/// # Safety
+/// `value` must point at live style value data.
+#[unsafe(no_mangle)]
+pub unsafe extern "C" fn rust_color_function_has_missing_component(value: *const core::ffi::c_void) -> bool {
+ let value = unsafe { &*value.cast::<StyleValueData>() };
+ crate::css::serialize::color_function_has_missing_component(value)
+}
+
/// Port of ColorStyleValue::extract_channels_in_color_space().
///
/// NB: The C++ code computes linear sRGB with the direct transfer function; that function is
diff --git a/Libraries/LibWeb/Rust/src/css/serialize.rs b/Libraries/LibWeb/Rust/src/css/serialize.rs
index da3331c2a97..75a868ac0b5 100644
--- a/Libraries/LibWeb/Rust/src/css/serialize.rs
+++ b/Libraries/LibWeb/Rust/src/css/serialize.rs
@@ -2058,6 +2058,19 @@ pub(crate) fn serialize_style_value(sink: &mut TextSink, value: &StyleValueData,
descriptor.behavior,
SerializationBehavior::SrgbLegacy | SerializationBehavior::SrgbModern
) {
+ // https://drafts.csswg.org/css-color-4/#css-serialization-of-srgb
+ // However, the legacy color syntax with comma separators cannot represent none. If the value has
+ // at least one missing color component, the serialization form is chosen to preserve those
+ // components as the none keyword, based on the color function of the declared value.
+ if color_function_has_missing_component(value) {
+ return serialize_srgb_value_with_missing_components(
+ sink,
+ color_base.color_type,
+ &channels,
+ alpha,
+ mode,
+ );
+ }
if !mode.is_resolved() && *has_name {
with_fly_string_units(name, |units| push_units_ascii_lowercased(sink, &units));
return;
@@ -2527,6 +2540,131 @@ fn alpha_should_be_serialized(alpha: &StyleValueData) -> bool {
}
}
+/// Whether a color function has a missing color component, including a missing alpha.
+// https://drafts.csswg.org/css-color-4/#missing
+pub(crate) fn color_function_has_missing_component(value: &StyleValueData) -> bool {
+ use crate::css::style_value::is_none_keyword;
+ let StyleValueData::ColorFunction {
+ channel_0,
+ channel_1,
+ channel_2,
+ alpha,
+ ..
+ } = value
+ else {
+ return false;
+ };
+ [channel_0, channel_1, channel_2, alpha]
+ .iter()
+ .any(|component| component.optional_data().is_some_and(is_none_keyword))
+}
+
+/// Serializes an rgb(), hsl() or hwb() value that has at least one missing color component.
+// https://drafts.csswg.org/css-color-4/#css-serialization-of-srgb
+fn serialize_srgb_value_with_missing_components(
+ sink: &mut TextSink,
+ color_type: u8,
+ channels: &[&crate::css::style_value::RetainedStyleValueData; 3],
+ alpha: &crate::css::style_value::RetainedStyleValueData,
+ mode: SerializationMode,
+) {
+ use crate::css::color_conversion;
+ use crate::css::color_resolution::{EMPTY_INPUT, resolve_with_reference_value};
+ use crate::css::style_value::is_none_keyword;
+
+ // A component that resolves to a number is clamped to `range`, then serialized as that number divided by
+ // `divisor`, followed by `suffix`. A component that does not resolve is divided by `divisor` inside a calc()
+ // instead. Any missing component is serialized as the none keyword.
+ let serialize_component = |sink: &mut TextSink,
+ value: &StyleValueData,
+ one_hundred_percent: f64,
+ range: (f64, f64),
+ divisor: f64,
+ suffix: &str| {
+ if is_none_keyword(value) {
+ sink.push_ascii("none");
+ return;
+ }
+ match resolve_with_reference_value(value, one_hundred_percent, &EMPTY_INPUT) {
+ Some(resolved) => {
+ serialize_a_number(sink, resolved.clamp(range.0, range.1) / divisor, mode);
+ sink.push_ascii(suffix);
+ }
+ None if divisor == 1.0 => serialize_style_value(sink, value, mode),
+ None => {
+ sink.push_ascii("calc(");
+ serialize_style_value(sink, value, mode);
+ sink.push_ascii(" / ");
+ serialize_a_number(sink, divisor, mode);
+ sink.push_ascii(")");
+ }
+ }
+ };
+ let serialize_alpha = |sink: &mut TextSink| {
+ // The alpha is included only if non-unity or missing.
+ if let Some(alpha) = alpha.optional_data()
+ && alpha_should_be_serialized(alpha)
+ {
+ sink.push_ascii(" / ");
+ serialize_alpha_component(sink, alpha, mode);
+ }
+ };
+
+ if color_type == color_conversion::RGB {
+ // For rgb() and rgba() values, the value is serialized as a color() function in the srgb color space
+ // rather than as the modern space-separated form of rgb(), even though that form would also accept
+ // none: "color(srgb" followed by a single space, followed by a space-separated list of the three
+ // non-alpha components serialized as <number>s in the [0, 1] reference range (or as none if missing),
+ // followed (only if the alpha is non-unity or missing) by " / " and the alpha component (serialized
+ // per the alpha rules, or as none if missing), followed by ")".
+ sink.push_ascii("color(srgb ");
+ for (index, channel) in channels.iter().enumerate() {
+ if index > 0 {
+ sink.push_ascii(" ");
+ }
+ // https://drafts.csswg.org/css-color-4/#rgb-functions
+ // Values outside these ranges are not invalid, but are clamped to the ranges defined here at
+ // parsed-value time.
+ serialize_component(sink, channel.data(), 255.0, (0.0, 255.0), 255.0, "");
+ }
+ serialize_alpha(sink);
+ sink.push_ascii(")");
+ return;
+ }
+
+ // For hsl() and hsla() values, the value is serialized using the modern (whitespace-separated) hsl()
+ // syntax, with a slash before the alpha component when present. The function name is "hsl" (in ASCII
+ // lowercase) regardless of whether the value was authored using the hsla() alias. The hue is serialized
+ // as a canonicalized <number> in degrees, the saturation and lightness as <percentage>s, and the alpha
+ // (included only if non-unity or missing) per the alpha rules; any missing component is serialized as the
+ // none keyword.
+ // For hwb() values, the value is serialized using the modern (whitespace-separated) hwb() syntax, with a
+ // slash before the alpha component when present. The function name is "hwb" in ASCII lowercase. The hue
+ // is serialized as a canonicalized <number> in degrees, the whiteness and blackness as <percentage>s, and
+ // the alpha (included only if non-unity or missing) per the alpha rules; any missing component is
+ // serialized as the none keyword.
+ sink.push_ascii(if color_type == color_conversion::HSL {
+ "hsl("
+ } else {
+ "hwb("
+ });
+ serialize_hue_component(sink, channels[0].data(), mode);
+ for (index, channel) in channels.iter().enumerate().skip(1) {
+ sink.push_ascii(" ");
+ // https://drafts.csswg.org/css-color-4/#the-hsl-notation
+ // For historical reasons, if the saturation is less than 0% it is clamped to 0% at parsed-value time,
+ // before being converted to an sRGB color.
+ let range = if color_type == color_conversion::HSL && index == 1 {
+ (0.0, f64::INFINITY)
+ } else {
+ (f64::NEG_INFINITY, f64::INFINITY)
+ };
+ serialize_component(sink, channel.data(), 100.0, range, 1.0, "%");
+ }
+ serialize_alpha(sink);
+ sink.push_ascii(")");
+}
+
/// Port of ColorStyleValue::serialize_color_component.
fn serialize_color_component(
sink: &mut TextSink,
diff --git a/Tests/LibWeb/Text/expected/css/color-missing-components-clamping.txt b/Tests/LibWeb/Text/expected/css/color-missing-components-clamping.txt
new file mode 100644
index 00000000000..c24306b6cde
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/css/color-missing-components-clamping.txt
@@ -0,0 +1,6 @@
+rgb(none 300 0): specified color(srgb none 1 0), computed color(srgb none 1 0)
+rgb(none -10 0): specified color(srgb none 0 0), computed color(srgb none 0 0)
+rgb(none 10% 200%): specified color(srgb none 0.1 1), computed color(srgb none 0.1 1)
+hsl(none -10% 50%): specified hsl(none 0% 50%), computed hsl(none 0% 50%)
+hsl(120 -10% none): specified hsl(120 0% none), computed hsl(120 0% none)
+rgb(none calc(255 * sign(1em - 10px)) 0): specified color(srgb none calc(calc(255 * sign(1em - 10px)) / 255) 0), computed color(srgb none 1 0)
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-color-mix-function.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-color-mix-function.txt
index 6b041403905..d8525ab50df 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-color-mix-function.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-color-mix-function.txt
@@ -2,8 +2,7 @@ Harness status: OK
Found 974 tests
-966 Pass
-8 Fail
+974 Pass
Pass Property color value 'color-mix(in hsl, hsl(120deg 10% 20%), hsl(30deg 30% 40%))'
Pass Property color value 'color-mix(in hsl, hsl(120deg 10% 20%) 25%, hsl(30deg 30% 40%))'
Pass Property color value 'color-mix(in hsl, 25% hsl(120deg 10% 20%), hsl(30deg 30% 40%))'
@@ -74,7 +73,7 @@ Pass Property color value 'color-mix(in hsl decreasing hue, hsl(60deg 50% 50%),
Pass Property color value 'color-mix(in hsl decreasing hue, red, white)'
Pass Property color value 'color-mix(in hsl decreasing hue, red, black)'
Pass Property color value 'color-mix(in hsl decreasing hue, red, transparent)'
-Fail Property color value 'color-mix(in hsl, hsl(none none none), hsl(none none none))'
+Pass Property color value 'color-mix(in hsl, hsl(none none none), hsl(none none none))'
Pass Property color value 'color-mix(in hsl, hsl(none none none), hsl(30deg 40% 80%))'
Pass Property color value 'color-mix(in hsl, hsl(120deg 20% 40%), hsl(none none none))'
Pass Property color value 'color-mix(in hsl, hsl(120deg 20% none), hsl(30deg 40% 60%))'
@@ -82,7 +81,7 @@ Pass Property color value 'color-mix(in hsl, hsl(120deg 20% 40%), hsl(30deg 20%
Pass Property color value 'color-mix(in hsl, hsl(none 20% 40%), hsl(30deg none 80%))'
Pass Property color value 'color-mix(in hsl, hsl(120deg 40% 40% / none), hsl(0deg 40% 40%))'
Pass Property color value 'color-mix(in hsl, hsl(120deg 40% 40% / none), hsl(0deg 40% 40% / 0.5))'
-Fail Property color value 'color-mix(in hsl, hsl(120deg 40% 40% / none), hsl(0deg 40% 40% / none))'
+Pass Property color value 'color-mix(in hsl, hsl(120deg 40% 40% / none), hsl(0deg 40% 40% / none))'
Pass Property color value 'color-mix(in hsl, hsl(30deg 40% 80% / 25%) 0%, hsl(90deg none none / none))'
Pass Property color value 'color-mix(in hsl, hsl(30deg 40% 80% / 25%) 0%, hsl(none 50% none / none))'
Pass Property color value 'color-mix(in hsl, hsl(30deg 40% 80% / 25%) 0%, hsl(none none 50% / none))'
@@ -158,7 +157,7 @@ Pass Property color value 'color-mix(in hwb decreasing hue, hwb(320deg 30% 40%),
Pass Property color value 'color-mix(in hwb decreasing hue, red, white)'
Pass Property color value 'color-mix(in hwb decreasing hue, red, black)'
Pass Property color value 'color-mix(in hwb decreasing hue, red, transparent)'
-Fail Property color value 'color-mix(in hwb, hwb(none none none), hwb(none none none))'
+Pass Property color value 'color-mix(in hwb, hwb(none none none), hwb(none none none))'
Pass Property color value 'color-mix(in hwb, hwb(none none none), hwb(30deg 30% 40%))'
Pass Property color value 'color-mix(in hwb, hwb(120deg 10% 20%), hwb(none none none))'
Pass Property color value 'color-mix(in hwb, hwb(120deg 10% none), hwb(30deg 30% 40%))'
@@ -166,7 +165,7 @@ Pass Property color value 'color-mix(in hwb, hwb(120deg 10% 20%), hwb(30deg 30%
Pass Property color value 'color-mix(in hwb, hwb(none 10% 20%), hwb(30deg none 40%))'
Pass Property color value 'color-mix(in hwb, hwb(120deg 10% 20% / none), hwb(30deg 30% 40%))'
Pass Property color value 'color-mix(in hwb, hwb(120deg 10% 20% / none), hwb(30deg 30% 40% / 0.5))'
-Fail Property color value 'color-mix(in hwb, hwb(120deg 10% 20% / none), hwb(30deg 30% 40% / none))'
+Pass Property color value 'color-mix(in hwb, hwb(120deg 10% 20% / none), hwb(30deg 30% 40% / none))'
Pass Property color value 'color-mix(in hwb, hwb(30deg 30% 40% / 25%) 0%, hwb(90deg none none / none))'
Pass Property color value 'color-mix(in hwb, hwb(30deg 30% 40% / 25%) 0%, hwb(none 50% none / none))'
Pass Property color value 'color-mix(in hwb, hwb(30deg 30% 40% / 25%) 0%, hwb(none none 50% / none))'
@@ -962,12 +961,12 @@ Pass Property color value 'color-mix(in oklch, lch(100% 0 0), blue)'
Pass Property color value 'color-mix(in oklch, oklch(100% 0 0), blue)'
Pass Property color value 'color-mix(in oklch, oklab(0.1 none none), oklch(0.3 0.2 90deg))'
Pass Property color value 'color-mix(in oklab, oklch(0.1 none none), oklab(0.3 0.2 0.4))'
-Fail Property color value 'color-mix(in hsl, hwb(none none none), hsl(none 0.2 0.4))'
-Fail Property color value 'color-mix(in hwb, hsl(none none none), hwb(none 0.2 0.4))'
+Pass Property color value 'color-mix(in hsl, hwb(none none none), hsl(none 0.2 0.4))'
+Pass Property color value 'color-mix(in hwb, hsl(none none none), hwb(none 0.2 0.4))'
Pass Property color value 'color-mix(in oklch, oklab(0.1 none 0.3), oklch(0.3 0.2 0deg))'
Pass Property color value 'color-mix(in oklab, oklch(0.1 0.3 none), oklab(0.3 0.2 0.4))'
-Fail Property color value 'color-mix(in hsl, hwb(none 40% none), hsl(none 0.2 0.4))'
-Fail Property color value 'color-mix(in hwb, hsl(none none 20%), hwb(none 0.2 0.4))'
+Pass Property color value 'color-mix(in hsl, hwb(none 40% none), hsl(none 0.2 0.4))'
+Pass Property color value 'color-mix(in hwb, hsl(none none 20%), hwb(none 0.2 0.4))'
Pass Property color value 'color-mix(in srgb, red)'
Pass Property color value 'color-mix(in srgb, red 50%)'
Pass Property color value 'color-mix(in srgb, red, green, blue)'
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-hsl.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-hsl.txt
index 983c29a0971..b7552876cff 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-hsl.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-hsl.txt
@@ -2,29 +2,28 @@ Harness status: OK
Found 3753 tests
-3744 Pass
-9 Fail
+3753 Pass
Pass Property color value 'hsl(120 30% 50%)'
Pass Property color value 'hsl(120 30% 50% / 0.5)'
Pass Property color value 'hsl(120 30% 50% / 50%)'
-Fail Property color value 'hsl(none none none)'
+Pass Property color value 'hsl(none none none)'
Pass Property color value 'hsl(0 0% 0%)'
-Fail Property color value 'hsl(none none none / none)'
+Pass Property color value 'hsl(none none none / none)'
Pass Property color value 'hsl(0 0% 0% / 0)'
-Fail Property color value 'hsla(none none none)'
+Pass Property color value 'hsla(none none none)'
Pass Property color value 'hsla(0 0% 0%)'
-Fail Property color value 'hsla(none none none / none)'
+Pass Property color value 'hsla(none none none / none)'
Pass Property color value 'hsla(0 0% 0% / 0)'
-Fail Property color value 'hsl(120 none none)'
+Pass Property color value 'hsl(120 none none)'
Pass Property color value 'hsl(120 0% 0%)'
-Fail Property color value 'hsl(120 80% none)'
+Pass Property color value 'hsl(120 80% none)'
Pass Property color value 'hsl(120 80% 0%)'
-Fail Property color value 'hsl(120 none 50%)'
+Pass Property color value 'hsl(120 none 50%)'
Pass Property color value 'hsl(120 0% 50%)'
-Fail Property color value 'hsl(120 100% 50% / none)'
+Pass Property color value 'hsl(120 100% 50% / none)'
Pass Property color value 'hsl(120 100% 50% / 0)'
Pass Property color value 'hsl(120 100% 50% / 0%)'
-Fail Property color value 'hsl(none 100% 50%)'
+Pass Property color value 'hsl(none 100% 50%)'
Pass Property color value 'hsl(0 100% 50%)'
Pass Property color value 'HSL(0, 0%, 0%)' [Capitalization should not affect parsing]
Pass Property color value 'hsL(0, 100%, 50%)' [Capitalization should not affect parsing]
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-hwb.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-hwb.txt
index a17cd795df0..37ad822701c 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-hwb.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-hwb.txt
@@ -2,8 +2,8 @@ Harness status: OK
Found 70 tests
-58 Pass
-12 Fail
+65 Pass
+5 Fail
Pass Property color value 'hwb(120 30% 50%)'
Pass Property color value 'hwb(120 60% 60%)'
Pass Property color value 'hwb(0 60% 60%)'
@@ -11,22 +11,22 @@ Pass Property color value 'hwb(0 100% 0%)'
Pass Property color value 'hwb(0 0% 100%)'
Pass Property color value 'hwb(120 30% 50% / 0.5)'
Pass Property color value 'hwb(120 30% 50% / 50%)'
-Fail Property color value 'hwb(none none none)'
+Pass Property color value 'hwb(none none none)'
Pass Property color value 'hwb(0 0% 0%)'
-Fail Property color value 'hwb(none none none / none)'
+Pass Property color value 'hwb(none none none / none)'
Pass Property color value 'hwb(0 0% 0% / 0)'
-Fail Property color value 'hwb(120 none none)'
+Pass Property color value 'hwb(120 none none)'
Pass Property color value 'hwb(120 0% 0%)'
-Fail Property color value 'hwb(120 80% none)'
+Pass Property color value 'hwb(120 80% none)'
Pass Property color value 'hwb(120 80% 0%)'
-Fail Property color value 'hwb(120 none 50%)'
+Pass Property color value 'hwb(120 none 50%)'
Pass Property color value 'hwb(120 0% 50%)'
Pass Property color value 'hwb(150 20% 10%)'
Pass Property color value 'hwb(45 40% 80%)'
-Fail Property color value 'hwb(120 30% 50% / none)'
+Pass Property color value 'hwb(120 30% 50% / none)'
Pass Property color value 'hwb(120 30% 50% / 0)'
Pass Property color value 'hwb(120 30% 50% / 0%)'
-Fail Property color value 'hwb(none 100% 50% / none)'
+Pass Property color value 'hwb(none 100% 50% / none)'
Pass Property color value 'hwb(0 100% 50% / 0)'
Pass Property color value 'hwb(0 100% 100%)'
Pass Property color value 'hwb(0 70% 60%)'
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-none.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-none.txt
index e8d400dfc35..432bd230615 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-none.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-none.txt
@@ -2,8 +2,8 @@ Harness status: OK
Found 678 tests
-408 Pass
-270 Fail
+479 Pass
+199 Fail
Fail Property color value 'hsl(from hsl(none 50% 50%) h s l)'
Fail Property color value 'hsl(from hsl(180 none 50%) h s l)'
Fail Property color value 'hsl(from hsl(180 50% none) h s l)'
@@ -92,50 +92,50 @@ Pass Property color value 'color-mix(in hsl, oklab(none 0.1 none), hsl(11 33 44)
Pass Property color value 'color-mix(in hsl, oklab(none none none), hsl(11 33 44))'
Pass Property color value 'color-mix(in hsl, rgb(none none none), hsl(11 33 44))'
Pass Property color value 'color-mix(in hsl, color(display-p3 none none none), hsl(11 33 44))'
-Fail Property color value 'color-mix(in hsl, hsl(none 50% 50%))'
-Fail Property color value 'color-mix(in hsl, hsl(180 none 50%))'
-Fail Property color value 'color-mix(in hsl, hsl(180 50% none))'
-Fail Property color value 'color-mix(in hsl, hsl(none none 50%))'
-Fail Property color value 'color-mix(in hsl, hsl(180 none none))'
-Fail Property color value 'color-mix(in hsl, hsl(none 50% none))'
-Fail Property color value 'color-mix(in hsl, hsl(none none none))'
-Fail Property color value 'color-mix(in hsl, hwb(none 25% 25%))'
+Pass Property color value 'color-mix(in hsl, hsl(none 50% 50%))'
+Pass Property color value 'color-mix(in hsl, hsl(180 none 50%))'
+Pass Property color value 'color-mix(in hsl, hsl(180 50% none))'
+Pass Property color value 'color-mix(in hsl, hsl(none none 50%))'
+Pass Property color value 'color-mix(in hsl, hsl(180 none none))'
+Pass Property color value 'color-mix(in hsl, hsl(none 50% none))'
+Pass Property color value 'color-mix(in hsl, hsl(none none none))'
+Pass Property color value 'color-mix(in hsl, hwb(none 25% 25%))'
Fail Property color value 'color-mix(in hsl, hwb(180 none 25%))'
Pass Property color value 'color-mix(in hsl, hwb(180 25% none))'
-Fail Property color value 'color-mix(in hsl, hwb(none none 25%))'
-Fail Property color value 'color-mix(in hsl, hwb(180 none none))'
-Fail Property color value 'color-mix(in hsl, hwb(none 25% none))'
-Fail Property color value 'color-mix(in hsl, hwb(none none none))'
-Fail Property color value 'color-mix(in hsl, lch(none 20 180))'
-Fail Property color value 'color-mix(in hsl, lch(20 none 180))'
-Fail Property color value 'color-mix(in hsl, lch(20 20 none))'
-Fail Property color value 'color-mix(in hsl, lch(none none 180))'
-Fail Property color value 'color-mix(in hsl, lch(20 none none))'
-Fail Property color value 'color-mix(in hsl, lch(none 20 none))'
-Fail Property color value 'color-mix(in hsl, lch(none none none))'
-Fail Property color value 'color-mix(in hsl, oklch(none 0.2 180))'
-Fail Property color value 'color-mix(in hsl, oklch(0.2 none 180))'
-Fail Property color value 'color-mix(in hsl, oklch(0.2 0.2 none))'
-Fail Property color value 'color-mix(in hsl, oklch(none none 180))'
-Fail Property color value 'color-mix(in hsl, oklch(0.2 none none))'
-Fail Property color value 'color-mix(in hsl, oklch(none 0.2 none))'
-Fail Property color value 'color-mix(in hsl, oklch(none none none))'
-Fail Property color value 'color-mix(in hsl, lab(none 10 10))'
+Pass Property color value 'color-mix(in hsl, hwb(none none 25%))'
+Pass Property color value 'color-mix(in hsl, hwb(180 none none))'
+Pass Property color value 'color-mix(in hsl, hwb(none 25% none))'
+Pass Property color value 'color-mix(in hsl, hwb(none none none))'
+Pass Property color value 'color-mix(in hsl, lch(none 20 180))'
+Pass Property color value 'color-mix(in hsl, lch(20 none 180))'
+Pass Property color value 'color-mix(in hsl, lch(20 20 none))'
+Pass Property color value 'color-mix(in hsl, lch(none none 180))'
+Pass Property color value 'color-mix(in hsl, lch(20 none none))'
+Pass Property color value 'color-mix(in hsl, lch(none 20 none))'
+Pass Property color value 'color-mix(in hsl, lch(none none none))'
+Pass Property color value 'color-mix(in hsl, oklch(none 0.2 180))'
+Pass Property color value 'color-mix(in hsl, oklch(0.2 none 180))'
+Pass Property color value 'color-mix(in hsl, oklch(0.2 0.2 none))'
+Pass Property color value 'color-mix(in hsl, oklch(none none 180))'
+Pass Property color value 'color-mix(in hsl, oklch(0.2 none none))'
+Pass Property color value 'color-mix(in hsl, oklch(none 0.2 none))'
+Pass Property color value 'color-mix(in hsl, oklch(none none none))'
+Pass Property color value 'color-mix(in hsl, lab(none 10 10))'
Pass Property color value 'color-mix(in hsl, lab(50 none 10))'
Pass Property color value 'color-mix(in hsl, lab(50 10 none))'
-Fail Property color value 'color-mix(in hsl, lab(none none 10))'
-Fail Property color value 'color-mix(in hsl, lab(50 none none))'
-Fail Property color value 'color-mix(in hsl, lab(none 10 none))'
-Fail Property color value 'color-mix(in hsl, lab(none none none))'
-Fail Property color value 'color-mix(in hsl, oklab(none 0.1 0.1))'
+Pass Property color value 'color-mix(in hsl, lab(none none 10))'
+Pass Property color value 'color-mix(in hsl, lab(50 none none))'
+Pass Property color value 'color-mix(in hsl, lab(none 10 none))'
+Pass Property color value 'color-mix(in hsl, lab(none none none))'
+Pass Property color value 'color-mix(in hsl, oklab(none 0.1 0.1))'
Pass Property color value 'color-mix(in hsl, oklab(0.5 none 0.1))'
Pass Property color value 'color-mix(in hsl, oklab(0.5 0.1 none))'
-Fail Property color value 'color-mix(in hsl, oklab(none none 0.1))'
-Fail Property color value 'color-mix(in hsl, oklab(0.5 none none))'
-Fail Property color value 'color-mix(in hsl, oklab(none 0.1 none))'
-Fail Property color value 'color-mix(in hsl, oklab(none none none))'
-Fail Property color value 'color-mix(in hsl, rgb(none none none))'
-Fail Property color value 'color-mix(in hsl, color(display-p3 none none none))'
+Pass Property color value 'color-mix(in hsl, oklab(none none 0.1))'
+Pass Property color value 'color-mix(in hsl, oklab(0.5 none none))'
+Pass Property color value 'color-mix(in hsl, oklab(none 0.1 none))'
+Pass Property color value 'color-mix(in hsl, oklab(none none none))'
+Pass Property color value 'color-mix(in hsl, rgb(none none none))'
+Pass Property color value 'color-mix(in hsl, color(display-p3 none none none))'
Fail Property color value 'hwb(from hsl(none 50% 50%) h w b)'
Fail Property color value 'hwb(from hsl(180 none 50%) h w b)'
Fail Property color value 'hwb(from hsl(180 50% none) h w b)'
@@ -224,50 +224,50 @@ Fail Property color value 'color-mix(in hwb, oklab(none 0.1 none), hwb(11 33 44)
Pass Property color value 'color-mix(in hwb, oklab(none none none), hwb(11 33 44))'
Pass Property color value 'color-mix(in hwb, rgb(none none none), hwb(11 33 44))'
Pass Property color value 'color-mix(in hwb, color(display-p3 none none none), hwb(11 33 44))'
-Fail Property color value 'color-mix(in hwb, hsl(none 50% 50%))'
-Fail Property color value 'color-mix(in hwb, hsl(180 none 50%))'
-Fail Property color value 'color-mix(in hwb, hsl(180 50% none))'
-Fail Property color value 'color-mix(in hwb, hsl(none none 50%))'
-Fail Property color value 'color-mix(in hwb, hsl(180 none none))'
-Fail Property color value 'color-mix(in hwb, hsl(none 50% none))'
-Fail Property color value 'color-mix(in hwb, hsl(none none none))'
-Fail Property color value 'color-mix(in hwb, hwb(none 25% 25%))'
-Fail Property color value 'color-mix(in hwb, hwb(180 none 25%))'
-Fail Property color value 'color-mix(in hwb, hwb(180 25% none))'
-Fail Property color value 'color-mix(in hwb, hwb(none none 25%))'
-Fail Property color value 'color-mix(in hwb, hwb(180 none none))'
-Fail Property color value 'color-mix(in hwb, hwb(none 25% none))'
-Fail Property color value 'color-mix(in hwb, hwb(none none none))'
+Pass Property color value 'color-mix(in hwb, hsl(none 50% 50%))'
+Pass Property color value 'color-mix(in hwb, hsl(180 none 50%))'
+Pass Property color value 'color-mix(in hwb, hsl(180 50% none))'
+Pass Property color value 'color-mix(in hwb, hsl(none none 50%))'
+Pass Property color value 'color-mix(in hwb, hsl(180 none none))'
+Pass Property color value 'color-mix(in hwb, hsl(none 50% none))'
+Pass Property color value 'color-mix(in hwb, hsl(none none none))'
+Pass Property color value 'color-mix(in hwb, hwb(none 25% 25%))'
+Pass Property color value 'color-mix(in hwb, hwb(180 none 25%))'
+Pass Property color value 'color-mix(in hwb, hwb(180 25% none))'
+Pass Property color value 'color-mix(in hwb, hwb(none none 25%))'
+Pass Property color value 'color-mix(in hwb, hwb(180 none none))'
+Pass Property color value 'color-mix(in hwb, hwb(none 25% none))'
+Pass Property color value 'color-mix(in hwb, hwb(none none none))'
Pass Property color value 'color-mix(in hwb, lch(none 20 180))'
-Fail Property color value 'color-mix(in hwb, lch(20 none 180))'
-Fail Property color value 'color-mix(in hwb, lch(20 20 none))'
-Fail Property color value 'color-mix(in hwb, lch(none none 180))'
-Fail Property color value 'color-mix(in hwb, lch(20 none none))'
-Fail Property color value 'color-mix(in hwb, lch(none 20 none))'
-Fail Property color value 'color-mix(in hwb, lch(none none none))'
+Pass Property color value 'color-mix(in hwb, lch(20 none 180))'
+Pass Property color value 'color-mix(in hwb, lch(20 20 none))'
+Pass Property color value 'color-mix(in hwb, lch(none none 180))'
+Pass Property color value 'color-mix(in hwb, lch(20 none none))'
+Pass Property color value 'color-mix(in hwb, lch(none 20 none))'
+Pass Property color value 'color-mix(in hwb, lch(none none none))'
Pass Property color value 'color-mix(in hwb, oklch(none 0.2 180))'
-Fail Property color value 'color-mix(in hwb, oklch(0.2 none 180))'
-Fail Property color value 'color-mix(in hwb, oklch(0.2 0.2 none))'
-Fail Property color value 'color-mix(in hwb, oklch(none none 180))'
-Fail Property color value 'color-mix(in hwb, oklch(0.2 none none))'
-Fail Property color value 'color-mix(in hwb, oklch(none 0.2 none))'
-Fail Property color value 'color-mix(in hwb, oklch(none none none))'
+Pass Property color value 'color-mix(in hwb, oklch(0.2 none 180))'
+Pass Property color value 'color-mix(in hwb, oklch(0.2 0.2 none))'
+Pass Property color value 'color-mix(in hwb, oklch(none none 180))'
+Pass Property color value 'color-mix(in hwb, oklch(0.2 none none))'
+Pass Property color value 'color-mix(in hwb, oklch(none 0.2 none))'
+Pass Property color value 'color-mix(in hwb, oklch(none none none))'
Pass Property color value 'color-mix(in hwb, lab(none 10 10))'
Pass Property color value 'color-mix(in hwb, lab(50 none 10))'
Pass Property color value 'color-mix(in hwb, lab(50 10 none))'
Pass Property color value 'color-mix(in hwb, lab(none none 10))'
-Fail Property color value 'color-mix(in hwb, lab(50 none none))'
+Pass Property color value 'color-mix(in hwb, lab(50 none none))'
Pass Property color value 'color-mix(in hwb, lab(none 10 none))'
-Fail Property color value 'color-mix(in hwb, lab(none none none))'
+Pass Property color value 'color-mix(in hwb, lab(none none none))'
Pass Property color value 'color-mix(in hwb, oklab(none 0.1 0.1))'
Pass Property color value 'color-mix(in hwb, oklab(0.5 none 0.1))'
Pass Property color value 'color-mix(in hwb, oklab(0.5 0.1 none))'
Pass Property color value 'color-mix(in hwb, oklab(none none 0.1))'
-Fail Property color value 'color-mix(in hwb, oklab(0.5 none none))'
-Pass Property color value 'color-mix(in hwb, oklab(none 0.1 none))'
-Fail Property color value 'color-mix(in hwb, oklab(none none none))'
-Fail Property color value 'color-mix(in hwb, rgb(none none none))'
-Fail Property color value 'color-mix(in hwb, color(display-p3 none none none))'
+Pass Property color value 'color-mix(in hwb, oklab(0.5 none none))'
+Fail Property color value 'color-mix(in hwb, oklab(none 0.1 none))'
+Pass Property color value 'color-mix(in hwb, oklab(none none none))'
+Pass Property color value 'color-mix(in hwb, rgb(none none none))'
+Pass Property color value 'color-mix(in hwb, color(display-p3 none none none))'
Fail Property color value 'lch(from hsl(none 50% 50%) l c h)'
Fail Property color value 'lch(from hsl(180 none 50%) l c h)'
Fail Property color value 'lch(from hsl(180 50% none) l c h)'
@@ -276,8 +276,8 @@ Fail Property color value 'lch(from hsl(180 none none) l c h)'
Fail Property color value 'lch(from hsl(none 50% none) l c h)'
Fail Property color value 'lch(from hsl(none none none) l c h)'
Fail Property color value 'lch(from hwb(none 25% 25%) l c h)'
-Fail Property color value 'lch(from hwb(180 none 25%) l c h)'
-Fail Property color value 'lch(from hwb(180 25% none) l c h)'
+Pass Property color value 'lch(from hwb(180 none 25%) l c h)'
+Pass Property color value 'lch(from hwb(180 25% none) l c h)'
Fail Property color value 'lch(from hwb(none none 25%) l c h)'
Fail Property color value 'lch(from hwb(180 none none) l c h)'
Fail Property color value 'lch(from hwb(none 25% none) l c h)'
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-powerless.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-powerless.txt
index 5424aca3e44..e135908a819 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-powerless.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-powerless.txt
@@ -2,8 +2,8 @@ Harness status: OK
Found 570 tests
-375 Pass
-195 Fail
+410 Pass
+160 Fail
Pass Property color value 'hsl(from hsl(0 50% 50%) h s l)'
Pass Property color value 'hsl(from hsl(180 0 50%) h s l)'
Pass Property color value 'hsl(from hsl(180 50% 0) h s l)'
@@ -111,38 +111,38 @@ Pass Property color value 'color-mix(in hsl, hsl(0 0 0))'
Pass Property color value 'color-mix(in hsl, hsl(180 0.001% 50%))'
Pass Property color value 'color-mix(in hsl, hsl(180 0.0011% 50%))'
Pass Property color value 'color-mix(in hsl, hwb(0 25% 25%))'
-Fail Property color value 'color-mix(in hsl, hwb(180 100% 25%))'
-Fail Property color value 'color-mix(in hsl, hwb(180 25% 100%))'
-Fail Property color value 'color-mix(in hsl, hwb(0 100% 25%))'
-Fail Property color value 'color-mix(in hsl, hwb(180 100% 100%))'
-Fail Property color value 'color-mix(in hsl, hwb(0 25% 100%))'
-Fail Property color value 'color-mix(in hsl, hwb(0 100% 100%))'
-Fail Property color value 'color-mix(in hsl, hwb(180 49.999% 50%))'
-Pass Property color value 'color-mix(in hsl, hwb(180 49.998% 50%))'
+Pass Property color value 'color-mix(in hsl, hwb(180 100% 25%))'
+Pass Property color value 'color-mix(in hsl, hwb(180 25% 100%))'
+Pass Property color value 'color-mix(in hsl, hwb(0 100% 25%))'
+Pass Property color value 'color-mix(in hsl, hwb(180 100% 100%))'
+Pass Property color value 'color-mix(in hsl, hwb(0 25% 100%))'
+Pass Property color value 'color-mix(in hsl, hwb(0 100% 100%))'
+Pass Property color value 'color-mix(in hsl, hwb(180 49.999% 50%))'
+Fail Property color value 'color-mix(in hsl, hwb(180 49.998% 50%))'
Pass Property color value 'color-mix(in hsl, lch(0 20 180))'
-Fail Property color value 'color-mix(in hsl, lch(20 0 180))'
+Pass Property color value 'color-mix(in hsl, lch(20 0 180))'
Pass Property color value 'color-mix(in hsl, lch(20 20 0))'
-Fail Property color value 'color-mix(in hsl, lch(0 0 180))'
-Fail Property color value 'color-mix(in hsl, lch(20 0 0))'
+Pass Property color value 'color-mix(in hsl, lch(0 0 180))'
+Pass Property color value 'color-mix(in hsl, lch(20 0 0))'
Pass Property color value 'color-mix(in hsl, lch(0 20 0))'
-Fail Property color value 'color-mix(in hsl, lch(0 0 0))'
-Fail Property color value 'color-mix(in hsl, lch(20 0.0015 180))'
-Pass Property color value 'color-mix(in hsl, lch(20 0.00151 180))'
+Pass Property color value 'color-mix(in hsl, lch(0 0 0))'
+Pass Property color value 'color-mix(in hsl, lch(20 0.0015 180))'
+Fail Property color value 'color-mix(in hsl, lch(20 0.00151 180))'
Pass Property color value 'color-mix(in hsl, oklch(0 0.2 180))'
-Fail Property color value 'color-mix(in hsl, oklch(0.2 0 180))'
+Pass Property color value 'color-mix(in hsl, oklch(0.2 0 180))'
Pass Property color value 'color-mix(in hsl, oklch(0.2 0.2 0))'
-Fail Property color value 'color-mix(in hsl, oklch(0 0 180))'
-Fail Property color value 'color-mix(in hsl, oklch(0.2 0 0))'
+Pass Property color value 'color-mix(in hsl, oklch(0 0 180))'
+Pass Property color value 'color-mix(in hsl, oklch(0.2 0 0))'
Pass Property color value 'color-mix(in hsl, oklch(0 0.2 0))'
-Fail Property color value 'color-mix(in hsl, oklch(0 0 0))'
-Fail Property color value 'color-mix(in hsl, oklch(0.2 0.000004 180))'
-Pass Property color value 'color-mix(in hsl, oklch(0.2 0.0000041 180))'
-Fail Property color value 'color-mix(in hsl, rgb(0 0 0))'
-Fail Property color value 'color-mix(in hsl, color(display-p3 0 0 0))'
-Fail Property color value 'color-mix(in hsl, lab(0 0 0))'
-Fail Property color value 'color-mix(in hsl, oklab(0 0 0))'
-Pass Property color value 'color-mix(in hsl, color(display-p3 0.50000333 0.49999445 0.49999517))'
-Pass Property color value 'color-mix(in hsl, color(display-p3 0.49999645 0.50000513 0.50000531))'
+Pass Property color value 'color-mix(in hsl, oklch(0 0 0))'
+Pass Property color value 'color-mix(in hsl, oklch(0.2 0.000004 180))'
+Fail Property color value 'color-mix(in hsl, oklch(0.2 0.0000041 180))'
+Pass Property color value 'color-mix(in hsl, rgb(0 0 0))'
+Pass Property color value 'color-mix(in hsl, color(display-p3 0 0 0))'
+Pass Property color value 'color-mix(in hsl, lab(0 0 0))'
+Pass Property color value 'color-mix(in hsl, oklab(0 0 0))'
+Fail Property color value 'color-mix(in hsl, color(display-p3 0.50000333 0.49999445 0.49999517))'
+Fail Property color value 'color-mix(in hsl, color(display-p3 0.49999645 0.50000513 0.50000531))'
Pass Property color value 'hwb(from hsl(0 50% 50%) h w b)'
Fail Property color value 'hwb(from hsl(180 0 50%) h w b)'
Fail Property color value 'hwb(from hsl(180 50% 0) h w b)'
@@ -247,14 +247,14 @@ Pass Property color value 'color-mix(in hwb, oklab(0 0 0), hwb(11 33 44))'
Fail Property color value 'color-mix(in hwb, color(display-p3 0.50000333 0.49999445 0.49999517), hwb(11 33 44))'
Fail Property color value 'color-mix(in hwb, color(display-p3 0.49999645 0.50000513 0.50000531), hwb(11 33 44))'
Pass Property color value 'color-mix(in hwb, hsl(0 50% 50%))'
-Fail Property color value 'color-mix(in hwb, hsl(180 0 50%))'
-Fail Property color value 'color-mix(in hwb, hsl(180 50% 0))'
-Fail Property color value 'color-mix(in hwb, hsl(0 0 50%))'
-Fail Property color value 'color-mix(in hwb, hsl(180 0 0))'
-Fail Property color value 'color-mix(in hwb, hsl(0 50% 0))'
-Fail Property color value 'color-mix(in hwb, hsl(0 0 0))'
-Fail Property color value 'color-mix(in hwb, hsl(180 0.001% 50%))'
-Pass Property color value 'color-mix(in hwb, hsl(180 0.0011% 50%))'
+Pass Property color value 'color-mix(in hwb, hsl(180 0 50%))'
+Pass Property color value 'color-mix(in hwb, hsl(180 50% 0))'
+Pass Property color value 'color-mix(in hwb, hsl(0 0 50%))'
+Pass Property color value 'color-mix(in hwb, hsl(180 0 0))'
+Pass Property color value 'color-mix(in hwb, hsl(0 50% 0))'
+Pass Property color value 'color-mix(in hwb, hsl(0 0 0))'
+Pass Property color value 'color-mix(in hwb, hsl(180 0.001% 50%))'
+Fail Property color value 'color-mix(in hwb, hsl(180 0.0011% 50%))'
Pass Property color value 'color-mix(in hwb, hwb(0 25% 25%))'
Pass Property color value 'color-mix(in hwb, hwb(180 100% 25%))'
Pass Property color value 'color-mix(in hwb, hwb(180 25% 100%))'
@@ -263,39 +263,39 @@ Pass Property color value 'color-mix(in hwb, hwb(180 100% 100%))'
Pass Property color value 'color-mix(in hwb, hwb(0 25% 100%))'
Pass Property color value 'color-mix(in hwb, hwb(0 100% 100%))'
Pass Property color value 'color-mix(in hwb, hwb(180 99.999% 0%))'
-Fail Property color value 'color-mix(in hwb, hwb(180 99.999% none))'
+Pass Property color value 'color-mix(in hwb, hwb(180 99.999% none))'
Fail Property color value 'color-mix(in hwb, hsl(from hwb(180 99.999% none) h s l))'
Pass Property color value 'color-mix(in hwb, hwb(180 99.998% 0%))'
Pass Property color value 'color-mix(in hwb, hwb(180 0% 99.999%))'
-Fail Property color value 'color-mix(in hwb, hwb(180 none 99.999%))'
-Fail Property color value 'color-mix(in hwb, hsl(from hwb(180 none 99.999%) h s l))'
+Pass Property color value 'color-mix(in hwb, hwb(180 none 99.999%))'
+Pass Property color value 'color-mix(in hwb, hsl(from hwb(180 none 99.999%) h s l))'
Pass Property color value 'color-mix(in hwb, hwb(180 0% 99.998%))'
Pass Property color value 'color-mix(in hwb, hwb(180 49.999% 50%))'
Pass Property color value 'color-mix(in hwb, hwb(180 49.998% 50%))'
Pass Property color value 'color-mix(in hwb, lch(0 20 180))'
-Fail Property color value 'color-mix(in hwb, lch(20 0 180))'
+Pass Property color value 'color-mix(in hwb, lch(20 0 180))'
Pass Property color value 'color-mix(in hwb, lch(20 20 0))'
-Fail Property color value 'color-mix(in hwb, lch(0 0 180))'
-Fail Property color value 'color-mix(in hwb, lch(20 0 0))'
+Pass Property color value 'color-mix(in hwb, lch(0 0 180))'
+Pass Property color value 'color-mix(in hwb, lch(20 0 0))'
Pass Property color value 'color-mix(in hwb, lch(0 20 0))'
-Fail Property color value 'color-mix(in hwb, lch(0 0 0))'
-Fail Property color value 'color-mix(in hwb, lch(20 0.0015 180))'
-Pass Property color value 'color-mix(in hwb, lch(20 0.00151 180))'
+Pass Property color value 'color-mix(in hwb, lch(0 0 0))'
+Pass Property color value 'color-mix(in hwb, lch(20 0.0015 180))'
+Fail Property color value 'color-mix(in hwb, lch(20 0.00151 180))'
Pass Property color value 'color-mix(in hwb, oklch(0 0.2 180))'
-Fail Property color value 'color-mix(in hwb, oklch(0.2 0 180))'
+Pass Property color value 'color-mix(in hwb, oklch(0.2 0 180))'
Pass Property color value 'color-mix(in hwb, oklch(0.2 0.2 0))'
-Fail Property color value 'color-mix(in hwb, oklch(0 0 180))'
-Fail Property color value 'color-mix(in hwb, oklch(0.2 0 0))'
+Pass Property color value 'color-mix(in hwb, oklch(0 0 180))'
+Pass Property color value 'color-mix(in hwb, oklch(0.2 0 0))'
Pass Property color value 'color-mix(in hwb, oklch(0 0.2 0))'
-Fail Property color value 'color-mix(in hwb, oklch(0 0 0))'
-Fail Property color value 'color-mix(in hwb, oklch(0.8 0.000004 180))'
-Pass Property color value 'color-mix(in hwb, oklch(0.8 0.0000041 180))'
-Fail Property color value 'color-mix(in hwb, rgb(0 0 0))'
-Fail Property color value 'color-mix(in hwb, color(display-p3 0 0 0))'
-Fail Property color value 'color-mix(in hwb, lab(0 0 0))'
-Fail Property color value 'color-mix(in hwb, oklab(0 0 0))'
-Pass Property color value 'color-mix(in hwb, color(display-p3 0.50000333 0.49999445 0.49999517))'
-Pass Property color value 'color-mix(in hwb, color(display-p3 0.49999645 0.50000513 0.50000531))'
+Pass Property color value 'color-mix(in hwb, oklch(0 0 0))'
+Pass Property color value 'color-mix(in hwb, oklch(0.8 0.000004 180))'
+Fail Property color value 'color-mix(in hwb, oklch(0.8 0.0000041 180))'
+Pass Property color value 'color-mix(in hwb, rgb(0 0 0))'
+Pass Property color value 'color-mix(in hwb, color(display-p3 0 0 0))'
+Pass Property color value 'color-mix(in hwb, lab(0 0 0))'
+Pass Property color value 'color-mix(in hwb, oklab(0 0 0))'
+Fail Property color value 'color-mix(in hwb, color(display-p3 0.50000333 0.49999445 0.49999517))'
+Fail Property color value 'color-mix(in hwb, color(display-p3 0.49999645 0.50000513 0.50000531))'
Fail Property color value 'lch(from hsl(0 50% 50%) l c h)'
Fail Property color value 'lch(from hsl(180 0 50%) l c h)'
Fail Property color value 'lch(from hsl(180 50% 0) l c h)'
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-relative-color.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-relative-color.txt
index 5791c85920d..6dbbcb29e41 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-relative-color.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-relative-color.txt
@@ -2,8 +2,8 @@ Harness status: OK
Found 1170 tests
-1077 Pass
-93 Fail
+1093 Pass
+77 Fail
Pass Property color value 'rgb(from rebeccapurple r g b)'
Pass Property color value 'rgb(from rebeccapurple r g b / alpha)'
Pass Property color value 'rgb(from rgb(20%, 40%, 60%, 80%) r g b / alpha)'
@@ -134,15 +134,15 @@ Pass Property color value 'hsl(from hsl(50 50 50) h s calc((sin(l * (50rad / 50)
Pass Property color value 'hsl(from hsl(50 50 50) h s calc((sin(l * (50rad / (50deg * (180 / pi)))) + 1) * 50))'
Pass Property color value 'hsl(from hsl(from rebeccapurple h s l / calc(alpha + 0.5)) h s l / calc(alpha - 0.5))'
Pass Property color value 'hsl(from hsl(from rebeccapurple h s l / calc(alpha - 1.5)) h s l / calc(alpha + 0.5))'
-Fail Property color value 'hsl(from rebeccapurple none none none)'
-Fail Property color value 'hsl(from rebeccapurple none none none / none)'
-Fail Property color value 'hsl(from rebeccapurple h s none)'
-Fail Property color value 'hsl(from rebeccapurple h s none / alpha)'
-Fail Property color value 'hsl(from rebeccapurple h s l / none)'
-Fail Property color value 'hsl(from rebeccapurple none s l / alpha)'
-Fail Property color value 'hsl(from hsl(120deg 20% 50% / .5) h s none / alpha)'
-Fail Property color value 'hsl(from hsl(120deg 20% 50% / .5) h s l / none)'
-Fail Property color value 'hsl(from hsl(120deg 20% 50% / .5) none s l / alpha)'
+Pass Property color value 'hsl(from rebeccapurple none none none)'
+Pass Property color value 'hsl(from rebeccapurple none none none / none)'
+Pass Property color value 'hsl(from rebeccapurple h s none)'
+Pass Property color value 'hsl(from rebeccapurple h s none / alpha)'
+Pass Property color value 'hsl(from rebeccapurple h s l / none)'
+Pass Property color value 'hsl(from rebeccapurple none s l / alpha)'
+Pass Property color value 'hsl(from hsl(120deg 20% 50% / .5) h s none / alpha)'
+Pass Property color value 'hsl(from hsl(120deg 20% 50% / .5) h s l / none)'
+Pass Property color value 'hsl(from hsl(120deg 20% 50% / .5) none s l / alpha)'
Fail Property color value 'hsl(from hsl(none none none) h s l)'
Fail Property color value 'hsl(from hsl(none none none / none) h s l / alpha)'
Fail Property color value 'hsl(from hsl(120deg none 50% / .5) h s l)'
@@ -196,13 +196,13 @@ Pass Property color value 'hwb(from hwb(20 30 40 / 0.8) calc(h + 1) calc(w + 1)
Pass Property color value 'hwb(from rebeccapurple calc((h / 360) * 360deg) calc((w / 100) * 100%) calc((b / 100) * 100%) / calc(alpha * 100%))'
Pass Property color value 'hwb(from hwb(from rebeccapurple h w b / calc(alpha + 0.5)) h w b / calc(alpha - 0.5))'
Pass Property color value 'hwb(from hwb(from rebeccapurple h w b / calc(alpha - 1.5)) h w b / calc(alpha + 0.5))'
-Fail Property color value 'hwb(from rebeccapurple none none none)'
-Fail Property color value 'hwb(from rebeccapurple none none none / none)'
-Fail Property color value 'hwb(from rebeccapurple h w none)'
-Fail Property color value 'hwb(from rebeccapurple h w none / alpha)'
-Fail Property color value 'hwb(from rebeccapurple h w b / none)'
-Fail Property color value 'hwb(from rebeccapurple none w b / alpha)'
-Fail Property color value 'hwb(from hwb(120deg 20% 50% / .5) h w none / alpha)'
+Pass Property color value 'hwb(from rebeccapurple none none none)'
+Pass Property color value 'hwb(from rebeccapurple none none none / none)'
+Pass Property color value 'hwb(from rebeccapurple h w none)'
+Pass Property color value 'hwb(from rebeccapurple h w none / alpha)'
+Pass Property color value 'hwb(from rebeccapurple h w b / none)'
+Pass Property color value 'hwb(from rebeccapurple none w b / alpha)'
+Pass Property color value 'hwb(from hwb(120deg 20% 50% / .5) h w none / alpha)'
Fail Property color value 'hwb(from hwb(120deg 20% 50% / .5) h w b / none)'
Fail Property color value 'hwb(from hwb(120deg 20% 50% / .5) none w b / alpha)'
Fail Property color value 'hwb(from hwb(none none none) h w b)'
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-rgb.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-rgb.txt
index c0e5d68e720..ce183a37694 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-rgb.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-computed-rgb.txt
@@ -2,24 +2,23 @@ Harness status: OK
Found 99 tests
-83 Pass
-16 Fail
-Fail Property color value 'rgb(none none none)'
-Fail Property color value 'rgb(none none none / none)'
-Fail Property color value 'rgb(128 none none)'
-Fail Property color value 'rgb(128 none none / none)'
-Fail Property color value 'rgb(none none none / .5)'
-Fail Property color value 'rgb(20% none none)'
-Fail Property color value 'rgb(20% none none / none)'
-Fail Property color value 'rgb(none none none / 50%)'
-Fail Property color value 'rgba(none none none)'
-Fail Property color value 'rgba(none none none / none)'
-Fail Property color value 'rgba(128 none none)'
-Fail Property color value 'rgba(128 none none / none)'
-Fail Property color value 'rgba(none none none / .5)'
-Fail Property color value 'rgba(20% none none)'
-Fail Property color value 'rgba(20% none none / none)'
-Fail Property color value 'rgba(none none none / 50%)'
+99 Pass
+Pass Property color value 'rgb(none none none)'
+Pass Property color value 'rgb(none none none / none)'
+Pass Property color value 'rgb(128 none none)'
+Pass Property color value 'rgb(128 none none / none)'
+Pass Property color value 'rgb(none none none / .5)'
+Pass Property color value 'rgb(20% none none)'
+Pass Property color value 'rgb(20% none none / none)'
+Pass Property color value 'rgb(none none none / 50%)'
+Pass Property color value 'rgba(none none none)'
+Pass Property color value 'rgba(none none none / none)'
+Pass Property color value 'rgba(128 none none)'
+Pass Property color value 'rgba(128 none none / none)'
+Pass Property color value 'rgba(none none none / .5)'
+Pass Property color value 'rgba(20% none none)'
+Pass Property color value 'rgba(20% none none / none)'
+Pass Property color value 'rgba(none none none / 50%)'
Pass Property color value 'rgb(00, 51, 102)' [Valid numbers should be parsed]
Pass Property color value 'r\gb(00, 51, 102)' [Correct escape sequences should still parse]
Pass Property color value 'r\67 b(00, 51, 102)' [Correct escape sequences should still parse]
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-color-mix-function.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-color-mix-function.txt
index c1660084dc2..aa2a9e680d1 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-color-mix-function.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-color-mix-function.txt
@@ -2,8 +2,7 @@ Harness status: OK
Found 677 tests
-659 Pass
-18 Fail
+677 Pass
Pass e.style['color'] = "color-mix(in srgb, red, blue)" should set the property value
Pass e.style['color'] = "color-mix(in srgb, 70% red, 50% blue)" should set the property value
Pass e.style['color'] = "color-mix(in hsl, red, blue)" should set the property value
@@ -65,15 +64,15 @@ Pass e.style['color'] = "color-mix(in hsl decreasing hue, hsl(50deg 50% 50%), hs
Pass e.style['color'] = "color-mix(in hsl decreasing hue, hsl(330deg 50% 50%), hsl(50deg 50% 50%))" should set the property value
Pass e.style['color'] = "color-mix(in hsl decreasing hue, hsl(20deg 50% 50%), hsl(320deg 50% 50%))" should set the property value
Pass e.style['color'] = "color-mix(in hsl decreasing hue, hsl(320deg 50% 50%), hsl(20deg 50% 50%))" should set the property value
-Fail e.style['color'] = "color-mix(in hsl, hsl(none none none), hsl(none none none))" should set the property value
-Fail e.style['color'] = "color-mix(in hsl, hsl(none none none), hsl(30deg 40% 80%))" should set the property value
-Fail e.style['color'] = "color-mix(in hsl, hsl(120deg 20% 40%), hsl(none none none))" should set the property value
-Fail e.style['color'] = "color-mix(in hsl, hsl(120deg 20% none), hsl(30deg 40% 60%))" should set the property value
-Fail e.style['color'] = "color-mix(in hsl, hsl(120deg 20% 40%), hsl(30deg 20% none))" should set the property value
-Fail e.style['color'] = "color-mix(in hsl, hsl(none 20% 40%), hsl(30deg none 80%))" should set the property value
-Fail e.style['color'] = "color-mix(in hsl, hsl(120deg 40% 40% / none), hsl(0deg 40% 40%))" should set the property value
-Fail e.style['color'] = "color-mix(in hsl, hsl(120deg 40% 40% / none), hsl(0deg 40% 40% / 0.5))" should set the property value
-Fail e.style['color'] = "color-mix(in hsl, hsl(120deg 40% 40% / none), hsl(0deg 40% 40% / none))" should set the property value
+Pass e.style['color'] = "color-mix(in hsl, hsl(none none none), hsl(none none none))" should set the property value
+Pass e.style['color'] = "color-mix(in hsl, hsl(none none none), hsl(30deg 40% 80%))" should set the property value
+Pass e.style['color'] = "color-mix(in hsl, hsl(120deg 20% 40%), hsl(none none none))" should set the property value
+Pass e.style['color'] = "color-mix(in hsl, hsl(120deg 20% none), hsl(30deg 40% 60%))" should set the property value
+Pass e.style['color'] = "color-mix(in hsl, hsl(120deg 20% 40%), hsl(30deg 20% none))" should set the property value
+Pass e.style['color'] = "color-mix(in hsl, hsl(none 20% 40%), hsl(30deg none 80%))" should set the property value
+Pass e.style['color'] = "color-mix(in hsl, hsl(120deg 40% 40% / none), hsl(0deg 40% 40%))" should set the property value
+Pass e.style['color'] = "color-mix(in hsl, hsl(120deg 40% 40% / none), hsl(0deg 40% 40% / 0.5))" should set the property value
+Pass e.style['color'] = "color-mix(in hsl, hsl(120deg 40% 40% / none), hsl(0deg 40% 40% / none))" should set the property value
Pass e.style['color'] = "color-mix(in hsl, color(display-p3 0 1 0) 100%, rgb(0, 0, 0) 0%)" should set the property value
Pass e.style['color'] = "color-mix(in hsl, lab(100 104.3 -50.9) 100%, rgb(0, 0, 0) 0%)" should set the property value
Pass e.style['color'] = "color-mix(in hsl, lab(0 104.3 -50.9) 100%, rgb(0, 0, 0) 0%)" should set the property value
@@ -138,15 +137,15 @@ Pass e.style['color'] = "color-mix(in hwb decreasing hue, hwb(50deg 30% 40%), hw
Pass e.style['color'] = "color-mix(in hwb decreasing hue, hwb(330deg 30% 40%), hwb(50deg 30% 40%))" should set the property value
Pass e.style['color'] = "color-mix(in hwb decreasing hue, hwb(20deg 30% 40%), hwb(320deg 30% 40%))" should set the property value
Pass e.style['color'] = "color-mix(in hwb decreasing hue, hwb(320deg 30% 40%), hwb(20deg 30% 40%))" should set the property value
-Fail e.style['color'] = "color-mix(in hwb, hwb(none none none), hwb(none none none))" should set the property value
-Fail e.style['color'] = "color-mix(in hwb, hwb(none none none), hwb(30deg 30% 40%))" should set the property value
-Fail e.style['color'] = "color-mix(in hwb, hwb(120deg 10% 20%), hwb(none none none))" should set the property value
-Fail e.style['color'] = "color-mix(in hwb, hwb(120deg 10% none), hwb(30deg 30% 40%))" should set the property value
-Fail e.style['color'] = "color-mix(in hwb, hwb(120deg 10% 20%), hwb(30deg 30% none))" should set the property value
-Fail e.style['color'] = "color-mix(in hwb, hwb(none 10% 20%), hwb(30deg none 40%))" should set the property value
-Fail e.style['color'] = "color-mix(in hwb, hwb(120deg 10% 20% / none), hwb(30deg 30% 40%))" should set the property value
-Fail e.style['color'] = "color-mix(in hwb, hwb(120deg 10% 20% / none), hwb(30deg 30% 40% / 0.5))" should set the property value
-Fail e.style['color'] = "color-mix(in hwb, hwb(120deg 10% 20% / none), hwb(30deg 30% 40% / none))" should set the property value
+Pass e.style['color'] = "color-mix(in hwb, hwb(none none none), hwb(none none none))" should set the property value
+Pass e.style['color'] = "color-mix(in hwb, hwb(none none none), hwb(30deg 30% 40%))" should set the property value
+Pass e.style['color'] = "color-mix(in hwb, hwb(120deg 10% 20%), hwb(none none none))" should set the property value
+Pass e.style['color'] = "color-mix(in hwb, hwb(120deg 10% none), hwb(30deg 30% 40%))" should set the property value
+Pass e.style['color'] = "color-mix(in hwb, hwb(120deg 10% 20%), hwb(30deg 30% none))" should set the property value
+Pass e.style['color'] = "color-mix(in hwb, hwb(none 10% 20%), hwb(30deg none 40%))" should set the property value
+Pass e.style['color'] = "color-mix(in hwb, hwb(120deg 10% 20% / none), hwb(30deg 30% 40%))" should set the property value
+Pass e.style['color'] = "color-mix(in hwb, hwb(120deg 10% 20% / none), hwb(30deg 30% 40% / 0.5))" should set the property value
+Pass e.style['color'] = "color-mix(in hwb, hwb(120deg 10% 20% / none), hwb(30deg 30% 40% / none))" should set the property value
Pass e.style['color'] = "color-mix(in hwb, color(display-p3 0 1 0) 100%, rgb(0, 0, 0) 0%)" should set the property value
Pass e.style['color'] = "color-mix(in hwb, lab(100 104.3 -50.9) 100%, rgb(0, 0, 0) 0%)" should set the property value
Pass e.style['color'] = "color-mix(in hwb, lab(0 104.3 -50.9) 100%, rgb(0, 0, 0) 0%)" should set the property value
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-hsl.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-hsl.txt
index 02a7d0ef991..8ecb97b2d5f 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-hsl.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-hsl.txt
@@ -2,27 +2,26 @@ Harness status: OK
Found 60 tests
-46 Pass
-14 Fail
+60 Pass
Pass e.style['color'] = "hsl(120 30% 50%)" should set the property value
Pass e.style['color'] = "hsl(120 30% 50% / 0.5)" should set the property value
-Fail e.style['color'] = "hsl(none none none)" should set the property value
+Pass e.style['color'] = "hsl(none none none)" should set the property value
Pass e.style['color'] = "hsl(0 0% 0%)" should set the property value
-Fail e.style['color'] = "hsl(none none none / none)" should set the property value
+Pass e.style['color'] = "hsl(none none none / none)" should set the property value
Pass e.style['color'] = "hsl(0 0% 0% / 0)" should set the property value
-Fail e.style['color'] = "hsla(none none none)" should set the property value
+Pass e.style['color'] = "hsla(none none none)" should set the property value
Pass e.style['color'] = "hsla(0 0% 0%)" should set the property value
-Fail e.style['color'] = "hsla(none none none / none)" should set the property value
+Pass e.style['color'] = "hsla(none none none / none)" should set the property value
Pass e.style['color'] = "hsla(0 0% 0% / 0)" should set the property value
-Fail e.style['color'] = "hsl(120 none none)" should set the property value
+Pass e.style['color'] = "hsl(120 none none)" should set the property value
Pass e.style['color'] = "hsl(120 0% 0%)" should set the property value
-Fail e.style['color'] = "hsl(120 80% none)" should set the property value
+Pass e.style['color'] = "hsl(120 80% none)" should set the property value
Pass e.style['color'] = "hsl(120 80% 0%)" should set the property value
-Fail e.style['color'] = "hsl(120 none 50%)" should set the property value
+Pass e.style['color'] = "hsl(120 none 50%)" should set the property value
Pass e.style['color'] = "hsl(120 0% 50%)" should set the property value
-Fail e.style['color'] = "hsl(120 100% 50% / none)" should set the property value
+Pass e.style['color'] = "hsl(120 100% 50% / none)" should set the property value
Pass e.style['color'] = "hsl(120 100% 50% / 0)" should set the property value
-Fail e.style['color'] = "hsl(none 100% 50%)" should set the property value
+Pass e.style['color'] = "hsl(none 100% 50%)" should set the property value
Pass e.style['color'] = "hsl(0 100% 50%)" should set the property value
Pass e.style['color'] = "hsl(120 30 50)" should set the property value
Pass e.style['color'] = "hsl(120 30 50 / 0.5)" should set the property value
@@ -30,11 +29,11 @@ Pass e.style['color'] = "hsl(120 30% 50)" should set the property value
Pass e.style['color'] = "hsl(120 30% 50 / 0.5)" should set the property value
Pass e.style['color'] = "hsl(120 30 50%)" should set the property value
Pass e.style['color'] = "hsl(120 30 50% / 0.5)" should set the property value
-Fail e.style['color'] = "hsl(120 none 50)" should set the property value
-Fail e.style['color'] = "hsl(120 none 50 / 0.5)" should set the property value
-Fail e.style['color'] = "hsl(120 30 none)" should set the property value
-Fail e.style['color'] = "hsl(120 30 none / 0.5)" should set the property value
-Fail e.style['color'] = "hsl(120 30 50 / none)" should set the property value
+Pass e.style['color'] = "hsl(120 none 50)" should set the property value
+Pass e.style['color'] = "hsl(120 none 50 / 0.5)" should set the property value
+Pass e.style['color'] = "hsl(120 30 none)" should set the property value
+Pass e.style['color'] = "hsl(120 30 none / 0.5)" should set the property value
+Pass e.style['color'] = "hsl(120 30 50 / none)" should set the property value
Pass e.style['color'] = "hsl(0 -50% 40%)" should set the property value
Pass e.style['color'] = "hsl(30 -50% 60)" should set the property value
Pass e.style['color'] = "hsl(0 -50 40%)" should set the property value
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-hwb.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-hwb.txt
index 229d3276343..6417ff3ae60 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-hwb.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-hwb.txt
@@ -2,23 +2,22 @@ Harness status: OK
Found 39 tests
-27 Pass
-12 Fail
+39 Pass
Pass e.style['color'] = "hwb(120 30% 50%)" should set the property value
Pass e.style['color'] = "hwb(120 30% 50% / 0.5)" should set the property value
-Fail e.style['color'] = "hwb(none none none)" should set the property value
+Pass e.style['color'] = "hwb(none none none)" should set the property value
Pass e.style['color'] = "hwb(0 0% 0%)" should set the property value
-Fail e.style['color'] = "hwb(none none none / none)" should set the property value
+Pass e.style['color'] = "hwb(none none none / none)" should set the property value
Pass e.style['color'] = "hwb(0 0% 0% / 0)" should set the property value
-Fail e.style['color'] = "hwb(120 none none)" should set the property value
+Pass e.style['color'] = "hwb(120 none none)" should set the property value
Pass e.style['color'] = "hwb(120 0% 0%)" should set the property value
-Fail e.style['color'] = "hwb(120 80% none)" should set the property value
+Pass e.style['color'] = "hwb(120 80% none)" should set the property value
Pass e.style['color'] = "hwb(120 80% 0%)" should set the property value
-Fail e.style['color'] = "hwb(120 none 50%)" should set the property value
+Pass e.style['color'] = "hwb(120 none 50%)" should set the property value
Pass e.style['color'] = "hwb(120 0% 50%)" should set the property value
-Fail e.style['color'] = "hwb(120 30% 50% / none)" should set the property value
+Pass e.style['color'] = "hwb(120 30% 50% / none)" should set the property value
Pass e.style['color'] = "hwb(120 30% 50% / 0)" should set the property value
-Fail e.style['color'] = "hwb(none 100% 50% / none)" should set the property value
+Pass e.style['color'] = "hwb(none 100% 50% / none)" should set the property value
Pass e.style['color'] = "hwb(0 100% 50% / 0)" should set the property value
Pass e.style['color'] = "hwb(120 30 50)" should set the property value
Pass e.style['color'] = "hwb(120 30 50 / 0.5)" should set the property value
@@ -26,11 +25,11 @@ Pass e.style['color'] = "hwb(120 30% 50)" should set the property value
Pass e.style['color'] = "hwb(120 30% 50 / 0.5)" should set the property value
Pass e.style['color'] = "hwb(120 30 50%)" should set the property value
Pass e.style['color'] = "hwb(120 30 50% / 0.5)" should set the property value
-Fail e.style['color'] = "hwb(120 none 50)" should set the property value
-Fail e.style['color'] = "hwb(120 none 50 / 0.5)" should set the property value
-Fail e.style['color'] = "hwb(120 30 none)" should set the property value
-Fail e.style['color'] = "hwb(120 30 none / 0.5)" should set the property value
-Fail e.style['color'] = "hwb(120 30 50 / none)" should set the property value
+Pass e.style['color'] = "hwb(120 none 50)" should set the property value
+Pass e.style['color'] = "hwb(120 none 50 / 0.5)" should set the property value
+Pass e.style['color'] = "hwb(120 30 none)" should set the property value
+Pass e.style['color'] = "hwb(120 30 none / 0.5)" should set the property value
+Pass e.style['color'] = "hwb(120 30 50 / none)" should set the property value
Pass e.style['color'] = "hwb(320deg 30% 40%)" should set the property value
Pass e.style['color'] = "hwb(calc(infinity) 20% 10%)" should set the property value
Pass e.style['color'] = "hwb(calc(-infinity) 20% 10%)" should set the property value
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-relative-color.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-relative-color.txt
index cbabb646ab5..e4ca0b4ddc5 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-relative-color.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-relative-color.txt
@@ -2,8 +2,8 @@ Harness status: OK
Found 1147 tests
-1123 Pass
-24 Fail
+1146 Pass
+1 Fail
Pass e.style['color'] = "rgb(from rebeccapurple r g b)" should set the property value
Pass e.style['color'] = "rgb(from rebeccapurple r g b / alpha)" should set the property value
Pass e.style['color'] = "rgb(from rgb(20%, 40%, 60%, 80%) r g b / alpha)" should set the property value
@@ -68,10 +68,10 @@ Pass e.style['color'] = "rgb(from rebeccapurple r g none / alpha)" should set th
Pass e.style['color'] = "rgb(from rebeccapurple r g b / none)" should set the property value
Pass e.style['color'] = "rgb(from rgb(20% 40% 60% / 80%) r g none / alpha)" should set the property value
Pass e.style['color'] = "rgb(from rgb(20% 40% 60% / 80%) r g b / none)" should set the property value
-Fail e.style['color'] = "rgb(from rgb(none none none) r g b)" should set the property value
-Fail e.style['color'] = "rgb(from rgb(none none none / none) r g b / alpha)" should set the property value
-Fail e.style['color'] = "rgb(from rgb(20% none 60%) r g b)" should set the property value
-Fail e.style['color'] = "rgb(from rgb(20% 40% 60% / none) r g b / alpha)" should set the property value
+Pass e.style['color'] = "rgb(from rgb(none none none) r g b)" should set the property value
+Pass e.style['color'] = "rgb(from rgb(none none none / none) r g b / alpha)" should set the property value
+Pass e.style['color'] = "rgb(from rgb(20% none 60%) r g b)" should set the property value
+Pass e.style['color'] = "rgb(from rgb(20% 40% 60% / none) r g b / alpha)" should set the property value
Pass e.style['color'] = "rgb(from currentColor r g b)" should set the property value
Pass e.style['color'] = "rgb(from color-mix(in srgb, red, red) r g b / alpha)" should set the property value
Pass e.style['color'] = "rgba(from rebeccapurple r g b)" should set the property value
@@ -138,10 +138,10 @@ Pass e.style['color'] = "rgba(from rebeccapurple r g none / alpha)" should set t
Pass e.style['color'] = "rgba(from rebeccapurple r g b / none)" should set the property value
Pass e.style['color'] = "rgba(from rgb(20% 40% 60% / 80%) r g none / alpha)" should set the property value
Pass e.style['color'] = "rgba(from rgb(20% 40% 60% / 80%) r g b / none)" should set the property value
-Fail e.style['color'] = "rgba(from rgb(none none none) r g b)" should set the property value
-Fail e.style['color'] = "rgba(from rgb(none none none / none) r g b / alpha)" should set the property value
-Fail e.style['color'] = "rgba(from rgb(20% none 60%) r g b)" should set the property value
-Fail e.style['color'] = "rgba(from rgb(20% 40% 60% / none) r g b / alpha)" should set the property value
+Pass e.style['color'] = "rgba(from rgb(none none none) r g b)" should set the property value
+Pass e.style['color'] = "rgba(from rgb(none none none / none) r g b / alpha)" should set the property value
+Pass e.style['color'] = "rgba(from rgb(20% none 60%) r g b)" should set the property value
+Pass e.style['color'] = "rgba(from rgb(20% 40% 60% / none) r g b / alpha)" should set the property value
Pass e.style['color'] = "rgba(from currentColor r g b)" should set the property value
Pass e.style['color'] = "rgba(from color-mix(in srgb, red, red) r g b / alpha)" should set the property value
Pass e.style['color'] = "hsl(from rebeccapurple h s l)" should set the property value
@@ -192,11 +192,11 @@ Pass e.style['color'] = "hsl(from rebeccapurple none s l / alpha)" should set th
Pass e.style['color'] = "hsl(from hsl(120deg 20% 50% / .5) h s none / alpha)" should set the property value
Pass e.style['color'] = "hsl(from hsl(120deg 20% 50% / .5) h s l / none)" should set the property value
Pass e.style['color'] = "hsl(from hsl(120deg 20% 50% / .5) none s l / alpha)" should set the property value
-Fail e.style['color'] = "hsl(from hsl(none none none) h s l)" should set the property value
-Fail e.style['color'] = "hsl(from hsl(none none none / none) h s l / alpha)" should set the property value
-Fail e.style['color'] = "hsl(from hsl(120deg none 50% / .5) h s l)" should set the property value
-Fail e.style['color'] = "hsl(from hsl(120deg 20% 50% / none) h s l / alpha)" should set the property value
-Fail e.style['color'] = "hsl(from hsl(none 20% 50% / .5) h s l / alpha)" should set the property value
+Pass e.style['color'] = "hsl(from hsl(none none none) h s l)" should set the property value
+Pass e.style['color'] = "hsl(from hsl(none none none / none) h s l / alpha)" should set the property value
+Pass e.style['color'] = "hsl(from hsl(120deg none 50% / .5) h s l)" should set the property value
+Pass e.style['color'] = "hsl(from hsl(120deg 20% 50% / none) h s l / alpha)" should set the property value
+Pass e.style['color'] = "hsl(from hsl(none 20% 50% / .5) h s l / alpha)" should set the property value
Pass e.style['color'] = "hsl(from currentColor h s l)" should set the property value
Pass e.style['color'] = "hsl(from color-mix(in srgb, red, red) h s l / alpha)" should set the property value
Pass e.style['color'] = "hsla(from rebeccapurple h s l)" should set the property value
@@ -247,11 +247,11 @@ Pass e.style['color'] = "hsla(from rebeccapurple none s l / alpha)" should set t
Pass e.style['color'] = "hsla(from hsl(120deg 20% 50% / .5) h s none / alpha)" should set the property value
Pass e.style['color'] = "hsla(from hsl(120deg 20% 50% / .5) h s l / none)" should set the property value
Pass e.style['color'] = "hsla(from hsl(120deg 20% 50% / .5) none s l / alpha)" should set the property value
-Fail e.style['color'] = "hsla(from hsl(none none none) h s l)" should set the property value
-Fail e.style['color'] = "hsla(from hsl(none none none / none) h s l / alpha)" should set the property value
-Fail e.style['color'] = "hsla(from hsl(120deg none 50% / .5) h s l)" should set the property value
-Fail e.style['color'] = "hsla(from hsl(120deg 20% 50% / none) h s l / alpha)" should set the property value
-Fail e.style['color'] = "hsla(from hsl(none 20% 50% / .5) h s l / alpha)" should set the property value
+Pass e.style['color'] = "hsla(from hsl(none none none) h s l)" should set the property value
+Pass e.style['color'] = "hsla(from hsl(none none none / none) h s l / alpha)" should set the property value
+Pass e.style['color'] = "hsla(from hsl(120deg none 50% / .5) h s l)" should set the property value
+Pass e.style['color'] = "hsla(from hsl(120deg 20% 50% / none) h s l / alpha)" should set the property value
+Pass e.style['color'] = "hsla(from hsl(none 20% 50% / .5) h s l / alpha)" should set the property value
Pass e.style['color'] = "hsla(from currentColor h s l)" should set the property value
Pass e.style['color'] = "hsla(from color-mix(in srgb, red, red) h s l / alpha)" should set the property value
Pass e.style['color'] = "hwb(from rebeccapurple h w b)" should set the property value
@@ -302,11 +302,11 @@ Pass e.style['color'] = "hwb(from rebeccapurple none w b / alpha)" should set th
Pass e.style['color'] = "hwb(from hwb(120deg 20% 50% / .5) h w none / alpha)" should set the property value
Pass e.style['color'] = "hwb(from hwb(120deg 20% 50% / .5) h w b / none)" should set the property value
Pass e.style['color'] = "hwb(from hwb(120deg 20% 50% / .5) none w b / alpha)" should set the property value
-Fail e.style['color'] = "hwb(from hwb(none none none) h w b)" should set the property value
-Fail e.style['color'] = "hwb(from hwb(none none none / none) h w b / alpha)" should set the property value
-Fail e.style['color'] = "hwb(from hwb(120deg none 50% / .5) h w b)" should set the property value
-Fail e.style['color'] = "hwb(from hwb(120deg 20% 50% / none) h w b / alpha)" should set the property value
-Fail e.style['color'] = "hwb(from hwb(none 20% 50% / .5) h w b / alpha)" should set the property value
+Pass e.style['color'] = "hwb(from hwb(none none none) h w b)" should set the property value
+Pass e.style['color'] = "hwb(from hwb(none none none / none) h w b / alpha)" should set the property value
+Pass e.style['color'] = "hwb(from hwb(120deg none 50% / .5) h w b)" should set the property value
+Pass e.style['color'] = "hwb(from hwb(120deg 20% 50% / none) h w b / alpha)" should set the property value
+Pass e.style['color'] = "hwb(from hwb(none 20% 50% / .5) h w b / alpha)" should set the property value
Pass e.style['color'] = "hwb(from currentColor h w b)" should set the property value
Pass e.style['color'] = "hwb(from color-mix(in srgb, red, red) h w b / alpha)" should set the property value
Pass e.style['color'] = "lab(from lab(25 20 50) l a b)" should set the property value
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-rgb.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-rgb.txt
index 83d7e07836d..82dff78f859 100644
--- a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-rgb.txt
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-rgb.txt
@@ -2,24 +2,23 @@ Harness status: OK
Found 70 tests
-54 Pass
-16 Fail
-Fail e.style['color'] = "rgb(none none none)" should set the property value
-Fail e.style['color'] = "rgb(none none none / none)" should set the property value
-Fail e.style['color'] = "rgb(128 none none)" should set the property value
-Fail e.style['color'] = "rgb(128 none none / none)" should set the property value
-Fail e.style['color'] = "rgb(none none none / .5)" should set the property value
-Fail e.style['color'] = "rgb(20% none none)" should set the property value
-Fail e.style['color'] = "rgb(20% none none / none)" should set the property value
-Fail e.style['color'] = "rgb(none none none / 50%)" should set the property value
-Fail e.style['color'] = "rgba(none none none)" should set the property value
-Fail e.style['color'] = "rgba(none none none / none)" should set the property value
-Fail e.style['color'] = "rgba(128 none none)" should set the property value
-Fail e.style['color'] = "rgba(128 none none / none)" should set the property value
-Fail e.style['color'] = "rgba(none none none / .5)" should set the property value
-Fail e.style['color'] = "rgba(20% none none)" should set the property value
-Fail e.style['color'] = "rgba(20% none none / none)" should set the property value
-Fail e.style['color'] = "rgba(none none none / 50%)" should set the property value
+70 Pass
+Pass e.style['color'] = "rgb(none none none)" should set the property value
+Pass e.style['color'] = "rgb(none none none / none)" should set the property value
+Pass e.style['color'] = "rgb(128 none none)" should set the property value
+Pass e.style['color'] = "rgb(128 none none / none)" should set the property value
+Pass e.style['color'] = "rgb(none none none / .5)" should set the property value
+Pass e.style['color'] = "rgb(20% none none)" should set the property value
+Pass e.style['color'] = "rgb(20% none none / none)" should set the property value
+Pass e.style['color'] = "rgb(none none none / 50%)" should set the property value
+Pass e.style['color'] = "rgba(none none none)" should set the property value
+Pass e.style['color'] = "rgba(none none none / none)" should set the property value
+Pass e.style['color'] = "rgba(128 none none)" should set the property value
+Pass e.style['color'] = "rgba(128 none none / none)" should set the property value
+Pass e.style['color'] = "rgba(none none none / .5)" should set the property value
+Pass e.style['color'] = "rgba(20% none none)" should set the property value
+Pass e.style['color'] = "rgba(20% none none / none)" should set the property value
+Pass e.style['color'] = "rgba(none none none / 50%)" should set the property value
Pass e.style['color'] = "rgb(-2 3 4)" should set the property value
Pass e.style['color'] = "rgb(-20% 20% 40%)" should set the property value
Pass e.style['color'] = "rgb(257 30 40)" should set the property value
diff --git a/Tests/LibWeb/Text/input/css/color-missing-components-clamping.html b/Tests/LibWeb/Text/input/css/color-missing-components-clamping.html
new file mode 100644
index 00000000000..2112d5e8cf6
--- /dev/null
+++ b/Tests/LibWeb/Text/input/css/color-missing-components-clamping.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<script src="../include.js"></script>
+<div id="target"></div>
+<script>
+ test(() => {
+ const target = document.getElementById("target");
+ for (const value of [
+ "rgb(none 300 0)",
+ "rgb(none -10 0)",
+ "rgb(none 10% 200%)",
+ "hsl(none -10% 50%)",
+ "hsl(120 -10% none)",
+ "rgb(none calc(255 * sign(1em - 10px)) 0)",
+ ]) {
+ target.style.color = value;
+ println(`${value}: specified ${target.style.color}, computed ${getComputedStyle(target).color}`);
+ }
+ });
+</script>