<!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>[186687] 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/186687">186687</a></dd>
<dt>Author</dt> <dd>dbates@webkit.org</dd>
<dt>Date</dt> <dd>2015-07-10 13:40:27 -0700 (Fri, 10 Jul 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Serialized declaration for background-size/-webkit-mask-size should preserve identical
values instead of coalescing them
https://bugs.webkit.org/show_bug.cgi?id=143191
&lt;rdar://problem/21759393&gt;

Reviewed by Darin Adler.

Source/WebCore:

Inspired by Blink <a href="http://trac.webkit.org/projects/webkit/changeset/157745">r157745</a>:
&lt;http://src.chromium.org/viewvc/blink?view=revision&amp;revision=157745&gt;
And Blink <a href="http://trac.webkit.org/projects/webkit/changeset/172548">r172548</a>:
&lt;http://src.chromium.org/viewvc/blink?view=revision&amp;revision=172548&gt;

Fixes an issue where identical values in a CSS declaration for properties background-size
and -webkit-mask-size would be coalesced when serialized.

* css/CSSParser.cpp:
(WebCore::CSSParser::parseFillSize): Modified to create a Pair object with the appropriate
identical value encoding strategy. We only coalesce identical values when serializing the
declaration of property -webkit-background-size.
* css/Pair.h:
(WebCore::Pair::create): Added variant that takes an encoding.
(WebCore::Pair::cssText): Moved implementation of Pair::generateCSSString() to here and
modified to conditionally coalesce identical values during serialization.
(WebCore::Pair::Pair): Added variant that takes an encoding.
(WebCore::Pair::generateCSSString): Deleted; moved implementation into Pair::cssText().

LayoutTests:

Inspired by Blink <a href="http://trac.webkit.org/projects/webkit/changeset/172548">r172548</a>:
&lt;http://src.chromium.org/viewvc/blink?view=revision&amp;revision=172548&gt;

Update tests and test results to ensure we serialize background-size, -webkit-mask-size
correctly when identical values are present in their declarations.

* fast/backgrounds/size/parsing-background-size-values-expected.txt:
* fast/backgrounds/size/resources/parsing-background-size-values.js:
* fast/masking/parsing-mask-expected.txt:
* fast/masking/parsing-mask.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastbackgroundssizeparsingbackgroundsizevaluesexpectedtxt">trunk/LayoutTests/fast/backgrounds/size/parsing-background-size-values-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastbackgroundssizeresourcesparsingbackgroundsizevaluesjs">trunk/LayoutTests/fast/backgrounds/size/resources/parsing-background-size-values.js</a></li>
<li><a href="#trunkLayoutTestsfastmaskingparsingmaskexpectedtxt">trunk/LayoutTests/fast/masking/parsing-mask-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastmaskingparsingmaskhtml">trunk/LayoutTests/fast/masking/parsing-mask.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSParsercpp">trunk/Source/WebCore/css/CSSParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssPairh">trunk/Source/WebCore/css/Pair.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (186686 => 186687)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-07-10 20:39:16 UTC (rev 186686)
+++ trunk/LayoutTests/ChangeLog        2015-07-10 20:40:27 UTC (rev 186687)
</span><span class="lines">@@ -1,3 +1,23 @@
</span><ins>+2015-07-10  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        Serialized declaration for background-size/-webkit-mask-size should preserve identical
+        values instead of coalescing them
+        https://bugs.webkit.org/show_bug.cgi?id=143191
+        &lt;rdar://problem/21759393&gt;
+
+        Reviewed by Darin Adler.
+
+        Inspired by Blink r172548:
+        &lt;http://src.chromium.org/viewvc/blink?view=revision&amp;revision=172548&gt;
+
+        Update tests and test results to ensure we serialize background-size, -webkit-mask-size
+        correctly when identical values are present in their declarations.
+
+        * fast/backgrounds/size/parsing-background-size-values-expected.txt:
+        * fast/backgrounds/size/resources/parsing-background-size-values.js:
+        * fast/masking/parsing-mask-expected.txt:
+        * fast/masking/parsing-mask.html:
+
</ins><span class="cx"> 2015-07-10  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Bidi-Isolate inlines break layout with collapsed whitespace
</span></span></pre></div>
<a id="trunkLayoutTestsfastbackgroundssizeparsingbackgroundsizevaluesexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/backgrounds/size/parsing-background-size-values-expected.txt (186686 => 186687)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/backgrounds/size/parsing-background-size-values-expected.txt        2015-07-10 20:39:16 UTC (rev 186686)
+++ trunk/LayoutTests/fast/backgrounds/size/parsing-background-size-values-expected.txt        2015-07-10 20:40:27 UTC (rev 186687)
</span><span class="lines">@@ -5,8 +5,10 @@
</span><span class="cx"> 
</span><span class="cx"> PASS test(&quot;background-size: contain;&quot;) is &quot;contain&quot;
</span><span class="cx"> PASS test(&quot;background-size: cover;&quot;) is &quot;cover&quot;
</span><del>-PASS test(&quot;background-size: 100 100;&quot;) is &quot;100px&quot;
-PASS test(&quot;background-size: 100px 100px;&quot;) is &quot;100px&quot;
</del><ins>+PASS test(&quot;background-size: 100 100;&quot;) is &quot;100px 100px&quot;
+PASS test(&quot;background-size: 100px 100px;&quot;) is &quot;100px 100px&quot;
+PASS test(&quot;background-size: 100;&quot;) is &quot;100px&quot;
+PASS test(&quot;background-size: 100px;&quot;) is &quot;100px&quot;
</ins><span class="cx"> PASS test(&quot;background-size: auto 50px;&quot;) is &quot;auto 50px&quot;
</span><span class="cx"> PASS test(&quot;background-size: 50px auto;&quot;) is &quot;50px&quot;
</span><span class="cx"> PASS test(&quot;background-size: auto auto;&quot;) is &quot;auto&quot;
</span></span></pre></div>
<a id="trunkLayoutTestsfastbackgroundssizeresourcesparsingbackgroundsizevaluesjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/backgrounds/size/resources/parsing-background-size-values.js (186686 => 186687)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/backgrounds/size/resources/parsing-background-size-values.js        2015-07-10 20:39:16 UTC (rev 186686)
+++ trunk/LayoutTests/fast/backgrounds/size/resources/parsing-background-size-values.js        2015-07-10 20:40:27 UTC (rev 186687)
</span><span class="lines">@@ -13,8 +13,10 @@
</span><span class="cx"> 
</span><span class="cx"> shouldBe('test(&quot;background-size: contain;&quot;)', '&quot;contain&quot;');
</span><span class="cx"> shouldBe('test(&quot;background-size: cover;&quot;)', '&quot;cover&quot;');
</span><del>-shouldBe('test(&quot;background-size: 100 100;&quot;)', '&quot;100px&quot;');
-shouldBe('test(&quot;background-size: 100px 100px;&quot;)', '&quot;100px&quot;');
</del><ins>+shouldBe('test(&quot;background-size: 100 100;&quot;)', '&quot;100px 100px&quot;');
+shouldBe('test(&quot;background-size: 100px 100px;&quot;)', '&quot;100px 100px&quot;');
+shouldBe('test(&quot;background-size: 100;&quot;)', '&quot;100px&quot;');
+shouldBe('test(&quot;background-size: 100px;&quot;)', '&quot;100px&quot;');
</ins><span class="cx"> shouldBe('test(&quot;background-size: auto 50px;&quot;)', '&quot;auto 50px&quot;');
</span><span class="cx"> shouldBe('test(&quot;background-size: 50px auto;&quot;)', '&quot;50px&quot;');
</span><span class="cx"> shouldBe('test(&quot;background-size: auto auto;&quot;)', '&quot;auto&quot;');
</span></span></pre></div>
<a id="trunkLayoutTestsfastmaskingparsingmaskexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/masking/parsing-mask-expected.txt (186686 => 186687)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/masking/parsing-mask-expected.txt        2015-07-10 20:39:16 UTC (rev 186686)
+++ trunk/LayoutTests/fast/masking/parsing-mask-expected.txt        2015-07-10 20:40:27 UTC (rev 186687)
</span><span class="lines">@@ -73,6 +73,7 @@
</span><span class="cx"> PASS innerStyle(&quot;-webkit-mask&quot;, &quot;none left top / auto&quot;) is &quot;none 0% 0% / auto&quot;
</span><span class="cx"> PASS innerStyle(&quot;-webkit-mask&quot;, &quot;none left top / auto auto&quot;) is &quot;none 0% 0% / auto&quot;
</span><span class="cx"> PASS innerStyle(&quot;-webkit-mask&quot;, &quot;none left top / 100%&quot;) is &quot;none 0% 0% / 100%&quot;
</span><ins>+PASS innerStyle(&quot;-webkit-mask&quot;, &quot;none left top / 100% 100%&quot;) is &quot;none 0% 0% / 100% 100%&quot;
</ins><span class="cx"> PASS innerStyle(&quot;-webkit-mask&quot;, &quot;none left top / 0%&quot;) is &quot;none 0% 0% / 0%&quot;
</span><span class="cx"> PASS innerStyle(&quot;-webkit-mask&quot;, &quot;none left top / auto 0%&quot;) is &quot;none 0% 0% / auto 0%&quot;
</span><span class="cx"> PASS innerStyle(&quot;-webkit-mask&quot;, &quot;none left top / cover&quot;) is &quot;none 0% 0% / cover&quot;
</span></span></pre></div>
<a id="trunkLayoutTestsfastmaskingparsingmaskhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/masking/parsing-mask.html (186686 => 186687)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/masking/parsing-mask.html        2015-07-10 20:39:16 UTC (rev 186686)
+++ trunk/LayoutTests/fast/masking/parsing-mask.html        2015-07-10 20:40:27 UTC (rev 186687)
</span><span class="lines">@@ -124,6 +124,7 @@
</span><span class="cx"> testInner(&quot;-webkit-mask&quot;, &quot;none left top / auto&quot;, &quot;none 0% 0% / auto&quot;);
</span><span class="cx"> testInner(&quot;-webkit-mask&quot;, &quot;none left top / auto auto&quot;, &quot;none 0% 0% / auto&quot;);
</span><span class="cx"> testInner(&quot;-webkit-mask&quot;, &quot;none left top / 100%&quot;, &quot;none 0% 0% / 100%&quot;);
</span><ins>+testInner(&quot;-webkit-mask&quot;, &quot;none left top / 100% 100%&quot;, &quot;none 0% 0% / 100% 100%&quot;);
</ins><span class="cx"> testInner(&quot;-webkit-mask&quot;, &quot;none left top / 0%&quot;, &quot;none 0% 0% / 0%&quot;);
</span><span class="cx"> testInner(&quot;-webkit-mask&quot;, &quot;none left top / auto 0%&quot;, &quot;none 0% 0% / auto 0%&quot;);
</span><span class="cx"> testInner(&quot;-webkit-mask&quot;, &quot;none left top / cover&quot;, &quot;none 0% 0% / cover&quot;);
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (186686 => 186687)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-07-10 20:39:16 UTC (rev 186686)
+++ trunk/Source/WebCore/ChangeLog        2015-07-10 20:40:27 UTC (rev 186687)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2015-07-10  Daniel Bates  &lt;dabates@apple.com&gt;
+
+        Serialized declaration for background-size/-webkit-mask-size should preserve identical
+        values instead of coalescing them
+        https://bugs.webkit.org/show_bug.cgi?id=143191
+        &lt;rdar://problem/21759393&gt;
+
+        Reviewed by Darin Adler.
+
+        Inspired by Blink r157745:
+        &lt;http://src.chromium.org/viewvc/blink?view=revision&amp;revision=157745&gt;
+        And Blink r172548:
+        &lt;http://src.chromium.org/viewvc/blink?view=revision&amp;revision=172548&gt;
+
+        Fixes an issue where identical values in a CSS declaration for properties background-size
+        and -webkit-mask-size would be coalesced when serialized.
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseFillSize): Modified to create a Pair object with the appropriate
+        identical value encoding strategy. We only coalesce identical values when serializing the
+        declaration of property -webkit-background-size.
+        * css/Pair.h:
+        (WebCore::Pair::create): Added variant that takes an encoding.
+        (WebCore::Pair::cssText): Moved implementation of Pair::generateCSSString() to here and
+        modified to conditionally coalesce identical values during serialization.
+        (WebCore::Pair::Pair): Added variant that takes an encoding.
+        (WebCore::Pair::generateCSSString): Deleted; moved implementation into Pair::cssText().
+
</ins><span class="cx"> 2015-07-10  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Bidi-Isolate inlines break layout with collapsed whitespace
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.cpp (186686 => 186687)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.cpp        2015-07-10 20:39:16 UTC (rev 186686)
+++ trunk/Source/WebCore/css/CSSParser.cpp        2015-07-10 20:40:27 UTC (rev 186687)
</span><span class="lines">@@ -4649,7 +4649,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (!parsedValue2)
</span><span class="cx">         return parsedValue1;
</span><del>-    return createPrimitiveValuePair(WTF::move(parsedValue1), WTF::move(parsedValue2));
</del><ins>+    return createPrimitiveValuePair(WTF::move(parsedValue1), WTF::move(parsedValue2), propId == CSSPropertyWebkitBackgroundSize ? Pair::IdenticalValueEncoding::Coalesce : Pair::IdenticalValueEncoding::DoNotCoalesce);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool CSSParser::parseFillProperty(CSSPropertyID propId, CSSPropertyID&amp; propId1, CSSPropertyID&amp; propId2,
</span></span></pre></div>
<a id="trunkSourceWebCorecssPairh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/Pair.h (186686 => 186687)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/Pair.h        2015-07-10 20:39:16 UTC (rev 186686)
+++ trunk/Source/WebCore/css/Pair.h        2015-07-10 20:40:27 UTC (rev 186687)
</span><span class="lines">@@ -34,6 +34,11 @@
</span><span class="cx"> // it (eliminating some extra -webkit- internal properties).
</span><span class="cx"> class Pair : public RefCounted&lt;Pair&gt; {
</span><span class="cx"> public:
</span><ins>+    enum class IdenticalValueEncoding {
+        DoNotCoalesce,
+        Coalesce
+    };
+
</ins><span class="cx">     static Ref&lt;Pair&gt; create()
</span><span class="cx">     {
</span><span class="cx">         return adoptRef(*new Pair);
</span><span class="lines">@@ -42,6 +47,10 @@
</span><span class="cx">     {
</span><span class="cx">         return adoptRef(*new Pair(WTF::move(first), WTF::move(second)));
</span><span class="cx">     }
</span><ins>+    static Ref&lt;Pair&gt; create(RefPtr&lt;CSSPrimitiveValue&gt;&amp;&amp; first, RefPtr&lt;CSSPrimitiveValue&gt;&amp;&amp; second, IdenticalValueEncoding encoding)
+    {
+        return adoptRef(*new Pair(WTF::move(first), WTF::move(second), encoding));
+    }
</ins><span class="cx">     virtual ~Pair() { }
</span><span class="cx"> 
</span><span class="cx">     CSSPrimitiveValue* first() const { return m_first.get(); }
</span><span class="lines">@@ -52,8 +61,11 @@
</span><span class="cx"> 
</span><span class="cx">     String cssText() const
</span><span class="cx">     {
</span><del>-    
-        return generateCSSString(first()-&gt;cssText(), second()-&gt;cssText());
</del><ins>+        String first = this-&gt;first()-&gt;cssText();
+        String second = this-&gt;second()-&gt;cssText();
+        if (m_encoding == IdenticalValueEncoding::Coalesce &amp;&amp; first == second)
+            return first;
+        return first + ' ' + second;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool equals(const Pair&amp; other) const { return compareCSSValuePtr(m_first, other.m_first) &amp;&amp; compareCSSValuePtr(m_second, other.m_second); }
</span><span class="lines">@@ -61,16 +73,11 @@
</span><span class="cx"> private:
</span><span class="cx">     Pair() : m_first(nullptr), m_second(nullptr) { }
</span><span class="cx">     Pair(RefPtr&lt;CSSPrimitiveValue&gt;&amp;&amp; first, RefPtr&lt;CSSPrimitiveValue&gt;&amp;&amp; second) : m_first(WTF::move(first)), m_second(WTF::move(second)) { }
</span><ins>+    Pair(RefPtr&lt;CSSPrimitiveValue&gt;&amp;&amp; first, RefPtr&lt;CSSPrimitiveValue&gt;&amp;&amp; second, IdenticalValueEncoding encoding) : m_first(WTF::move(first)), m_second(WTF::move(second)), m_encoding(encoding) { }
</ins><span class="cx"> 
</span><del>-    static String generateCSSString(const String&amp; first, const String&amp; second)
-    {
-        if (first == second)
-            return first;
-        return first + ' ' + second;
-    }
-
</del><span class="cx">     RefPtr&lt;CSSPrimitiveValue&gt; m_first;
</span><span class="cx">     RefPtr&lt;CSSPrimitiveValue&gt; m_second;
</span><ins>+    IdenticalValueEncoding m_encoding { IdenticalValueEncoding::Coalesce };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace
</span></span></pre>
</div>
</div>

</body>
</html>