Title: [278268] trunk
Revision
278268
Author
wei...@apple.com
Date
2021-05-30 20:44:27 -0700 (Sun, 30 May 2021)

Log Message

Remove support for no longer specific color(lab ...) syntax
https://bugs.webkit.org/show_bug.cgi?id=226439

Reviewed by Darin Adler.

Source/WebCore:

Remove support for parsing the color(lab ...) syntax.

* css/parser/CSSPropertyParserHelpers.cpp:
(WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters):
(WebCore::CSSPropertyParserHelpers::parseColorFunctionForLabParameters): Deleted.

LayoutTests:

Remove test cases for color(lab) (keeping one to ensure it doesn't
work) and update uses of color(lab ...) to use lab(...) instead.

* fast/css/parsing-lab-colors-expected.txt:
* fast/css/parsing-lab-colors.html:
* fast/css/parsing-relative-color-syntax-expected.txt:
* fast/css/parsing-relative-color-syntax.html:
* TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (278267 => 278268)


--- trunk/LayoutTests/ChangeLog	2021-05-31 03:09:59 UTC (rev 278267)
+++ trunk/LayoutTests/ChangeLog	2021-05-31 03:44:27 UTC (rev 278268)
@@ -1,5 +1,21 @@
 2021-05-30  Sam Weinig  <wei...@apple.com>
 
+        Remove support for no longer specific color(lab ...) syntax
+        https://bugs.webkit.org/show_bug.cgi?id=226439
+
+        Reviewed by Darin Adler.
+
+        Remove test cases for color(lab) (keeping one to ensure it doesn't
+        work) and update uses of color(lab ...) to use lab(...) instead. 
+
+        * fast/css/parsing-lab-colors-expected.txt:
+        * fast/css/parsing-lab-colors.html:
+        * fast/css/parsing-relative-color-syntax-expected.txt:
+        * fast/css/parsing-relative-color-syntax.html:
+        * TestExpectations:
+
+2021-05-30  Sam Weinig  <wei...@apple.com>
+
         Add additional target luminance keywords for color-contrast() added for https://github.com/w3c/csswg-drafts/issues/6311
         https://bugs.webkit.org/show_bug.cgi?id=226438
 

Modified: trunk/LayoutTests/TestExpectations (278267 => 278268)


--- trunk/LayoutTests/TestExpectations	2021-05-31 03:09:59 UTC (rev 278267)
+++ trunk/LayoutTests/TestExpectations	2021-05-31 03:44:27 UTC (rev 278268)
@@ -4883,3 +4883,6 @@
 # Skip WebXR while flakey
 imported/w3c/web-platform-tests/webxr [ Skip ]
 http/wpt/webxr [ Skip ]
+
+# Invalid test. Tests color(lab ...) which has been removed from the standard.
+imported/w3c/web-platform-tests/css/css-color/predefined-013.html [ Skip ]

Modified: trunk/LayoutTests/fast/css/parsing-lab-colors-expected.txt (278267 => 278268)


--- trunk/LayoutTests/fast/css/parsing-lab-colors-expected.txt	2021-05-31 03:09:59 UTC (rev 278267)
+++ trunk/LayoutTests/fast/css/parsing-lab-colors-expected.txt	2021-05-31 03:44:27 UTC (rev 278268)
@@ -1,4 +1,4 @@
-Test the parsing of lab(...), lch(...) and color(lab ...) colors.
+Test the parsing of lab(...) and lch(...) colors.
 
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
@@ -39,28 +39,6 @@
 PASS computedStyle("background-color", "lch(10% 20 20 / 110%)") is "lch(10% 20 20)"
 PASS computedStyle("background-color", "lch(10% 20 -700)") is "lch(10% 20 20)"
 
