Title: [278648] trunk
Revision
278648
Author
[email protected]
Date
2021-06-08 22:07:27 -0700 (Tue, 08 Jun 2021)

Log Message

CSSOM test for serializing counter() fails
https://bugs.webkit.org/show_bug.cgi?id=184256

Patch by Rob Buis <[email protected]> on 2021-06-08
Reviewed by Sam Weinig.

LayoutTests/imported/w3c:

Update improved test result.

* web-platform-tests/css/cssom/serialize-values-expected.txt:

Source/WebCore:

The last CSS component value should be omitted if it is "decimal" [1].

Behavior matches Firefox and Chrome.

[1] https://drafts.csswg.org/cssom/#serialize-a-css-component-value

* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):

LayoutTests:

Adapt to serialization change.

* fast/css/counters/counter-cssText-expected.txt:
* fast/css/counters/counter-cssText.html:
* fast/css/serialization-with-double-quotes-expected.txt:
* fast/css/serialization-with-double-quotes.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (278647 => 278648)


--- trunk/LayoutTests/ChangeLog	2021-06-09 05:03:32 UTC (rev 278647)
+++ trunk/LayoutTests/ChangeLog	2021-06-09 05:07:27 UTC (rev 278648)
@@ -1,3 +1,17 @@
+2021-06-08  Rob Buis  <[email protected]>
+
+        CSSOM test for serializing counter() fails
+        https://bugs.webkit.org/show_bug.cgi?id=184256
+
+        Reviewed by Sam Weinig.
+
+        Adapt to serialization change.
+
+        * fast/css/counters/counter-cssText-expected.txt:
+        * fast/css/counters/counter-cssText.html:
+        * fast/css/serialization-with-double-quotes-expected.txt:
+        * fast/css/serialization-with-double-quotes.html:
+
 2021-06-08  Diego Pino Garcia  <[email protected]>
 
         [GLIB] Unreviewed test gardening. Update test expectation status of imported/w3c/web-platform-tests/media-source/mediasource-changetype-play.html.

Modified: trunk/LayoutTests/fast/css/counters/counter-cssText-expected.txt (278647 => 278648)


--- trunk/LayoutTests/fast/css/counters/counter-cssText-expected.txt	2021-06-09 05:03:32 UTC (rev 278647)
+++ trunk/LayoutTests/fast/css/counters/counter-cssText-expected.txt	2021-06-09 05:07:27 UTC (rev 278648)
@@ -3,8 +3,8 @@
 On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 
 
-PASS rules[2].style.cssText is "content: counter(section, decimal);"
-PASS rules[3].style.cssText is "content: counters(section, \":\", decimal);"
+PASS rules[2].style.cssText is "content: counter(section);"
+PASS rules[3].style.cssText is "content: counters(section, \":\");"
 PASS rules[4].style.cssText is "content: counter(section, lower-roman);"
 PASS rules[5].style.cssText is "content: counters(section, \",\", upper-roman);"
 PASS rules[6].style.cssText is "content: counter(section, none);"

Modified: trunk/LayoutTests/fast/css/counters/counter-cssText.html (278647 => 278648)


--- trunk/LayoutTests/fast/css/counters/counter-cssText.html	2021-06-09 05:03:32 UTC (rev 278647)
+++ trunk/LayoutTests/fast/css/counters/counter-cssText.html	2021-06-09 05:07:27 UTC (rev 278648)
@@ -29,8 +29,8 @@
 <script>
 description("Test the cssText output of counter-valued CSSPrimitiveValues");
 var rules = document.styleSheets[0].cssRules;
-shouldBeEqualToString("rules[2].style.cssText", `content: counter(section, decimal);`);
-shouldBeEqualToString("rules[3].style.cssText", `content: counters(section, ":", decimal);`);
+shouldBeEqualToString("rules[2].style.cssText", `content: counter(section);`);
+shouldBeEqualToString("rules[3].style.cssText", `content: counters(section, ":");`);
 shouldBeEqualToString("rules[4].style.cssText", `content: counter(section, lower-roman);`);
 shouldBeEqualToString("rules[5].style.cssText", `content: counters(section, ",", upper-roman);`);
 shouldBeEqualToString("rules[6].style.cssText", `content: counter(section, none);`);

Modified: trunk/LayoutTests/fast/css/serialization-with-double-quotes-expected.txt (278647 => 278648)


--- trunk/LayoutTests/fast/css/serialization-with-double-quotes-expected.txt	2021-06-09 05:03:32 UTC (rev 278647)
+++ trunk/LayoutTests/fast/css/serialization-with-double-quotes-expected.txt	2021-06-09 05:07:27 UTC (rev 278648)
@@ -10,7 +10,7 @@
 PASS parsed = eval(value.replace(/^'/, "").replace(/'$/, "")); is "{foo: \"bar\"}"
 PASS ruleWithAttributeSelector.selectorText is "span[class=\"foo bar\"]"
 PASS getComputedStyle(document.querySelector("span[class='foo bar']")).getPropertyValue("color") is "rgb(0, 128, 0)"
