Title: [283637] trunk
Revision
283637
Author
[email protected]
Date
2021-10-06 11:11:18 -0700 (Wed, 06 Oct 2021)

Log Message

Fix serialization of CSSMediaRule
https://bugs.webkit.org/show_bug.cgi?id=231249

Reviewed by Chris Dumez.

LayoutTests/imported/w3c:

* web-platform-tests/css/css-ui/appearance-serialization-expected.txt: Rebaseline.
* web-platform-tests/css/css-ui/webkit-appearance-serialization-expected.txt: Rebaseline.
* web-platform-tests/css/cssom/serialize-media-rule-expected.txt: Mark progression.

Source/WebCore:

See https://drafts.csswg.org/cssom/#serialize-a-css-rule.

New behavior matches Chrome and Firefox.

* css/CSSMediaRule.cpp:
(WebCore::CSSMediaRule::cssText const):

Remove space before newline.

LayoutTests:

Rebaseline tests to account for the correct serialization.

* css3/supports-cssom-expected.txt:
* css3/supports-cssom.html:
* fast/css/resources/insertRule-media.js:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (283636 => 283637)


--- trunk/LayoutTests/ChangeLog	2021-10-06 18:08:17 UTC (rev 283636)
+++ trunk/LayoutTests/ChangeLog	2021-10-06 18:11:18 UTC (rev 283637)
@@ -1,3 +1,16 @@
+2021-10-06  Aditya Keerthi  <[email protected]>
+
+        Fix serialization of CSSMediaRule
+        https://bugs.webkit.org/show_bug.cgi?id=231249
+
+        Reviewed by Chris Dumez.
+
+        Rebaseline tests to account for the correct serialization.
+
+        * css3/supports-cssom-expected.txt:
+        * css3/supports-cssom.html:
+        * fast/css/resources/insertRule-media.js:
+
 2021-10-06  Ayumi Kojima  <[email protected]>
 
         [ iOS ] fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out.html is a flaky failure.

Modified: trunk/LayoutTests/css3/supports-cssom-expected.txt (283636 => 283637)


--- trunk/LayoutTests/css3/supports-cssom-expected.txt	2021-10-06 18:08:17 UTC (rev 283636)
+++ trunk/LayoutTests/css3/supports-cssom-expected.txt	2021-10-06 18:11:18 UTC (rev 283637)
@@ -42,7 +42,7 @@
 PASS rules[2].cssRules[0].conditionText is "( padding: 0)"
 PASS rules[0].cssRules[1].cssRules.length is 1
 PASS rules[2].cssRules[0].cssRules[0].type is CSSRule.PAGE_RULE
-PASS rules[2].cssText is "@media all { \n  @supports ( padding: 0) {\n  @page :left { top: 0px; }\n}\n}"
+PASS rules[2].cssText is "@media all {\n  @supports ( padding: 0) {\n  @page :left { top: 0px; }\n}\n}"
 
 No extra parens should be added to the conditionText.
 PASS rules[3].conditionText is "(border: black) and (padding: 0) and (width: 0)"

Modified: trunk/LayoutTests/css3/supports-cssom.html (283636 => 283637)


--- trunk/LayoutTests/css3/supports-cssom.html	2021-10-06 18:08:17 UTC (rev 283636)
+++ trunk/LayoutTests/css3/supports-cssom.html	2021-10-06 18:11:18 UTC (rev 283637)
@@ -104,7 +104,7 @@
     shouldEvaluateTo("rules[0].cssRules[1].cssRules.length", 1);
     shouldBe("rules[2].cssRules[0].cssRules[0].type", "CSSRule.PAGE_RULE");
     shouldBeEqualToString("rules[2].cssText",
-                          "@media all { \n" +
+                          "@media all {\n" +
                           "  @supports ( padding: 0) {\n" +
                           "  @page :left { top: 0px; }\n" +
                           "}\n" +

Modified: trunk/LayoutTests/fast/css/resources/insertRule-media.js (283636 => 283637)


--- trunk/LayoutTests/fast/css/resources/insertRule-media.js	2021-10-06 18:08:17 UTC (rev 283636)
+++ trunk/LayoutTests/fast/css/resources/insertRule-media.js	2021-10-06 18:11:18 UTC (rev 283637)
@@ -3,6 +3,6 @@
 );
 
 var rule = "@media all and (min-width: 0px) { \n  #greenid { color: green; }\n}";
