<!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>[162475] 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/162475">162475</a></dd>
<dt>Author</dt> <dd>betravis@adobe.com</dd>
<dt>Date</dt> <dd>2014-01-21 14:23:53 -0800 (Tue, 21 Jan 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[CSS Shapes] Preserve box-shape order when serializing shape values
https://bugs.webkit.org/show_bug.cgi?id=127200

Reviewed by Dirk Schulze.

Source/WebCore:

Convert the parsed shape-box pair to a CSSValueList rather than directly
adding the box value to BasicShape. The CSSValueList preserves the
shape-box ordering, and cleans up a little bit of the code shared between
clip and shape values.

Modifying existing parsing tests.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::shapePropertyValue): Factor out code common to generating shape
values.
(WebCore::ComputedStyleExtractor::propertyValue): Generate a CSSValueList when
you have both a shape and a box.
* css/CSSParser.cpp:
(WebCore::CSSParser::parseBasicShapeAndOrBox): Factor out code common to clip
paths and shape properties that parses the [basic-shape || box] syntax from
the CSS Shapes spec.
(WebCore::CSSParser::parseShapeProperty): Parse shape-box pairs as a CSSValueList.
* css/DeprecatedStyleBuilder.cpp:
(WebCore::ApplyPropertyShape::applyValue): Use the CSSValueList for shape-box pairs.
* css/CSSValueList.h:
(WebCore::CSSValueList::itemWithoutBoundsCheck): Add a const version.
* page/animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc): Specify a box when blending.
* rendering/style/ShapeValue.h:
(WebCore::ShapeValue::createShapeValue): Add a box parameter.
(WebCore::ShapeValue::ShapeValue): Ditto.

LayoutTests:

Modify the expectations for box shape pairs, preserving the order of
the arguments in non-computed values. Computed values are still a
shape followed by a box.

