<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[283637] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/283637">283637</a></dd>
<dt>Author</dt> <dd>akeerthi@apple.com</dd>
<dt>Date</dt> <dd>2021-10-06 11:11:18 -0700 (Wed, 06 Oct 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>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:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestscss3supportscssomexpectedtxt">trunk/LayoutTests/css3/supports-cssom-expected.txt</a></li>
<li><a href="#trunkLayoutTestscss3supportscssomhtml">trunk/LayoutTests/css3/supports-cssom.html</a></li>
<li><a href="#trunkLayoutTestsfastcssresourcesinsertRulemediajs">trunk/LayoutTests/fast/css/resources/insertRule-media.js</a></li>
<li><a href="#trunkLayoutTestsimportedw3cChangeLog">trunk/LayoutTests/imported/w3c/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscsscssuiappearanceserializationexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/appearance-serialization-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscsscssuiwebkitappearanceserializationexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/webkit-appearance-serialization-expected.txt</a></li>
<li><a href="#trunkLayoutTestsimportedw3cwebplatformtestscsscssomserializemediaruleexpectedtxt">trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-media-rule-expected.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSMediaRulecpp">trunk/Source/WebCore/css/CSSMediaRule.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (283636 => 283637)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog      2021-10-06 18:08:17 UTC (rev 283636)
+++ trunk/LayoutTests/ChangeLog 2021-10-06 18:11:18 UTC (rev 283637)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+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:
+
</ins><span class="cx"> 2021-10-06  Ayumi Kojima  <ayumi_kojima@apple.com>
</span><span class="cx"> 
</span><span class="cx">         [ iOS ] fast/events/ios/fast-click-double-tap-to-zoom-in-on-text-and-then-again-to-zoom-out.html is a flaky failure.
</span></span></pre></div>
<a id="trunkLayoutTestscss3supportscssomexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/css3/supports-cssom-expected.txt (283636 => 283637)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -42,7 +42,7 @@
</span><span class="cx"> PASS rules[2].cssRules[0].conditionText is "( padding: 0)"
</span><span class="cx"> PASS rules[0].cssRules[1].cssRules.length is 1
</span><span class="cx"> PASS rules[2].cssRules[0].cssRules[0].type is CSSRule.PAGE_RULE
</span><del>-PASS rules[2].cssText is "@media all { \n  @supports ( padding: 0) {\n  @page :left { top: 0px; }\n}\n}"
</del><ins>+PASS rules[2].cssText is "@media all {\n  @supports ( padding: 0) {\n  @page :left { top: 0px; }\n}\n}"
</ins><span class="cx"> 
</span><span class="cx"> No extra parens should be added to the conditionText.
</span><span class="cx"> PASS rules[3].conditionText is "(border: black) and (padding: 0) and (width: 0)"
</span></span></pre></div>
<a id="trunkLayoutTestscss3supportscssomhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/css3/supports-cssom.html (283636 => 283637)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -104,7 +104,7 @@
</span><span class="cx">     shouldEvaluateTo("rules[0].cssRules[1].cssRules.length", 1);
</span><span class="cx">     shouldBe("rules[2].cssRules[0].cssRules[0].type", "CSSRule.PAGE_RULE");
</span><span class="cx">     shouldBeEqualToString("rules[2].cssText",
</span><del>-                          "@media all { \n" +
</del><ins>+                          "@media all {\n" +
</ins><span class="cx">                           "  @supports ( padding: 0) {\n" +
</span><span class="cx">                           "  @page :left { top: 0px; }\n" +
</span><span class="cx">                           "}\n" +
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssresourcesinsertRulemediajs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/css/resources/insertRule-media.js (283636 => 283637)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -3,6 +3,6 @@
</span><span class="cx"> );
</span><span class="cx"> 
</span><span class="cx"> var rule = "@media all and (min-width: 0px) { \n  #greenid { color: green; }\n}";
</span><del>-var serializedRule = "@media (min-width: 0px) { \n  #greenid { color: green; }\n}";
</del><ins>+var serializedRule = "@media (min-width: 0px) {\n  #greenid { color: green; }\n}";
</ins><span class="cx"> shouldBe("document.styleSheets[0].insertRule(rule, 0)", "0");
</span><span class="cx"> shouldBe("document.styleSheets[0].rules[0].cssText", "serializedRule");
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/ChangeLog (283636 => 283637)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+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.
+
</ins><span class="cx"> 2021-10-06  Tim Nguyen  <ntim@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Reset m_isModal flag when removing <dialog> from document
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscsscssuiappearanceserializationexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/appearance-serialization-expected.txt (283636 => 283637)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> 
</span><span class="cx"> FAIL serialization via CSSStyleDeclaration assert_equals: expected "appearance: none;" but got ""
</span><span class="cx"> FAIL serialization via CSSStyleRule assert_equals: expected "#foo { appearance: none; }" but got "#foo { }"
</span><del>-FAIL serialization via CSSMediaRule assert_equals: expected "@media print {\n  #foo { appearance: none; }\n}" but got "@media print { \n  #foo { }\n}"
</del><ins>+FAIL serialization via CSSMediaRule assert_equals: expected "@media print {\n  #foo { appearance: none; }\n}" but got "@media print {\n  #foo { }\n}"
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscsscssuiwebkitappearanceserializationexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/webkit-appearance-serialization-expected.txt (283636 => 283637)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> 
</span><span class="cx"> FAIL serialization via CSSStyleDeclaration assert_equals: expected "appearance: none;" but got "-webkit-appearance: none;"
</span><span class="cx"> FAIL serialization via CSSStyleRule assert_equals: expected "#foo { appearance: none; }" but got "#foo { -webkit-appearance: none; }"
</span><del>-FAIL serialization via CSSMediaRule assert_equals: expected "@media print {\n  #foo { appearance: none; }\n}" but got "@media print { \n  #foo { -webkit-appearance: none; }\n}"
</del><ins>+FAIL serialization via CSSMediaRule assert_equals: expected "@media print {\n  #foo { appearance: none; }\n}" but got "@media print {\n  #foo { -webkit-appearance: none; }\n}"
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsimportedw3cwebplatformtestscsscssomserializemediaruleexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/css/cssom/serialize-media-rule-expected.txt (283636 => 283637)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,14 +1,14 @@
</span><span class="cx"> 
</span><del>-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}"
</del><ins>+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
</ins><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (283636 => 283637)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+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.
+
</ins><span class="cx"> 2021-10-06  Darin Adler  <darin@apple.com>
</span><span class="cx"> 
</span><span class="cx">         Reduce use of "using namespace": eliminate all "using namespace XPath"
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSMediaRulecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSMediaRule.cpp (283636 => 283637)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -49,7 +49,7 @@
</span><span class="cx"> String CSSMediaRule::cssText() const
</span><span class="cx"> {
</span><span class="cx">     StringBuilder result;
</span><del>-    result.append("@media ", conditionText(), " { \n");
</del><ins>+    result.append("@media ", conditionText(), " {\n");
</ins><span class="cx">     appendCSSTextForItems(result);
</span><span class="cx">     result.append('}');
</span><span class="cx">     return result.toString();
</span></span></pre>
</div>
</div>

</body>
</html>