diff --git a/Libraries/LibWeb/CSS/StyleValues/CSSColor.cpp b/Libraries/LibWeb/CSS/StyleValues/CSSColor.cpp index 8d55fc045041..3ec0ea45c8f3 100644 --- a/Libraries/LibWeb/CSS/StyleValues/CSSColor.cpp +++ b/Libraries/LibWeb/CSS/StyleValues/CSSColor.cpp @@ -8,6 +8,7 @@ #include #include #include +#include namespace Web::CSS { @@ -90,9 +91,42 @@ CSSColor::Resolved CSSColor::resolve_properties() const } // https://www.w3.org/TR/css-color-4/#serializing-color-function-values -String CSSColor::to_string(SerializationMode) const +String CSSColor::to_string(SerializationMode mode) const { - // FIXME: Do this properly, taking unresolved calculated values into account. + if (mode == SerializationMode::Normal) { + auto convert_percentage = [](ValueComparingNonnullRefPtr const& value) -> RemoveReference { + if (is(*value)) + return NumberStyleValue::create(value->as_percentage().value() / 100); + return value; + }; + + auto alpha = convert_percentage(m_properties.alpha); + + bool const is_alpha_required = [&]() { + if (is(*alpha)) + return alpha->as_number().value() < 1; + return true; + }(); + + if (is(*alpha) && alpha->as_number().value() < 0) + alpha = NumberStyleValue::create(0); + + if (is_alpha_required) { + return MUST(String::formatted("color({} {} {} {} / {})", + string_view_from_color_type(m_color_type), + convert_percentage(m_properties.channels[0])->to_string(mode), + convert_percentage(m_properties.channels[1])->to_string(mode), + convert_percentage(m_properties.channels[2])->to_string(mode), + alpha->to_string(mode))); + } + + return MUST(String::formatted("color({} {} {} {})", + string_view_from_color_type(m_color_type), + convert_percentage(m_properties.channels[0])->to_string(mode), + convert_percentage(m_properties.channels[1])->to_string(mode), + convert_percentage(m_properties.channels[2])->to_string(mode))); + } + auto resolved = resolve_properties(); if (resolved.alpha == 1) { return MUST(String::formatted("color({} {} {} {})", diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-color-function.txt b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-color-function.txt index 7111cc234555..21a8b0e995aa 100644 --- a/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-color-function.txt +++ b/Tests/LibWeb/Text/expected/wpt-import/css/css-color/parsing/color-valid-color-function.txt @@ -2,8 +2,8 @@ Harness status: OK Found 306 tests -180 Pass -126 Fail +261 Pass +45 Fail Pass e.style['color'] = "color(srgb 0% 0% 0%)" should set the property value Pass e.style['color'] = "color(srgb 10% 10% 10%)" should set the property value Pass e.style['color'] = "color(srgb .2 .2 25%)" should set the property value @@ -26,15 +26,15 @@ Pass e.style['color'] = "color(srgb 200% 200% 200% / 200%)" should set the prope Pass e.style['color'] = "color(srgb -200% -200% -200% / -200%)" should set the property value Fail e.style['color'] = "color(srgb calc(0.5 + 1) calc(0.5 - 1) calc(0.5) / calc(-0.5 + 1))" should set the property value Fail e.style['color'] = "color(srgb calc(50% * 3) calc(-150% / 3) calc(50%) / calc(-50% * 3))" should set the property value -Fail e.style['color'] = "color(srgb calc(50%) 50% 0.5)" should set the property value -Fail e.style['color'] = "color(srgb none none none / none)" should set the property value -Fail e.style['color'] = "color(srgb none none none)" should set the property value -Fail e.style['color'] = "color(srgb 10% none none / none)" should set the property value -Fail e.style['color'] = "color(srgb none none none / 0.5)" should set the property value -Fail e.style['color'] = "color(srgb 0 0 0 / none)" should set the property value -Fail e.style['color'] = "color(srgb 0 calc(infinity) 0)" should set the property value -Fail e.style['color'] = "color(srgb 0 calc(-infinity) 0)" should set the property value -Fail e.style['color'] = "color(srgb calc(NaN) 0 0)" should set the property value +Pass e.style['color'] = "color(srgb calc(50%) 50% 0.5)" should set the property value +Pass e.style['color'] = "color(srgb none none none / none)" should set the property value +Pass e.style['color'] = "color(srgb none none none)" should set the property value +Pass e.style['color'] = "color(srgb 10% none none / none)" should set the property value +Pass e.style['color'] = "color(srgb none none none / 0.5)" should set the property value +Pass e.style['color'] = "color(srgb 0 0 0 / none)" should set the property value +Pass e.style['color'] = "color(srgb 0 calc(infinity) 0)" should set the property value +Pass e.style['color'] = "color(srgb 0 calc(-infinity) 0)" should set the property value +Pass e.style['color'] = "color(srgb calc(NaN) 0 0)" should set the property value Fail e.style['color'] = "color(srgb calc(0 / 0) 0 0)" should set the property value Fail e.style['color'] = "color(srgb calc(50% + (sign(1em - 10px) * 10%)) 0 0 / 0.5)" should set the property value Fail e.style['color'] = "color(srgb 0.5 0 0 / calc(50% + (sign(1em - 10px) * 10%)))" should set the property value @@ -60,15 +60,15 @@ Pass e.style['color'] = "color(srgb-linear 200% 200% 200% / 200%)" should set th Pass e.style['color'] = "color(srgb-linear -200% -200% -200% / -200%)" should set the property value Fail e.style['color'] = "color(srgb-linear calc(0.5 + 1) calc(0.5 - 1) calc(0.5) / calc(-0.5 + 1))" should set the property value Fail e.style['color'] = "color(srgb-linear calc(50% * 3) calc(-150% / 3) calc(50%) / calc(-50% * 3))" should set the property value -Fail e.style['color'] = "color(srgb-linear calc(50%) 50% 0.5)" should set the property value -Fail e.style['color'] = "color(srgb-linear none none none / none)" should set the property value -Fail e.style['color'] = "color(srgb-linear none none none)" should set the property value -Fail e.style['color'] = "color(srgb-linear 10% none none / none)" should set the property value -Fail e.style['color'] = "color(srgb-linear none none none / 0.5)" should set the property value -Fail e.style['color'] = "color(srgb-linear 0 0 0 / none)" should set the property value -Fail e.style['color'] = "color(srgb-linear 0 calc(infinity) 0)" should set the property value -Fail e.style['color'] = "color(srgb-linear 0 calc(-infinity) 0)" should set the property value -Fail e.style['color'] = "color(srgb-linear calc(NaN) 0 0)" should set the property value +Pass e.style['color'] = "color(srgb-linear calc(50%) 50% 0.5)" should set the property value +Pass e.style['color'] = "color(srgb-linear none none none / none)" should set the property value +Pass e.style['color'] = "color(srgb-linear none none none)" should set the property value +Pass e.style['color'] = "color(srgb-linear 10% none none / none)" should set the property value +Pass e.style['color'] = "color(srgb-linear none none none / 0.5)" should set the property value +Pass e.style['color'] = "color(srgb-linear 0 0 0 / none)" should set the property value +Pass e.style['color'] = "color(srgb-linear 0 calc(infinity) 0)" should set the property value +Pass e.style['color'] = "color(srgb-linear 0 calc(-infinity) 0)" should set the property value +Pass e.style['color'] = "color(srgb-linear calc(NaN) 0 0)" should set the property value Fail e.style['color'] = "color(srgb-linear calc(0 / 0) 0 0)" should set the property value Fail e.style['color'] = "color(srgb-linear calc(50% + (sign(1em - 10px) * 10%)) 0 0 / 0.5)" should set the property value Fail e.style['color'] = "color(srgb-linear 0.5 0 0 / calc(50% + (sign(1em - 10px) * 10%)))" should set the property value @@ -94,15 +94,15 @@ Pass e.style['color'] = "color(a98-rgb 200% 200% 200% / 200%)" should set the pr Pass e.style['color'] = "color(a98-rgb -200% -200% -200% / -200%)" should set the property value Fail e.style['color'] = "color(a98-rgb calc(0.5 + 1) calc(0.5 - 1) calc(0.5) / calc(-0.5 + 1))" should set the property value Fail e.style['color'] = "color(a98-rgb calc(50% * 3) calc(-150% / 3) calc(50%) / calc(-50% * 3))" should set the property value -Fail e.style['color'] = "color(a98-rgb calc(50%) 50% 0.5)" should set the property value -Fail e.style['color'] = "color(a98-rgb none none none / none)" should set the property value -Fail e.style['color'] = "color(a98-rgb none none none)" should set the property value -Fail e.style['color'] = "color(a98-rgb 10% none none / none)" should set the property value -Fail e.style['color'] = "color(a98-rgb none none none / 0.5)" should set the property value -Fail e.style['color'] = "color(a98-rgb 0 0 0 / none)" should set the property value -Fail e.style['color'] = "color(a98-rgb 0 calc(infinity) 0)" should set the property value -Fail e.style['color'] = "color(a98-rgb 0 calc(-infinity) 0)" should set the property value -Fail e.style['color'] = "color(a98-rgb calc(NaN) 0 0)" should set the property value +Pass e.style['color'] = "color(a98-rgb calc(50%) 50% 0.5)" should set the property value +Pass e.style['color'] = "color(a98-rgb none none none / none)" should set the property value +Pass e.style['color'] = "color(a98-rgb none none none)" should set the property value +Pass e.style['color'] = "color(a98-rgb 10% none none / none)" should set the property value +Pass e.style['color'] = "color(a98-rgb none none none / 0.5)" should set the property value +Pass e.style['color'] = "color(a98-rgb 0 0 0 / none)" should set the property value +Pass e.style['color'] = "color(a98-rgb 0 calc(infinity) 0)" should set the property value +Pass e.style['color'] = "color(a98-rgb 0 calc(-infinity) 0)" should set the property value +Pass e.style['color'] = "color(a98-rgb calc(NaN) 0 0)" should set the property value Fail e.style['color'] = "color(a98-rgb calc(0 / 0) 0 0)" should set the property value Fail e.style['color'] = "color(a98-rgb calc(50% + (sign(1em - 10px) * 10%)) 0 0 / 0.5)" should set the property value Fail e.style['color'] = "color(a98-rgb 0.5 0 0 / calc(50% + (sign(1em - 10px) * 10%)))" should set the property value @@ -128,15 +128,15 @@ Pass e.style['color'] = "color(rec2020 200% 200% 200% / 200%)" should set the pr Pass e.style['color'] = "color(rec2020 -200% -200% -200% / -200%)" should set the property value Fail e.style['color'] = "color(rec2020 calc(0.5 + 1) calc(0.5 - 1) calc(0.5) / calc(-0.5 + 1))" should set the property value Fail e.style['color'] = "color(rec2020 calc(50% * 3) calc(-150% / 3) calc(50%) / calc(-50% * 3))" should set the property value -Fail e.style['color'] = "color(rec2020 calc(50%) 50% 0.5)" should set the property value -Fail e.style['color'] = "color(rec2020 none none none / none)" should set the property value -Fail e.style['color'] = "color(rec2020 none none none)" should set the property value -Fail e.style['color'] = "color(rec2020 10% none none / none)" should set the property value -Fail e.style['color'] = "color(rec2020 none none none / 0.5)" should set the property value -Fail e.style['color'] = "color(rec2020 0 0 0 / none)" should set the property value -Fail e.style['color'] = "color(rec2020 0 calc(infinity) 0)" should set the property value -Fail e.style['color'] = "color(rec2020 0 calc(-infinity) 0)" should set the property value -Fail e.style['color'] = "color(rec2020 calc(NaN) 0 0)" should set the property value +Pass e.style['color'] = "color(rec2020 calc(50%) 50% 0.5)" should set the property value +Pass e.style['color'] = "color(rec2020 none none none / none)" should set the property value +Pass e.style['color'] = "color(rec2020 none none none)" should set the property value +Pass e.style['color'] = "color(rec2020 10% none none / none)" should set the property value +Pass e.style['color'] = "color(rec2020 none none none / 0.5)" should set the property value +Pass e.style['color'] = "color(rec2020 0 0 0 / none)" should set the property value +Pass e.style['color'] = "color(rec2020 0 calc(infinity) 0)" should set the property value +Pass e.style['color'] = "color(rec2020 0 calc(-infinity) 0)" should set the property value +Pass e.style['color'] = "color(rec2020 calc(NaN) 0 0)" should set the property value Fail e.style['color'] = "color(rec2020 calc(0 / 0) 0 0)" should set the property value Fail e.style['color'] = "color(rec2020 calc(50% + (sign(1em - 10px) * 10%)) 0 0 / 0.5)" should set the property value Fail e.style['color'] = "color(rec2020 0.5 0 0 / calc(50% + (sign(1em - 10px) * 10%)))" should set the property value @@ -162,15 +162,15 @@ Pass e.style['color'] = "color(prophoto-rgb 200% 200% 200% / 200%)" should set t Pass e.style['color'] = "color(prophoto-rgb -200% -200% -200% / -200%)" should set the property value Fail e.style['color'] = "color(prophoto-rgb calc(0.5 + 1) calc(0.5 - 1) calc(0.5) / calc(-0.5 + 1))" should set the property value Fail e.style['color'] = "color(prophoto-rgb calc(50% * 3) calc(-150% / 3) calc(50%) / calc(-50% * 3))" should set the property value -Fail e.style['color'] = "color(prophoto-rgb calc(50%) 50% 0.5)" should set the property value -Fail e.style['color'] = "color(prophoto-rgb none none none / none)" should set the property value -Fail e.style['color'] = "color(prophoto-rgb none none none)" should set the property value -Fail e.style['color'] = "color(prophoto-rgb 10% none none / none)" should set the property value -Fail e.style['color'] = "color(prophoto-rgb none none none / 0.5)" should set the property value -Fail e.style['color'] = "color(prophoto-rgb 0 0 0 / none)" should set the property value -Fail e.style['color'] = "color(prophoto-rgb 0 calc(infinity) 0)" should set the property value -Fail e.style['color'] = "color(prophoto-rgb 0 calc(-infinity) 0)" should set the property value -Fail e.style['color'] = "color(prophoto-rgb calc(NaN) 0 0)" should set the property value +Pass e.style['color'] = "color(prophoto-rgb calc(50%) 50% 0.5)" should set the property value +Pass e.style['color'] = "color(prophoto-rgb none none none / none)" should set the property value +Pass e.style['color'] = "color(prophoto-rgb none none none)" should set the property value +Pass e.style['color'] = "color(prophoto-rgb 10% none none / none)" should set the property value +Pass e.style['color'] = "color(prophoto-rgb none none none / 0.5)" should set the property value +Pass e.style['color'] = "color(prophoto-rgb 0 0 0 / none)" should set the property value +Pass e.style['color'] = "color(prophoto-rgb 0 calc(infinity) 0)" should set the property value +Pass e.style['color'] = "color(prophoto-rgb 0 calc(-infinity) 0)" should set the property value +Pass e.style['color'] = "color(prophoto-rgb calc(NaN) 0 0)" should set the property value Fail e.style['color'] = "color(prophoto-rgb calc(0 / 0) 0 0)" should set the property value Fail e.style['color'] = "color(prophoto-rgb calc(50% + (sign(1em - 10px) * 10%)) 0 0 / 0.5)" should set the property value Fail e.style['color'] = "color(prophoto-rgb 0.5 0 0 / calc(50% + (sign(1em - 10px) * 10%)))" should set the property value @@ -196,15 +196,15 @@ Pass e.style['color'] = "color(display-p3 200% 200% 200% / 200%)" should set the Pass e.style['color'] = "color(display-p3 -200% -200% -200% / -200%)" should set the property value Fail e.style['color'] = "color(display-p3 calc(0.5 + 1) calc(0.5 - 1) calc(0.5) / calc(-0.5 + 1))" should set the property value Fail e.style['color'] = "color(display-p3 calc(50% * 3) calc(-150% / 3) calc(50%) / calc(-50% * 3))" should set the property value -Fail e.style['color'] = "color(display-p3 calc(50%) 50% 0.5)" should set the property value -Fail e.style['color'] = "color(display-p3 none none none / none)" should set the property value -Fail e.style['color'] = "color(display-p3 none none none)" should set the property value -Fail e.style['color'] = "color(display-p3 10% none none / none)" should set the property value -Fail e.style['color'] = "color(display-p3 none none none / 0.5)" should set the property value -Fail e.style['color'] = "color(display-p3 0 0 0 / none)" should set the property value -Fail e.style['color'] = "color(display-p3 0 calc(infinity) 0)" should set the property value -Fail e.style['color'] = "color(display-p3 0 calc(-infinity) 0)" should set the property value -Fail e.style['color'] = "color(display-p3 calc(NaN) 0 0)" should set the property value +Pass e.style['color'] = "color(display-p3 calc(50%) 50% 0.5)" should set the property value +Pass e.style['color'] = "color(display-p3 none none none / none)" should set the property value +Pass e.style['color'] = "color(display-p3 none none none)" should set the property value +Pass e.style['color'] = "color(display-p3 10% none none / none)" should set the property value +Pass e.style['color'] = "color(display-p3 none none none / 0.5)" should set the property value +Pass e.style['color'] = "color(display-p3 0 0 0 / none)" should set the property value +Pass e.style['color'] = "color(display-p3 0 calc(infinity) 0)" should set the property value +Pass e.style['color'] = "color(display-p3 0 calc(-infinity) 0)" should set the property value +Pass e.style['color'] = "color(display-p3 calc(NaN) 0 0)" should set the property value Fail e.style['color'] = "color(display-p3 calc(0 / 0) 0 0)" should set the property value Fail e.style['color'] = "color(display-p3 calc(50% + (sign(1em - 10px) * 10%)) 0 0 / 0.5)" should set the property value Fail e.style['color'] = "color(display-p3 0.5 0 0 / calc(50% + (sign(1em - 10px) * 10%)))" should set the property value @@ -230,15 +230,15 @@ Pass e.style['color'] = "color(xyz 200% 200% 200% / 200%)" should set the proper Pass e.style['color'] = "color(xyz -200% -200% -200% / -200%)" should set the property value Fail e.style['color'] = "color(xyz calc(0.5 + 1) calc(0.5 - 1) calc(0.5) / calc(-0.5 + 1))" should set the property value Fail e.style['color'] = "color(xyz calc(50% * 3) calc(-150% / 3) calc(50%) / calc(-50% * 3))" should set the property value -Fail e.style['color'] = "color(xyz calc(50%) 50% 0.5)" should set the property value -Fail e.style['color'] = "color(xyz none none none / none)" should set the property value -Fail e.style['color'] = "color(xyz none none none)" should set the property value -Fail e.style['color'] = "color(xyz 10% none none / none)" should set the property value -Fail e.style['color'] = "color(xyz none none none / 0.5)" should set the property value -Fail e.style['color'] = "color(xyz 0 0 0 / none)" should set the property value -Fail e.style['color'] = "color(xyz 0 calc(infinity) 0)" should set the property value -Fail e.style['color'] = "color(xyz 0 calc(-infinity) 0)" should set the property value -Fail e.style['color'] = "color(xyz calc(NaN) 0 0)" should set the property value +Pass e.style['color'] = "color(xyz calc(50%) 50% 0.5)" should set the property value +Pass e.style['color'] = "color(xyz none none none / none)" should set the property value +Pass e.style['color'] = "color(xyz none none none)" should set the property value +Pass e.style['color'] = "color(xyz 10% none none / none)" should set the property value +Pass e.style['color'] = "color(xyz none none none / 0.5)" should set the property value +Pass e.style['color'] = "color(xyz 0 0 0 / none)" should set the property value +Pass e.style['color'] = "color(xyz 0 calc(infinity) 0)" should set the property value +Pass e.style['color'] = "color(xyz 0 calc(-infinity) 0)" should set the property value +Pass e.style['color'] = "color(xyz calc(NaN) 0 0)" should set the property value Fail e.style['color'] = "color(xyz calc(0 / 0) 0 0)" should set the property value Fail e.style['color'] = "color(xyz calc(50% + (sign(1em - 10px) * 10%)) 0 0 / 0.5)" should set the property value Fail e.style['color'] = "color(xyz 0.5 0 0 / calc(50% + (sign(1em - 10px) * 10%)))" should set the property value @@ -264,15 +264,15 @@ Pass e.style['color'] = "color(xyz-d50 200% 200% 200% / 200%)" should set the pr Pass e.style['color'] = "color(xyz-d50 -200% -200% -200% / -200%)" should set the property value Fail e.style['color'] = "color(xyz-d50 calc(0.5 + 1) calc(0.5 - 1) calc(0.5) / calc(-0.5 + 1))" should set the property value Fail e.style['color'] = "color(xyz-d50 calc(50% * 3) calc(-150% / 3) calc(50%) / calc(-50% * 3))" should set the property value -Fail e.style['color'] = "color(xyz-d50 calc(50%) 50% 0.5)" should set the property value -Fail e.style['color'] = "color(xyz-d50 none none none / none)" should set the property value -Fail e.style['color'] = "color(xyz-d50 none none none)" should set the property value -Fail e.style['color'] = "color(xyz-d50 10% none none / none)" should set the property value -Fail e.style['color'] = "color(xyz-d50 none none none / 0.5)" should set the property value -Fail e.style['color'] = "color(xyz-d50 0 0 0 / none)" should set the property value -Fail e.style['color'] = "color(xyz-d50 0 calc(infinity) 0)" should set the property value -Fail e.style['color'] = "color(xyz-d50 0 calc(-infinity) 0)" should set the property value -Fail e.style['color'] = "color(xyz-d50 calc(NaN) 0 0)" should set the property value +Pass e.style['color'] = "color(xyz-d50 calc(50%) 50% 0.5)" should set the property value +Pass e.style['color'] = "color(xyz-d50 none none none / none)" should set the property value +Pass e.style['color'] = "color(xyz-d50 none none none)" should set the property value +Pass e.style['color'] = "color(xyz-d50 10% none none / none)" should set the property value +Pass e.style['color'] = "color(xyz-d50 none none none / 0.5)" should set the property value +Pass e.style['color'] = "color(xyz-d50 0 0 0 / none)" should set the property value +Pass e.style['color'] = "color(xyz-d50 0 calc(infinity) 0)" should set the property value +Pass e.style['color'] = "color(xyz-d50 0 calc(-infinity) 0)" should set the property value +Pass e.style['color'] = "color(xyz-d50 calc(NaN) 0 0)" should set the property value Fail e.style['color'] = "color(xyz-d50 calc(0 / 0) 0 0)" should set the property value Fail e.style['color'] = "color(xyz-d50 calc(50% + (sign(1em - 10px) * 10%)) 0 0 / 0.5)" should set the property value Fail e.style['color'] = "color(xyz-d50 0.5 0 0 / calc(50% + (sign(1em - 10px) * 10%)))" should set the property value @@ -298,15 +298,15 @@ Pass e.style['color'] = "color(xyz-d65 200% 200% 200% / 200%)" should set the pr Pass e.style['color'] = "color(xyz-d65 -200% -200% -200% / -200%)" should set the property value Fail e.style['color'] = "color(xyz-d65 calc(0.5 + 1) calc(0.5 - 1) calc(0.5) / calc(-0.5 + 1))" should set the property value Fail e.style['color'] = "color(xyz-d65 calc(50% * 3) calc(-150% / 3) calc(50%) / calc(-50% * 3))" should set the property value -Fail e.style['color'] = "color(xyz-d65 calc(50%) 50% 0.5)" should set the property value -Fail e.style['color'] = "color(xyz-d65 none none none / none)" should set the property value -Fail e.style['color'] = "color(xyz-d65 none none none)" should set the property value -Fail e.style['color'] = "color(xyz-d65 10% none none / none)" should set the property value -Fail e.style['color'] = "color(xyz-d65 none none none / 0.5)" should set the property value -Fail e.style['color'] = "color(xyz-d65 0 0 0 / none)" should set the property value -Fail e.style['color'] = "color(xyz-d65 0 calc(infinity) 0)" should set the property value -Fail e.style['color'] = "color(xyz-d65 0 calc(-infinity) 0)" should set the property value -Fail e.style['color'] = "color(xyz-d65 calc(NaN) 0 0)" should set the property value +Pass e.style['color'] = "color(xyz-d65 calc(50%) 50% 0.5)" should set the property value +Pass e.style['color'] = "color(xyz-d65 none none none / none)" should set the property value +Pass e.style['color'] = "color(xyz-d65 none none none)" should set the property value +Pass e.style['color'] = "color(xyz-d65 10% none none / none)" should set the property value +Pass e.style['color'] = "color(xyz-d65 none none none / 0.5)" should set the property value +Pass e.style['color'] = "color(xyz-d65 0 0 0 / none)" should set the property value +Pass e.style['color'] = "color(xyz-d65 0 calc(infinity) 0)" should set the property value +Pass e.style['color'] = "color(xyz-d65 0 calc(-infinity) 0)" should set the property value +Pass e.style['color'] = "color(xyz-d65 calc(NaN) 0 0)" should set the property value Fail e.style['color'] = "color(xyz-d65 calc(0 / 0) 0 0)" should set the property value Fail e.style['color'] = "color(xyz-d65 calc(50% + (sign(1em - 10px) * 10%)) 0 0 / 0.5)" should set the property value Fail e.style['color'] = "color(xyz-d65 0.5 0 0 / calc(50% + (sign(1em - 10px) * 10%)))" should set the property value \ No newline at end of file