-var serializedRule = "@media (min-width: 0px) { \n  #greenid { color: green; }\n}";
+var serializedRule = "@media (min-width: 0px) {\n  #greenid { color: green; }\n}";
 shouldBe("document.styleSheets[0].insertRule(rule, 0)", "0");
 shouldBe("document.styleSheets[0].rules[0].cssText", "serializedRule");

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (283636 => 283637)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-06 18:08:17 UTC (rev 283636)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2021-10-06 18:11:18 UTC (rev 283637)
@@ -1,3 +1,14 @@
+2021-10-06  Aditya Keerthi  <[email protected]>
+
+        Fix serialization of CSSMediaRule
+        https://bugs.webkit.org/show_bug.cgi?id=231249
+
+        Reviewed by Chris Dumez.
+
+        * web-platform-tests/css/css-ui/appearance-serialization-expected.txt: Rebaseline.
+        * web-platform-tests/css/css-ui/webkit-appearance-serialization-expected.txt: Rebaseline.
+        * web-platform-tests/css/cssom/serialize-media-rule-expected.txt: Mark progression.
+
 2021-10-06  Tim Nguyen  <[email protected]>
 
         Reset m_isModal flag when removing <dialog> from document

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/appearance-serialization-expected.txt (283636 => 283637)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/appearance-serialization-expected.txt	2021-10-06 18:08:17 UTC (rev 283636)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/appearance-serialization-expected.txt	2021-10-06 18:11:18 UTC (rev 283637)
@@ -1,5 +1,5 @@
 
 FAIL serialization via CSSStyleDeclaration assert_equals: expected "appearance: none;" but got ""
 FAIL serialization via CSSStyleRule assert_equals: expected "#foo { appearance: none; }" but got "#foo { }"
-FAIL serialization via CSSMediaRule assert_equals: expected "@media print {\n  #foo { appearance: none; }\n}" but got "@media print { \n  #foo { }\n}"
+FAIL serialization via CSSMediaRule assert_equals: expected "@media print {\n  #foo { appearance: none; }\n}" but got "@media print {\n  #foo { }\n}"
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/webkit-appearance-serialization-expected.txt (283636 => 283637)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/webkit-appearance-serialization-expected.txt	2021-10-06 18:08:17 UTC (rev 283636)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/webkit-appearance-serialization-expected.txt	2021-10-06 18:11:18 UTC (rev 283637)
@@ -1,5 +1,5 @@
 
 FAIL serialization via CSSStyleDeclaration assert_equals: expected "appearance: none;" but got "-webkit-appearance: none;"
 FAIL serialization via CSSStyleRule assert_equals: expected "#foo { appearance: none; }" but got "#foo { -webkit-appearance: none; }"
-FAIL serialization via CSSMediaRule assert_equals: expected "@media print {\n  #foo { appearance: none; }\n}" but got "@media print { \n  #foo { -webkit-appearance: none; }\n}"
+FAIL serialization via CSSMediaRule assert_equals: expected "@media print {\n  #foo { appearance: none; }\n}" but got "@media print {\n  #foo { -webkit-appearance: none; }\n}"
 

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-media-rule-expected.txt (283636 => 283637)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-media-rule-expected.txt	2021-10-06 18:08:17 UTC (rev 283636)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-media-rule-expected.txt	2021-10-06 18:11:18 UTC (rev 283637)
@@ -1,14 +1,14 @@
 