-PASS counterRule.style.content is "counters(section, \".\", decimal)"
+PASS counterRule.style.content is "counters(section, \".\")"
 PASS fontFamilyRule.style.fontFamily is "\"Two Infinite Loop\", \"Cupertino CA\""
 PASS getComputedStyle(document.querySelector("article")).getPropertyValue("font-family") is "\"Two Infinite Loop\", \"Cupertino CA\""
 PASS backgroundImageRule.style.backgroundImage is "url(\"data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='100px' height='100px'><rect width='100px' height='100px' fill='lightgreen' stroke='green' stroke-width='1px'/></svg>\")"

Modified: trunk/LayoutTests/fast/css/serialization-with-double-quotes.html (278647 => 278648)


--- trunk/LayoutTests/fast/css/serialization-with-double-quotes.html	2021-06-09 05:03:32 UTC (rev 278647)
+++ trunk/LayoutTests/fast/css/serialization-with-double-quotes.html	2021-06-09 05:07:27 UTC (rev 278648)
@@ -39,7 +39,7 @@
 shouldBeEqualToString(`getComputedStyle(document.querySelector("span[class='foo bar']")).getPropertyValue("color")`, 'rgb(0, 128, 0)');
 
 var counterRule = styleSheet.rules[4];
-shouldBeEqualToString('counterRule.style.content', 'counters(section, ".", decimal)');
+shouldBeEqualToString('counterRule.style.content', 'counters(section, ".")');
 
 var fontFamilyRule = styleSheet.rules[5];
 shouldBeEqualToString('fontFamilyRule.style.fontFamily', '"Two Infinite Loop", "Cupertino CA"');

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (278647 => 278648)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-06-09 05:03:32 UTC (rev 278647)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-06-09 05:07:27 UTC (rev 278648)
@@ -1,3 +1,14 @@
+2021-06-08  Rob Buis  <[email protected]>
+
+        CSSOM test for serializing counter() fails
+        https://bugs.webkit.org/show_bug.cgi?id=184256
+
+        Reviewed by Sam Weinig.
+
+        Update improved test result.
+
+        * web-platform-tests/css/cssom/serialize-values-expected.txt:
+
 2021-06-08  Truitt Savell  <[email protected]>
 
         Unreviewed, reverting r278609.

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-values-expected.txt (278647 => 278648)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-values-expected.txt	2021-06-09 05:03:32 UTC (rev 278647)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-values-expected.txt	2021-06-09 05:07:27 UTC (rev 278648)
@@ -319,8 +319,8 @@
 PASS content: 'string'
 PASS content: url("http://localhost/")
 PASS content: url(http://localhost/)
-FAIL content: counter(par-num) assert_equals: content raw inline style declaration expected "counter(par-num)" but got "counter(par-num, decimal)"
-FAIL content: counter(par-num, decimal) assert_equals: content raw inline style declaration expected "counter(par-num)" but got "counter(par-num, decimal)"
+PASS content: counter(par-num)
+PASS content: counter(par-num, decimal)
 PASS content: counter(par-num, upper-roman)
 PASS content: attr(foo-bar)
 PASS content: attr(foo_bar)

Modified: trunk/Source/WebCore/ChangeLog (278647 => 278648)


--- trunk/Source/WebCore/ChangeLog	2021-06-09 05:03:32 UTC (rev 278647)
+++ trunk/Source/WebCore/ChangeLog	2021-06-09 05:07:27 UTC (rev 278648)
@@ -1,3 +1,19 @@
+2021-06-08  Rob Buis  <[email protected]>
+
+        CSSOM test for serializing counter() fails
+        https://bugs.webkit.org/show_bug.cgi?id=184256
+
+        Reviewed by Sam Weinig.
+
+        The last CSS component value should be omitted if it is "decimal" [1].
+
+        Behavior matches Firefox and Chrome.
+
+        [1] https://drafts.csswg.org/cssom/#serialize-a-css-component-value
+
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::formatNumberForCustomCSSText const):
+
 2021-06-08  Sam Weinig  <[email protected]>
 
         Adopt WTF::Span in SQLiteStatement

Modified: trunk/Source/WebCore/css/CSSPrimitiveValue.cpp (278647 => 278648)


--- trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2021-06-09 05:03:32 UTC (rev 278647)
+++ trunk/Source/WebCore/css/CSSPrimitiveValue.cpp	2021-06-09 05:07:27 UTC (rev 278648)
@@ -1080,7 +1080,9 @@
         result.append(separator.isEmpty() ? "counter(" : "counters(", m_value.counter->identifier(), separator.isEmpty() ? "" : ", ");
         if (!separator.isEmpty())
             serializeString(separator, result);
-        result.append(listStyle.isEmpty() ? "" : ", ", listStyle, ')');
+        if (!(listStyle.isEmpty() || listStyle == "decimal"))
+            result.append(", ", listStyle);
+        result.append(')');
         return result.toString();
     }
     case CSSUnitType::CSS_RECT:
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to