Skip to content
Permalink
Browse files
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:


Canonical link: https://commits.webkit.org/242588@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@283637 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
pxlcoder committed Oct 6, 2021
1 parent c83ff3c commit 15058886f376e9f890ff06e7a729cf9f8e7c1818
Showing 10 changed files with 58 additions and 18 deletions.
@@ -1,3 +1,16 @@
2021-10-06 Aditya Keerthi <akeerthi@apple.com>

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 <ayumi_kojima@apple.com>

[ iOS ] fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out.html is a flaky failure.
@@ -42,7 +42,7 @@ PASS rules[2].cssRules[0].type is CSSRule.SUPPORTS_RULE
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)"
@@ -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" +
@@ -3,6 +3,6 @@ description(
);

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");
@@ -1,3 +1,14 @@
2021-10-06 Aditya Keerthi <akeerthi@apple.com>

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 <ntim@apple.com>

Reset m_isModal flag when removing <dialog> from document
@@ -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}"

@@ -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}"

@@ -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

@@ -1,3 +1,19 @@
2021-10-06 Aditya Keerthi <akeerthi@apple.com>

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 <darin@apple.com>

Reduce use of "using namespace": eliminate all "using namespace XPath"
@@ -49,7 +49,7 @@ MediaQuerySet& CSSMediaRule::mediaQueries() const
String CSSMediaRule::cssText() const
{
StringBuilder result;
result.append("@media ", conditionText(), " { \n");
result.append("@media ", conditionText(), " {\n");
appendCSSTextForItems(result);
result.append('}');
return result.toString();

0 comments on commit 1505888

Please sign in to comment.