-color(lab )
-PASS computedStyle("background-color", "color(lab 0% 0 0)") is "color(lab 0% 0 0)"
-PASS computedStyle("background-color", "color(lab 0% 0 0 / 1)") is "color(lab 0% 0 0)"
-PASS computedStyle("background-color", "color(lab 0% 0 0 / 0.5)") is "color(lab 0% 0 0 / 0.5)"
-PASS computedStyle("background-color", "color(lab 20% 0 10/0.5)") is "color(lab 20% 0 10 / 0.5)"
-PASS computedStyle("background-color", "color(lab 20% 0 10/50%)") is "color(lab 20% 0 10 / 0.5)"
-PASS computedStyle("background-color", "color(lab 400% 0 10/50%)") is "color(lab 400% 0 10 / 0.5)"
-PASS computedStyle("background-color", "color(lab 50% -160 160)") is "color(lab 50% -160 160)"
-PASS computedStyle("background-color", "color(lab 50% -200 200)") is "color(lab 50% -200 200)"
-PASS computedStyle("background-color", "color(lab 0% 0 0 / -10%)") is "color(lab 0% 0 0 / 0)"
-PASS computedStyle("background-color", "color(lab 0% 0 0 / 110%)") is "color(lab 0% 0 0)"
-PASS computedStyle("background-color", "color(lab 0% 0 0 / 300%)") is "color(lab 0% 0 0)"
-PASS computedStyle("background-color", "color(lab 50% -200)") is "color(lab 50% -200 0)"
-PASS computedStyle("background-color", "color(lab 50%)") is "color(lab 50% 0 0)"
-PASS computedStyle("background-color", "color(lab)") is "color(lab 0% 0 0)"
-PASS computedStyle("background-color", "color(lab 50% -200 / 0.5)") is "color(lab 50% -200 0 / 0.5)"
-PASS computedStyle("background-color", "color(lab 50% / 0.5)") is "color(lab 50% 0 0 / 0.5)"
-PASS computedStyle("background-color", "color(lab / 0.5)") is "color(lab 0% 0 0 / 0.5)"
-PASS computedStyle("background-color", "color(lab -40% 0 0)") is "color(lab 0% 0 0)"
-PASS computedStyle("background-color", "color(lab 50% -20 0)") is "color(lab 50% -20 0)"
-PASS computedStyle("background-color", "color(lab 50% 0 -20)") is "color(lab 50% 0 -20)"
-
 Test invalid values
 PASS computedStyle("background-color", "lab(0 0 0)") is "rgba(0, 0, 0, 0)"
 PASS computedStyle("background-color", "lab(0% 0% 0)") is "rgba(0, 0, 0, 0)"
@@ -72,13 +50,7 @@
 PASS computedStyle("background-color", "lch(0 0 0 / 0.5)") is "rgba(0, 0, 0, 0)"
 PASS computedStyle("background-color", "lch(20% 10 10deg 10)") is "rgba(0, 0, 0, 0)"
 PASS computedStyle("background-color", "lch(20% 10 10deg 10 / 0.5)") is "rgba(0, 0, 0, 0)"
-PASS computedStyle("background-color", "color(lab 0 0 0)") is "rgba(0, 0, 0, 0)"
-PASS computedStyle("background-color", "color(lab 0% 0% 0)") is "rgba(0, 0, 0, 0)"
-PASS computedStyle("background-color", "color(lab 0% 0 0 1)") is "rgba(0, 0, 0, 0)"
-PASS computedStyle("background-color", "color(lab 0% 0 0 10%)") is "rgba(0, 0, 0, 0)"
-PASS computedStyle("background-color", "color(lab 0% 0 0deg)") is "rgba(0, 0, 0, 0)"
-PASS computedStyle("background-color", "color(lab 0% 0% 0deg)") is "rgba(0, 0, 0, 0)"
-PASS computedStyle("background-color", "color(lab 40% 0 0deg)") is "rgba(0, 0, 0, 0)"
+PASS computedStyle("background-color", "color(lab 20% 0 10 / 50%)") is "rgba(0, 0, 0, 0)"
 PASS successfullyParsed is true
 
 TEST COMPLETE

Modified: trunk/LayoutTests/fast/css/parsing-lab-colors.html (278267 => 278268)


--- trunk/LayoutTests/fast/css/parsing-lab-colors.html	2021-05-31 03:09:59 UTC (rev 278267)
+++ trunk/LayoutTests/fast/css/parsing-lab-colors.html	2021-05-31 03:44:27 UTC (rev 278268)
@@ -3,7 +3,7 @@
 </head>
 <body>
 <script>