-FAIL empty media query list assert_equals: expected "@media  {\n}" but got "@media  { \n}"
-FAIL type - no features assert_equals: expected "@media speech {\n}" but got "@media speech { \n}"
-FAIL type - no features - negation assert_equals: expected "@media not speech {\n}" but got "@media not speech { \n}"
-FAIL type - no features - character case normalization assert_equals: expected "@media speech {\n}" but got "@media speech { \n}"
-FAIL type - omission of all assert_equals: expected "@media (color) {\n}" but got "@media (color) { \n}"
-FAIL type - inclusion of negated all assert_equals: expected "@media not all and (color) {\n}" but got "@media not all and (color) { \n}"
-FAIL features - character case normalization assert_equals: expected "@media screen and (color) {\n}" but got "@media screen and (color) { \n}"
-FAIL features - preservation of overspecified features assert_equals: expected "@media print and (max-width: 23px) and (max-width: 45px) {\n}" but got "@media print and (max-width: 23px) and (max-width: 45px) { \n}"
-FAIL features - no lexicographical sorting assert_equals: expected "@media screen and (color) and (max-width: 0px) {\n}" but got "@media screen and (color) and (max-width: 0px) { \n}"
-FAIL media query list assert_equals: expected "@media screen and (max-width: 0px), screen and (color) {\n}" but got "@media screen and (max-width: 0px), screen and (color) { \n}"
-FAIL one rule assert_equals: expected "@media print {\n  #foo { z-index: 23; float: left; }\n}" but got "@media print { \n  #foo { z-index: 23; float: left; }\n}"
-FAIL many rules assert_equals: expected "@media print {\n  #bar { float: none; z-index: 45; }\n  #foo { z-index: 23; float: left; }\n}" but got "@media print { \n  #bar { float: none; z-index: 45; }\n  #foo { z-index: 23; float: left; }\n}"
+PASS empty media query list
+PASS type - no features
+PASS type - no features - negation
+PASS type - no features - character case normalization
+PASS type - omission of all
+PASS type - inclusion of negated all
+PASS features - character case normalization
+PASS features - preservation of overspecified features
+PASS features - no lexicographical sorting
+PASS media query list
+PASS one rule
+PASS many rules
 

Modified: trunk/Source/WebCore/ChangeLog (283636 => 283637)


--- trunk/Source/WebCore/ChangeLog	2021-10-06 18:08:17 UTC (rev 283636)
+++ trunk/Source/WebCore/ChangeLog	2021-10-06 18:11:18 UTC (rev 283637)
@@ -1,3 +1,19 @@
+2021-10-06  Aditya Keerthi  <[email protected]>
+
+        Fix serialization of CSSMediaRule
+        https://bugs.webkit.org/show_bug.cgi?id=231249
+
+        Reviewed by Chris Dumez.
+
+        See https://drafts.csswg.org/cssom/#serialize-a-css-rule.
+
+        New behavior matches Chrome and Firefox.
+
+        * css/CSSMediaRule.cpp:
+        (WebCore::CSSMediaRule::cssText const):
+
+        Remove space before newline.
+
 2021-10-06  Darin Adler  <[email protected]>
 
         Reduce use of "using namespace": eliminate all "using namespace XPath"

Modified: trunk/Source/WebCore/css/CSSMediaRule.cpp (283636 => 283637)


--- trunk/Source/WebCore/css/CSSMediaRule.cpp	2021-10-06 18:08:17 UTC (rev 283636)
+++ trunk/Source/WebCore/css/CSSMediaRule.cpp	2021-10-06 18:11:18 UTC (rev 283637)
@@ -49,7 +49,7 @@
 String CSSMediaRule::cssText() const
 {
     StringBuilder result;
-    result.append("@media ", conditionText(), " { \n");
+    result.append("@media ", conditionText(), " {\n");
     appendCSSTextForItems(result);
     result.append('}');
     return result.toString();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to