* fast/shapes/parsing/parsing-shape-inside-expected.txt:
* fast/shapes/parsing/parsing-shape-outside-expected.txt:
* fast/shapes/parsing/parsing-test-utils.js:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsfastshapesparsingparsingshapeinsideexpectedtxt">trunk/LayoutTests/fast/shapes/parsing/parsing-shape-inside-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastshapesparsingparsingshapeoutsideexpectedtxt">trunk/LayoutTests/fast/shapes/parsing/parsing-shape-outside-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastshapesparsingparsingtestutilsjs">trunk/LayoutTests/fast/shapes/parsing/parsing-test-utils.js</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssCSSComputedStyleDeclarationcpp">trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSParsercpp">trunk/Source/WebCore/css/CSSParser.cpp</a></li>
<li><a href="#trunkSourceWebCorecssCSSParserh">trunk/Source/WebCore/css/CSSParser.h</a></li>
<li><a href="#trunkSourceWebCorecssCSSValueListh">trunk/Source/WebCore/css/CSSValueList.h</a></li>
<li><a href="#trunkSourceWebCorecssDeprecatedStyleBuildercpp">trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp</a></li>
<li><a href="#trunkSourceWebCorepageanimationCSSPropertyAnimationcpp">trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp</a></li>
<li><a href="#trunkSourceWebCorerenderingstyleShapeValueh">trunk/Source/WebCore/rendering/style/ShapeValue.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (162474 => 162475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-01-21 22:14:37 UTC (rev 162474)
+++ trunk/LayoutTests/ChangeLog        2014-01-21 22:23:53 UTC (rev 162475)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-01-21  Bear Travis  &lt;betravis@adobe.com&gt;
+
+        [CSS Shapes] Preserve box-shape order when serializing shape values
+        https://bugs.webkit.org/show_bug.cgi?id=127200
+
+        Reviewed by Dirk Schulze.
+
+        Modify the expectations for box shape pairs, preserving the order of
+        the arguments in non-computed values. Computed values are still a
+        shape followed by a box.
+
+        * fast/shapes/parsing/parsing-shape-inside-expected.txt:
+        * fast/shapes/parsing/parsing-shape-outside-expected.txt:
+        * fast/shapes/parsing/parsing-test-utils.js:
+
</ins><span class="cx"> 2014-01-21  Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         platform/mac/accessibility/iframe-aria-hidden.html is flaky
</span></span></pre></div>
<a id="trunkLayoutTestsfastshapesparsingparsingshapeinsideexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/shapes/parsing/parsing-shape-inside-expected.txt (162474 => 162475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shapes/parsing/parsing-shape-inside-expected.txt        2014-01-21 22:14:37 UTC (rev 162474)
+++ trunk/LayoutTests/fast/shapes/parsing/parsing-shape-inside-expected.txt        2014-01-21 22:23:53 UTC (rev 162475)
</span><span class="lines">@@ -107,13 +107,13 @@
</span><span class="cx"> PASS getComputedStyleValue(&quot;-webkit-shape-inside&quot;, &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) border-box&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) border-box&quot;
</span><span class="cx"> PASS getCSSText(&quot;-webkit-shape-inside&quot;, &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) margin-box&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) margin-box&quot;
</span><span class="cx"> PASS getComputedStyleValue(&quot;-webkit-shape-inside&quot;, &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) margin-box&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) margin-box&quot;
</span><del>-PASS getCSSText(&quot;-webkit-shape-inside&quot;, &quot;content-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) content-box&quot;
</del><ins>+PASS getCSSText(&quot;-webkit-shape-inside&quot;, &quot;content-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;content-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;
</ins><span class="cx"> PASS getComputedStyleValue(&quot;-webkit-shape-inside&quot;, &quot;content-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) content-box&quot;
</span><del>-PASS getCSSText(&quot;-webkit-shape-inside&quot;, &quot;padding-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) padding-box&quot;
</del><ins>+PASS getCSSText(&quot;-webkit-shape-inside&quot;, &quot;padding-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;padding-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;
</ins><span class="cx"> PASS getComputedStyleValue(&quot;-webkit-shape-inside&quot;, &quot;padding-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) padding-box&quot;
</span><del>-PASS getCSSText(&quot;-webkit-shape-inside&quot;, &quot;border-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) border-box&quot;
</del><ins>+PASS getCSSText(&quot;-webkit-shape-inside&quot;, &quot;border-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;border-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;
</ins><span class="cx"> PASS getComputedStyleValue(&quot;-webkit-shape-inside&quot;, &quot;border-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) border-box&quot;
</span><del>-PASS getCSSText(&quot;-webkit-shape-inside&quot;, &quot;margin-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) margin-box&quot;
</del><ins>+PASS getCSSText(&quot;-webkit-shape-inside&quot;, &quot;margin-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;margin-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;
</ins><span class="cx"> PASS getComputedStyleValue(&quot;-webkit-shape-inside&quot;, &quot;margin-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) margin-box&quot;
</span><span class="cx"> PASS getCSSText(&quot;-webkit-shape-inside&quot;, &quot;outside-shape&quot;) is &quot;outside-shape&quot;
</span><span class="cx"> PASS getComputedStyleValue(&quot;-webkit-shape-inside&quot;, &quot;outside-shape&quot;) is &quot;outside-shape&quot;
</span></span></pre></div>
<a id="trunkLayoutTestsfastshapesparsingparsingshapeoutsideexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/shapes/parsing/parsing-shape-outside-expected.txt (162474 => 162475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shapes/parsing/parsing-shape-outside-expected.txt        2014-01-21 22:14:37 UTC (rev 162474)
+++ trunk/LayoutTests/fast/shapes/parsing/parsing-shape-outside-expected.txt        2014-01-21 22:23:53 UTC (rev 162475)
</span><span class="lines">@@ -107,13 +107,13 @@
</span><span class="cx"> PASS getComputedStyleValue(&quot;-webkit-shape-outside&quot;, &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) border-box&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) border-box&quot;
</span><span class="cx"> PASS getCSSText(&quot;-webkit-shape-outside&quot;, &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) margin-box&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) margin-box&quot;
</span><span class="cx"> PASS getComputedStyleValue(&quot;-webkit-shape-outside&quot;, &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) margin-box&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) margin-box&quot;
</span><del>-PASS getCSSText(&quot;-webkit-shape-outside&quot;, &quot;content-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) content-box&quot;
</del><ins>+PASS getCSSText(&quot;-webkit-shape-outside&quot;, &quot;content-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;content-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;
</ins><span class="cx"> PASS getComputedStyleValue(&quot;-webkit-shape-outside&quot;, &quot;content-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) content-box&quot;
</span><del>-PASS getCSSText(&quot;-webkit-shape-outside&quot;, &quot;padding-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) padding-box&quot;
</del><ins>+PASS getCSSText(&quot;-webkit-shape-outside&quot;, &quot;padding-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;padding-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;
</ins><span class="cx"> PASS getComputedStyleValue(&quot;-webkit-shape-outside&quot;, &quot;padding-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) padding-box&quot;
</span><del>-PASS getCSSText(&quot;-webkit-shape-outside&quot;, &quot;border-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) border-box&quot;
</del><ins>+PASS getCSSText(&quot;-webkit-shape-outside&quot;, &quot;border-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;border-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;
</ins><span class="cx"> PASS getComputedStyleValue(&quot;-webkit-shape-outside&quot;, &quot;border-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) border-box&quot;
</span><del>-PASS getCSSText(&quot;-webkit-shape-outside&quot;, &quot;margin-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) margin-box&quot;
</del><ins>+PASS getCSSText(&quot;-webkit-shape-outside&quot;, &quot;margin-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;margin-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;
</ins><span class="cx"> PASS getComputedStyleValue(&quot;-webkit-shape-outside&quot;, &quot;margin-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;) is &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) margin-box&quot;
</span><span class="cx"> PASS removeBaseURL(getCSSText(&quot;-webkit-shape-outside&quot;, &quot;url('image')&quot;)) is &quot;url(image)&quot;
</span><span class="cx"> PASS removeBaseURL(getComputedStyleValue(&quot;-webkit-shape-outside&quot;, &quot;url('image')&quot;)) is &quot;url(image)&quot;
</span></span></pre></div>
<a id="trunkLayoutTestsfastshapesparsingparsingtestutilsjs"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/fast/shapes/parsing/parsing-test-utils.js (162474 => 162475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/shapes/parsing/parsing-test-utils.js        2014-01-21 22:14:37 UTC (rev 162474)
+++ trunk/LayoutTests/fast/shapes/parsing/parsing-test-utils.js        2014-01-21 22:23:53 UTC (rev 162475)
</span><span class="lines">@@ -67,10 +67,10 @@
</span><span class="cx">     &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) border-box&quot;,
</span><span class="cx">     &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) margin-box&quot;,
</span><span class="cx"> 
</span><del>-    [&quot;content-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;, &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) content-box&quot;],
-    [&quot;padding-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;, &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) padding-box&quot;],
-    [&quot;border-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;, &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) border-box&quot;],
-    [&quot;margin-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;, &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) margin-box&quot;]
</del><ins>+    [&quot;content-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;, &quot;content-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;, &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) content-box&quot;],
+    [&quot;padding-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;, &quot;padding-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;, &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) padding-box&quot;],
+    [&quot;border-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;, &quot;border-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;, &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) border-box&quot;],
+    [&quot;margin-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;, &quot;margin-box polygon(nonzero, 0px 0px, 10px 10px, 10px 0px)&quot;, &quot;polygon(nonzero, 0px 0px, 10px 10px, 10px 0px) margin-box&quot;]
</ins><span class="cx"> ];
</span><span class="cx"> 
</span><span class="cx"> // Invalid values for both shape-inside and shape-outside. When an invalid shape value is specified, the 
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (162474 => 162475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-21 22:14:37 UTC (rev 162474)
+++ trunk/Source/WebCore/ChangeLog        2014-01-21 22:23:53 UTC (rev 162475)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2014-01-21  Bear Travis  &lt;betravis@adobe.com&gt;
+
+        [CSS Shapes] Preserve box-shape order when serializing shape values
+        https://bugs.webkit.org/show_bug.cgi?id=127200
+
+        Reviewed by Dirk Schulze.
+
+        Convert the parsed shape-box pair to a CSSValueList rather than directly
+        adding the box value to BasicShape. The CSSValueList preserves the
+        shape-box ordering, and cleans up a little bit of the code shared between
+        clip and shape values.
+
+        Modifying existing parsing tests.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::shapePropertyValue): Factor out code common to generating shape
+        values.
+        (WebCore::ComputedStyleExtractor::propertyValue): Generate a CSSValueList when
+        you have both a shape and a box.
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::parseBasicShapeAndOrBox): Factor out code common to clip
+        paths and shape properties that parses the [basic-shape || box] syntax from
+        the CSS Shapes spec.
+        (WebCore::CSSParser::parseShapeProperty): Parse shape-box pairs as a CSSValueList.
+        * css/DeprecatedStyleBuilder.cpp:
+        (WebCore::ApplyPropertyShape::applyValue): Use the CSSValueList for shape-box pairs.
+        * css/CSSValueList.h:
+        (WebCore::CSSValueList::itemWithoutBoundsCheck): Add a const version.
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::blendFunc): Specify a box when blending.
+        * rendering/style/ShapeValue.h:
+        (WebCore::ShapeValue::createShapeValue): Add a box parameter.
+        (WebCore::ShapeValue::ShapeValue): Ditto.
+
</ins><span class="cx"> 2014-01-21  Daniel Bates  &lt;dabates@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix the iOS Simulator release build
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSComputedStyleDeclarationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (162474 => 162475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2014-01-21 22:14:37 UTC (rev 162474)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp        2014-01-21 22:23:53 UTC (rev 162475)
</span><span class="lines">@@ -1763,6 +1763,31 @@
</span><span class="cx">     return styledNode-&gt;computedStyle(styledNode-&gt;isPseudoElement() ? NOPSEUDO : pseudoElementSpecifier);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if ENABLE(CSS_SHAPES)
+static PassRefPtr&lt;CSSValue&gt; shapePropertyValue(const RenderStyle* style, const ShapeValue* shapeValue)
+{
+    if (!shapeValue)
+        return cssValuePool().createIdentifierValue(CSSValueNone);
+
+    if (shapeValue-&gt;type() == ShapeValue::Outside)
+        return cssValuePool().createIdentifierValue(CSSValueOutsideShape);
+
+    if (shapeValue-&gt;type() == ShapeValue::Box)
+        return cssValuePool().createValue(shapeValue-&gt;layoutBox());
+
+    if (shapeValue-&gt;type() == ShapeValue::Image)
+        return shapeValue-&gt;image() ? shapeValue-&gt;image()-&gt;cssValue() : cssValuePool().createIdentifierValue(CSSValueNone);
+
+    ASSERT(shapeValue-&gt;type() == ShapeValue::Shape);
+
+    RefPtr&lt;CSSValueList&gt; list = CSSValueList::createSpaceSeparated();
+    list-&gt;append(valueForBasicShape(style, shapeValue-&gt;shape()));
+    if (shapeValue-&gt;layoutBox() != BoxMissing)
+        list-&gt;append(cssValuePool().createValue(shapeValue-&gt;layoutBox()));
+    return list.release();
+}
+#endif
+
</ins><span class="cx"> PassRefPtr&lt;CSSValue&gt; ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID, EUpdateLayout updateLayout) const
</span><span class="cx"> {
</span><span class="cx">     Node* styledNode = this-&gt;styledNode();
</span><span class="lines">@@ -2938,31 +2963,9 @@
</span><span class="cx">         case CSSPropertyWebkitShapeImageThreshold:
</span><span class="cx">             return cssValuePool().createValue(style-&gt;shapeImageThreshold(), CSSPrimitiveValue::CSS_NUMBER);
</span><span class="cx">         case CSSPropertyWebkitShapeInside:
</span><del>-            if (!style-&gt;shapeInside())
-                return cssValuePool().createIdentifierValue(CSSValueNone);
-            if (style-&gt;shapeInside()-&gt;type() == ShapeValue::Box)
-                return cssValuePool().createValue(style-&gt;shapeInside()-&gt;layoutBox());
-            if (style-&gt;shapeInside()-&gt;type() == ShapeValue::Outside)
-                return cssValuePool().createIdentifierValue(CSSValueOutsideShape);
-            if (style-&gt;shapeInside()-&gt;type() == ShapeValue::Image) {
-                if (style-&gt;shapeInside()-&gt;image())
-                    return style-&gt;shapeInside()-&gt;image()-&gt;cssValue();
-                return cssValuePool().createIdentifierValue(CSSValueNone);
-            }
-            ASSERT(style-&gt;shapeInside()-&gt;type() == ShapeValue::Shape);
-            return valueForBasicShape(style.get(), style-&gt;shapeInside()-&gt;shape());
</del><ins>+            return shapePropertyValue(style.get(), style-&gt;shapeInside());
</ins><span class="cx">         case CSSPropertyWebkitShapeOutside:
</span><del>-            if (!style-&gt;shapeOutside())
-                return cssValuePool().createIdentifierValue(CSSValueNone);
-            if (style-&gt;shapeOutside()-&gt;type() == ShapeValue::Box)
-                return cssValuePool().createValue(style-&gt;shapeOutside()-&gt;layoutBox());
-            if (style-&gt;shapeOutside()-&gt;type() == ShapeValue::Image) {
-                if (style-&gt;shapeOutside()-&gt;image())
-                    return style-&gt;shapeOutside()-&gt;image()-&gt;cssValue();
-                return cssValuePool().createIdentifierValue(CSSValueNone);
-            }
-            ASSERT(style-&gt;shapeOutside()-&gt;type() == ShapeValue::Shape);
-            return valueForBasicShape(style.get(), style-&gt;shapeOutside()-&gt;shape());
</del><ins>+            return shapePropertyValue(style.get(), style-&gt;shapeOutside());
</ins><span class="cx"> #endif
</span><span class="cx"> #if ENABLE(CSS_FILTERS)
</span><span class="cx">         case CSSPropertyWebkitFilter:
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.cpp (162474 => 162475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.cpp        2014-01-21 22:14:37 UTC (rev 162474)
+++ trunk/Source/WebCore/css/CSSParser.cpp        2014-01-21 22:23:53 UTC (rev 162475)
</span><span class="lines">@@ -5843,7 +5843,7 @@
</span><span class="cx">     return shape;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static bool isBoxValue(CSSValueID valueId)
</del><ins>+static bool isBoxValue(CSSValueID valueId, CSSPropertyID propId)
</ins><span class="cx"> {
</span><span class="cx">     switch (valueId) {
</span><span class="cx">     case CSSValueContentBox:
</span><span class="lines">@@ -5851,12 +5851,48 @@
</span><span class="cx">     case CSSValueBorderBox:
</span><span class="cx">     case CSSValueMarginBox:
</span><span class="cx">         return true;
</span><ins>+    case CSSValueBoundingBox:
+        return propId == CSSPropertyWebkitClipPath;
</ins><span class="cx">     default: break;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+PassRefPtr&lt;CSSValue&gt; CSSParser::parseBasicShapeAndOrBox(CSSPropertyID propId)
+{
+    CSSParserValue* value = m_valueList-&gt;current();
+
+    bool shapeFound = false;
+    bool boxFound = false;
+    CSSValueID valueId;
+
+    RefPtr&lt;CSSValueList&gt; list = CSSValueList::createSpaceSeparated();
+    for (unsigned i = 0; i &lt; 2; ++i) {
+        if (!value)
+            break;
+        valueId = value-&gt;id;
+        if (value-&gt;unit == CSSParserValue::Function &amp;&amp; !shapeFound) {
+            // parseBasicShape already asks for the next value list item.
+            RefPtr&lt;CSSPrimitiveValue&gt; shapeValue = parseBasicShape();
+            if (!shapeValue)
+                return nullptr;
+            list-&gt;append(shapeValue.release());
+            shapeFound = true;
+        } else if (isBoxValue(valueId, propId) &amp;&amp; !boxFound) {
+            list-&gt;append(parseValidPrimitive(valueId, value));
+            boxFound = true;
+            m_valueList-&gt;next();
+        } else
+            return nullptr;
+        value = m_valueList-&gt;current();
+    }
+
+    if (m_valueList-&gt;current())
+        return nullptr;
+    return list.release();
+}
+
</ins><span class="cx"> #if ENABLE(CSS_SHAPES)
</span><span class="cx"> PassRefPtr&lt;CSSValue&gt; CSSParser::parseShapeProperty(CSSPropertyID propId)
</span><span class="cx"> {
</span><span class="lines">@@ -5881,33 +5917,7 @@
</span><span class="cx">         return imageValue.release();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (value-&gt;unit == CSSParserValue::Function) {
-        shapeValue = parseBasicShape();
-    } else if (isBoxValue(valueId)) {
-        keywordValue = parseValidPrimitive(valueId, value);
-        m_valueList-&gt;next();
-    } else
-        return nullptr;
-
-    value = m_valueList-&gt;current();
-
-    if (value) {
-        valueId = value-&gt;id;
-        if (keywordValue &amp;&amp; value-&gt;unit == CSSParserValue::Function) {
-            shapeValue = parseBasicShape();
-        } else if (shapeValue &amp;&amp; isBoxValue(valueId)) {
-            keywordValue = parseValidPrimitive(valueId, value);
-            m_valueList-&gt;next();
-        } else
-            return nullptr;
-    }
-
-    ASSERT(!shapeValue || shapeValue-&gt;isShape());
-
-    if (shapeValue &amp;&amp; keywordValue)
-        shapeValue-&gt;getShapeValue()-&gt;setLayoutBox(keywordValue.release());
-
-    return shapeValue ? shapeValue.release() : keywordValue.release();
</del><ins>+    return parseBasicShapeAndOrBox(propId);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -5927,31 +5937,7 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    bool shapeFound = false;
-    bool boxFound = false;
-    RefPtr&lt;CSSValueList&gt; list = CSSValueList::createSpaceSeparated();
-    for (unsigned i = 0; i &lt; 2; ++i) {
-        if (!value)
-            break;
-        valueId = value-&gt;id;
-        if (value-&gt;unit == CSSParserValue::Function &amp;&amp; !shapeFound) {
-            // parseBasicShape already asks for the next value list item.
-            RefPtr&lt;CSSPrimitiveValue&gt; shapeValue = parseBasicShape();
-            if (!shapeValue)
-                return nullptr;
-            list-&gt;append(shapeValue.release());
-            shapeFound = true;
-        } else if ((isBoxValue(valueId) || valueId == CSSValueBoundingBox) &amp;&amp; !boxFound) {
-            list-&gt;append(parseValidPrimitive(valueId, value));
-            boxFound = true;
-            m_valueList-&gt;next();
-        } else
-            return nullptr;
-        value = m_valueList-&gt;current();
-    }
-    if (value)
-        return nullptr;
-    return list.release();
</del><ins>+    return parseBasicShapeAndOrBox(CSSPropertyWebkitClipPath);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // FIXME This function is temporary to allow for an orderly transition between
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.h (162474 => 162475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.h        2014-01-21 22:14:37 UTC (rev 162474)
+++ trunk/Source/WebCore/css/CSSParser.h        2014-01-21 22:23:53 UTC (rev 162475)
</span><span class="lines">@@ -179,6 +179,7 @@
</span><span class="cx">     PassRefPtr&lt;CSSValue&gt; parseShapeProperty(CSSPropertyID);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    PassRefPtr&lt;CSSValue&gt; parseBasicShapeAndOrBox(CSSPropertyID propId);
</ins><span class="cx">     PassRefPtr&lt;CSSPrimitiveValue&gt; parseBasicShape();
</span><span class="cx">     PassRefPtr&lt;CSSPrimitiveValue&gt; parseShapeRadius(CSSParserValue*);
</span><span class="cx">     PassRefPtr&lt;CSSBasicShape&gt; parseBasicShapeRectangle(CSSParserValueList*);
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSValueListh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSValueList.h (162474 => 162475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSValueList.h        2014-01-21 22:14:37 UTC (rev 162474)
+++ trunk/Source/WebCore/css/CSSValueList.h        2014-01-21 22:23:53 UTC (rev 162475)
</span><span class="lines">@@ -52,6 +52,7 @@
</span><span class="cx">     CSSValue* item(size_t index) { return index &lt; m_values.size() ? m_values[index].get() : 0; }
</span><span class="cx">     const CSSValue* item(size_t index) const { return index &lt; m_values.size() ? m_values[index].get() : 0; }
</span><span class="cx">     CSSValue* itemWithoutBoundsCheck(size_t index) { return m_values[index].get(); }
</span><ins>+    const CSSValue* itemWithoutBoundsCheck(size_t index) const { ASSERT(index &lt; m_values.size()); return m_values[index].get(); }
</ins><span class="cx"> 
</span><span class="cx">     void append(PassRefPtr&lt;CSSValue&gt; value) { m_values.append(value); }
</span><span class="cx">     void prepend(PassRefPtr&lt;CSSValue&gt; value) { m_values.insert(0, value); }
</span></span></pre></div>
<a id="trunkSourceWebCorecssDeprecatedStyleBuildercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp (162474 => 162475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp        2014-01-21 22:14:37 UTC (rev 162474)
+++ trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp        2014-01-21 22:23:53 UTC (rev 162475)
</span><span class="lines">@@ -2182,23 +2182,36 @@
</span><span class="cx">             CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(value);
</span><span class="cx">             if (primitiveValue-&gt;getValueID() == CSSValueAuto)
</span><span class="cx">                 setValue(styleResolver-&gt;style(), 0);
</span><del>-            else if (primitiveValue-&gt;getValueID() == CSSValueContentBox
-                || primitiveValue-&gt;getValueID() == CSSValueBorderBox
-                || primitiveValue-&gt;getValueID() == CSSValuePaddingBox
-                || primitiveValue-&gt;getValueID() == CSSValueMarginBox)
-                setValue(styleResolver-&gt;style(), ShapeValue::createLayoutBoxValue(LayoutBox(*primitiveValue)));
</del><span class="cx">             else if (primitiveValue-&gt;getValueID() == CSSValueOutsideShape)
</span><span class="cx">                 setValue(styleResolver-&gt;style(), ShapeValue::createOutsideValue());
</span><del>-            else if (primitiveValue-&gt;isShape()) {
-                RefPtr&lt;ShapeValue&gt; shape = ShapeValue::createShapeValue(basicShapeForValue(styleResolver-&gt;style(), styleResolver-&gt;rootElementStyle(), primitiveValue-&gt;getShapeValue()));
-                setValue(styleResolver-&gt;style(), shape.release());
-            }
</del><span class="cx">         } else if (value-&gt;isImageValue() || value-&gt;isImageSetValue()) {
</span><span class="cx">             RefPtr&lt;ShapeValue&gt; shape = ShapeValue::createImageValue(styleResolver-&gt;styleImage(property, value));
</span><span class="cx">             setValue(styleResolver-&gt;style(), shape.release());
</span><ins>+        } else if (value-&gt;isValueList()) {
+            RefPtr&lt;BasicShape&gt; shape;
+            LayoutBox layoutBox = BoxMissing;
+            CSSValueList* valueList = toCSSValueList(value);
+            for (unsigned i = 0; i &lt; valueList-&gt;length(); ++i) {
+                CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList-&gt;itemWithoutBoundsCheck(i));
+                if (primitiveValue-&gt;isShape())
+                    shape = basicShapeForValue(styleResolver-&gt;style(), styleResolver-&gt;rootElementStyle(), primitiveValue-&gt;getShapeValue());
+                else if (primitiveValue-&gt;getValueID() == CSSValueContentBox
+                    || primitiveValue-&gt;getValueID() == CSSValueBorderBox
+                    || primitiveValue-&gt;getValueID() == CSSValuePaddingBox
+                    || primitiveValue-&gt;getValueID() == CSSValueMarginBox)
+                    layoutBox = LayoutBox(*primitiveValue);
+                else
+                    return;
+            }
+
+            if (shape)
+                setValue(styleResolver-&gt;style(), ShapeValue::createShapeValue(shape.release(), layoutBox));
+            else if (layoutBox != BoxMissing)
+                setValue(styleResolver-&gt;style(), ShapeValue::createLayoutBoxValue(layoutBox));
+
</ins><span class="cx">         }
</span><ins>+    }
</ins><span class="cx"> 
</span><del>-    }
</del><span class="cx">     static PropertyHandler createHandler()
</span><span class="cx">     {
</span><span class="cx">         PropertyHandler handler = ApplyPropertyDefaultBase&lt;ShapeValue*, getterFunction, PassRefPtr&lt;ShapeValue&gt;, setterFunction, ShapeValue*, initialFunction&gt;::createHandler();
</span></span></pre></div>
<a id="trunkSourceWebCorepageanimationCSSPropertyAnimationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp (162474 => 162475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp        2014-01-21 22:14:37 UTC (rev 162474)
+++ trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp        2014-01-21 22:23:53 UTC (rev 162475)
</span><span class="lines">@@ -153,13 +153,16 @@
</span><span class="cx">     if (from-&gt;type() != ShapeValue::Shape || to-&gt;type() != ShapeValue::Shape)
</span><span class="cx">         return to;
</span><span class="cx"> 
</span><ins>+    if (from-&gt;layoutBox() != to-&gt;layoutBox())
+        return to;
+
</ins><span class="cx">     const BasicShape* fromShape = from-&gt;shape();
</span><span class="cx">     const BasicShape* toShape = to-&gt;shape();
</span><span class="cx"> 
</span><span class="cx">     if (!fromShape-&gt;canBlend(toShape))
</span><span class="cx">         return to;
</span><span class="cx"> 
</span><del>-    return ShapeValue::createShapeValue(toShape-&gt;blend(fromShape, progress));
</del><ins>+    return ShapeValue::createShapeValue(toShape-&gt;blend(fromShape, progress), to-&gt;layoutBox());
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorerenderingstyleShapeValueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/rendering/style/ShapeValue.h (162474 => 162475)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/rendering/style/ShapeValue.h        2014-01-21 22:14:37 UTC (rev 162474)
+++ trunk/Source/WebCore/rendering/style/ShapeValue.h        2014-01-21 22:23:53 UTC (rev 162475)
</span><span class="lines">@@ -48,9 +48,9 @@
</span><span class="cx">         Image
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    static PassRefPtr&lt;ShapeValue&gt; createShapeValue(PassRefPtr&lt;BasicShape&gt; shape)
</del><ins>+    static PassRefPtr&lt;ShapeValue&gt; createShapeValue(PassRefPtr&lt;BasicShape&gt; shape, LayoutBox layoutBox)
</ins><span class="cx">     {
</span><del>-        return adoptRef(new ShapeValue(shape));
</del><ins>+        return adoptRef(new ShapeValue(shape, layoutBox));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     static PassRefPtr&lt;ShapeValue&gt; createLayoutBoxValue(LayoutBox layoutBox)
</span><span class="lines">@@ -84,10 +84,10 @@
</span><span class="cx">     bool operator==(const ShapeValue&amp; other) const { return type() == other.type(); }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    ShapeValue(PassRefPtr&lt;BasicShape&gt; shape)
</del><ins>+    ShapeValue(PassRefPtr&lt;BasicShape&gt; shape, LayoutBox layoutBox)
</ins><span class="cx">         : m_type(Shape)
</span><span class="cx">         , m_shape(shape)
</span><del>-        , m_layoutBox(m_shape-&gt;layoutBox())
</del><ins>+        , m_layoutBox(layoutBox)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx">     ShapeValue(ShapeValueType type)
</span></span></pre>
</div>
</div>

</body>
</html>