-    description("Test the parsing of lab(...), lch(...) and color(lab ...) colors.");
+    description("Test the parsing of lab(...) and lch(...) colors.");
 
     function computedStyle(property, value)
     {
@@ -73,29 +73,6 @@
     testComputed("background-color", "lch(10% 20 -700)", "lch(10% 20 20)");
 
     debug('');
-    debug('color(lab )');
-    testComputed("background-color", "color(lab 0% 0 0)", "color(lab 0% 0 0)");
-    testComputed("background-color", "color(lab 0% 0 0 / 1)", "color(lab 0% 0 0)");
-    testComputed("background-color", "color(lab 0% 0 0 / 0.5)", "color(lab 0% 0 0 / 0.5)");
-    testComputed("background-color", "color(lab 20% 0 10/0.5)", "color(lab 20% 0 10 / 0.5)");
-    testComputed("background-color", "color(lab 20% 0 10/50%)", "color(lab 20% 0 10 / 0.5)");
-    testComputed("background-color", "color(lab 400% 0 10/50%)", "color(lab 400% 0 10 / 0.5)");
-    testComputed("background-color", "color(lab 50% -160 160)", "color(lab 50% -160 160)");
-    testComputed("background-color", "color(lab 50% -200 200)", "color(lab 50% -200 200)");
-    testComputed("background-color", "color(lab 0% 0 0 / -10%)", "color(lab 0% 0 0 / 0)");
-    testComputed("background-color", "color(lab 0% 0 0 / 110%)", "color(lab 0% 0 0)");
-    testComputed("background-color", "color(lab 0% 0 0 / 300%)", "color(lab 0% 0 0)");
-    testComputed("background-color", "color(lab 50% -200)", "color(lab 50% -200 0)");
-    testComputed("background-color", "color(lab 50%)", "color(lab 50% 0 0)");
-    testComputed("background-color", "color(lab)", "color(lab 0% 0 0)");
-    testComputed("background-color", "color(lab 50% -200 / 0.5)", "color(lab 50% -200 0 / 0.5)");
-    testComputed("background-color", "color(lab 50% / 0.5)", "color(lab 50% 0 0 / 0.5)");
-    testComputed("background-color", "color(lab / 0.5)", "color(lab 0% 0 0 / 0.5)");
-    testComputed("background-color", "color(lab -40% 0 0)", "color(lab 0% 0 0)");
-    testComputed("background-color", "color(lab 50% -20 0)", "color(lab 50% -20 0)");
-    testComputed("background-color", "color(lab 50% 0 -20)", "color(lab 50% 0 -20)");
-
-    debug('');
     debug('Test invalid values');
     testComputed("background-color", "lab(0 0 0)", "rgba(0, 0, 0, 0)");
     testComputed("background-color", "lab(0% 0% 0)", "rgba(0, 0, 0, 0)");
@@ -109,13 +86,7 @@
     testComputed("background-color", "lch(20% 10 10deg 10)", "rgba(0, 0, 0, 0)");
     testComputed("background-color", "lch(20% 10 10deg 10 / 0.5)", "rgba(0, 0, 0, 0)");
 
-    testComputed("background-color", "color(lab 0 0 0)", "rgba(0, 0, 0, 0)");
-    testComputed("background-color", "color(lab 0% 0% 0)", "rgba(0, 0, 0, 0)");
-    testComputed("background-color", "color(lab 0% 0 0 1)", "rgba(0, 0, 0, 0)");
-    testComputed("background-color", "color(lab 0% 0 0 10%)", "rgba(0, 0, 0, 0)");
-    testComputed("background-color", "color(lab 0% 0 0deg)", "rgba(0, 0, 0, 0)");
-    testComputed("background-color", "color(lab 0% 0% 0deg)", "rgba(0, 0, 0, 0)");
-    testComputed("background-color", "color(lab 40% 0 0deg)", "rgba(0, 0, 0, 0)");
+    testComputed("background-color", "color(lab 20% 0 10 / 50%)", "rgba(0, 0, 0, 0)");
 
 </script>
     

Modified: trunk/LayoutTests/fast/css/parsing-relative-color-syntax-expected.txt (278267 => 278268)


--- trunk/LayoutTests/fast/css/parsing-relative-color-syntax-expected.txt	2021-05-31 03:09:59 UTC (rev 278267)
+++ trunk/LayoutTests/fast/css/parsing-relative-color-syntax-expected.txt	2021-05-31 03:44:27 UTC (rev 278268)
@@ -235,7 +235,7 @@
 PASS computedStyle("background-color", "lch(from lch(70% 45 30 / 40%) l c h/ alpha)") is "lch(70% 45 30 / 0.4)"
 PASS computedStyle("background-color", "lch(from lch(from lch(70% 45 30) l c h) l c h)") is "lch(70% 45 30)"
 PASS computedStyle("background-color", "lch(from color(display-p3 0 0 0) l c h / alpha)") is "lch(0% 0 0)"
-PASS computedStyle("background-color", "lch(from color(lab 70% 45 30) l c h / alpha)") is "lch(70% 54.08327 33.690067)"
+PASS computedStyle("background-color", "lch(from lab(70% 45 30) l c h / alpha)") is "lch(70% 54.08327 33.690067)"
 PASS computedStyle("background-color", "lch(from lch(70% 45 30) 0% 0 0)") is "lch(0% 0 0)"
 PASS computedStyle("background-color", "lch(from lch(70% 45 30) 0% 0 0deg)") is "lch(0% 0 0)"
 PASS computedStyle("background-color", "lch(from lch(70% 45 30) 0% 0 0 / 0)") is "lch(0% 0 0 / 0)"

Modified: trunk/LayoutTests/fast/css/parsing-relative-color-syntax.html (278267 => 278268)


--- trunk/LayoutTests/fast/css/parsing-relative-color-syntax.html	2021-05-31 03:09:59 UTC (rev 278267)
+++ trunk/LayoutTests/fast/css/parsing-relative-color-syntax.html	2021-05-31 03:44:27 UTC (rev 278268)
@@ -377,7 +377,7 @@
 
     // Testing non-sRGB origin colors to see gamut clipping.
     testComputed(`lch(from color(display-p3 0 0 0) l c h / alpha)`, `lch(0% 0 0)`);
-    testComputed(`lch(from color(lab 70% 45 30) l c h / alpha)`, `lch(70% 54.08327 33.690067)`);
+    testComputed(`lch(from lab(70% 45 30) l c h / alpha)`, `lch(70% 54.08327 33.690067)`);
 
     // Testing replacement with 0.
     testComputed(`lch(from lch(70% 45 30) 0% 0 0)`, `lch(0% 0 0)`);

Modified: trunk/Source/WebCore/ChangeLog (278267 => 278268)


--- trunk/Source/WebCore/ChangeLog	2021-05-31 03:09:59 UTC (rev 278267)
+++ trunk/Source/WebCore/ChangeLog	2021-05-31 03:44:27 UTC (rev 278268)
@@ -1,3 +1,16 @@
+2021-05-30  Sam Weinig  <wei...@apple.com>
+
+        Remove support for no longer specific color(lab ...) syntax
+        https://bugs.webkit.org/show_bug.cgi?id=226439
+
+        Reviewed by Darin Adler.
+
+        Remove support for parsing the color(lab ...) syntax.
+
+        * css/parser/CSSPropertyParserHelpers.cpp:
+        (WebCore::CSSPropertyParserHelpers::parseColorFunctionParameters):
+        (WebCore::CSSPropertyParserHelpers::parseColorFunctionForLabParameters): Deleted.
+
 2021-05-30  Cameron McCormack  <hey...@apple.com>
 
         Fix some comment typos

Modified: trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp (278267 => 278268)


--- trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp	2021-05-31 03:09:59 UTC (rev 278267)
+++ trunk/Source/WebCore/css/parser/CSSPropertyParserHelpers.cpp	2021-05-31 03:44:27 UTC (rev 278268)
@@ -1557,42 +1557,6 @@
     return { ColorType { clampTo<float>(channels[0], 0.0, 1.0), clampTo<float>(channels[1], 0.0, 1.0), clampTo<float>(channels[2], 0.0, 1.0), static_cast<float>(*alpha) }, Color::Flags::UseColorFunctionSerialization };
 }
 
-static Color parseColorFunctionForLabParameters(CSSParserTokenRange& args, const CSSParserContext& context)
-{
-    ASSERT(args.peek().id() == CSSValueLab);
-
-    if (!context.cssColor4)
-        return { };
-
-    consumeIdentRaw(args);
-
-    double channels[3] = { 0, 0, 0 };
-    [&] {
-        auto lightness = consumePercentRaw(args);
-        if (!lightness)
-            return;
-        channels[0] = *lightness;
-
-        auto aValue = consumeNumberRaw(args);
-        if (!aValue)
-            return;
-        channels[1] = *aValue;
-
-        auto bValue = consumeNumberRaw(args);
-        if (!bValue)
-            return;
-        channels[2] = *bValue;
-    }();
-
-    auto alpha = consumeOptionalAlpha(args);
-    if (!alpha)
-        return { };
-
-    auto normalizedLightness = std::max(0.0, channels[0]);
-
-    return { Lab<float> { static_cast<float>(normalizedLightness), static_cast<float>(channels[1]), static_cast<float>(channels[2]), static_cast<float>(*alpha) }, Color::Flags::UseColorFunctionSerialization };
-}
-
 static Color parseColorFunctionForXYZParameters(CSSParserTokenRange& args, const CSSParserContext& context)
 {
     ASSERT(args.peek().id() == CSSValueXyz);
@@ -1640,9 +1604,6 @@
     case CSSValueDisplayP3:
         color = parseColorFunctionForRGBTypes<DisplayP3<float>>(args, context);
         break;
-    case CSSValueLab:
-        color = parseColorFunctionForLabParameters(args, context);
-        break;
     case CSSValueProphotoRgb:
         color = parseColorFunctionForRGBTypes<ProPhotoRGB<float>>(args, context);
         break;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to