<!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>[176674] 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/176674">176674</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2014-12-02 11:15:33 -0800 (Tue, 02 Dec 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Crash when setting 'flex' CSS property to 'calc(2 * 3) calc(2 * 3)'
https://bugs.webkit.org/show_bug.cgi?id=139162

Reviewed by Darin Adler.

Source/WebCore:

Add support for calculated values in 'flex' CSS property.
Previously, those did not work in release builds, and were hitting
an assertion in debug builds.

Test: fast/css/flex-calculated-value.html

* css/CSSParser.cpp:
(WebCore::CSSParser::validCalculationUnit):
Do not call RefPtr::release() as we are not interested in the return
value. Assign nullptr to the member instead.

(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parseFillPositionComponent):
(WebCore::CSSParser::parseCubicBezierTimingFunctionValue):
(WebCore::CSSParser::parseFontWeight):
(WebCore::CSSParser::parsedDouble):
(WebCore::CSSParser::colorIntFromValue):
(WebCore::CSSParser::parseColorParameters):
(WebCore::CSSParser::parseHSLParameters):
(WebCore::CSSParser::parseFlex):
* css/CSSParser.h:

LayoutTests:

Add layout test for calculated value support for 'flex' CSS property.

* fast/css/flex-calculated-value-expected.txt: Added.
* fast/css/flex-calculated-value.html: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</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="#trunkSourceWebCorecssCSSParserh">trunk/Source/WebCore/css/CSSParser.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsfastcssflexcalculatedvalueexpectedtxt">trunk/LayoutTests/fast/css/flex-calculated-value-expected.txt</a></li>
<li><a href="#trunkLayoutTestsfastcssflexcalculatedvaluehtml">trunk/LayoutTests/fast/css/flex-calculated-value.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (176673 => 176674)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2014-12-02 19:04:13 UTC (rev 176673)
+++ trunk/LayoutTests/ChangeLog        2014-12-02 19:15:33 UTC (rev 176674)
</span><span class="lines">@@ -1,5 +1,17 @@
</span><span class="cx"> 2014-12-02  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Crash when setting 'flex' CSS property to 'calc(2 * 3) calc(2 * 3)'
+        https://bugs.webkit.org/show_bug.cgi?id=139162
+
+        Reviewed by Darin Adler.
+
+        Add layout test for calculated value support for 'flex' CSS property.
+
+        * fast/css/flex-calculated-value-expected.txt: Added.
+        * fast/css/flex-calculated-value.html: Added.
+
+2014-12-02  Chris Dumez  &lt;cdumez@apple.com&gt;
+
</ins><span class="cx">         Crash when setting 'column-span' CSS property to 'calc(2 * 3)'
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=139170
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsfastcssflexcalculatedvalueexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/flex-calculated-value-expected.txt (0 => 176674)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/flex-calculated-value-expected.txt                                (rev 0)
+++ trunk/LayoutTests/fast/css/flex-calculated-value-expected.txt        2014-12-02 19:15:33 UTC (rev 176674)
</span><span class="lines">@@ -0,0 +1,19 @@
</span><ins>+Tests assigning a calculated values to 'flex' CSS property.
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS testDiv.style['flex'] is &quot;&quot;
+testDiv.style['flex'] = 'calc(2 * 3) calc(2 * 3)'
+PASS testDiv.style['flex'] is &quot;6 6 0px&quot;
+PASS window.getComputedStyle(testDiv).getPropertyValue('flex') is &quot;6 6 0px&quot;
+testDiv.style['flex'] = 'calc(2 * 3) calc(2 * 3) calc(10% * 2)'
+PASS testDiv.style['flex'] is &quot;6 6 calc(20%)&quot;
+PASS window.getComputedStyle(testDiv).getPropertyValue('flex') is &quot;6 6 20%&quot;
+testDiv.style['flex'] = 'calc(2 * 3) calc(2 * 3) calc(3 - 3)'
+PASS testDiv.style['flex'] is &quot;6 6 0px&quot;
+PASS window.getComputedStyle(testDiv).getPropertyValue('flex') is &quot;6 6 0px&quot;
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsfastcssflexcalculatedvaluehtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/fast/css/flex-calculated-value.html (0 => 176674)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/fast/css/flex-calculated-value.html                                (rev 0)
+++ trunk/LayoutTests/fast/css/flex-calculated-value.html        2014-12-02 19:15:33 UTC (rev 176674)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;body&gt;
+&lt;script src=&quot;../../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;div id=&quot;testDiv&quot;&gt;&lt;/div&gt;
+&lt;script&gt;
+description(&quot;Tests assigning a calculated values to 'flex' CSS property.&quot;);
+
+var testDiv = document.getElementById(&quot;testDiv&quot;);
+
+shouldBeEmptyString(&quot;testDiv.style['flex']&quot;);
+evalAndLog(&quot;testDiv.style['flex'] = 'calc(2 * 3) calc(2 * 3)'&quot;);
+shouldBeEqualToString(&quot;testDiv.style['flex']&quot;, &quot;6 6 0px&quot;);
+shouldBeEqualToString(&quot;window.getComputedStyle(testDiv).getPropertyValue('flex')&quot;, &quot;6 6 0px&quot;);
+
+evalAndLog(&quot;testDiv.style['flex'] = 'calc(2 * 3) calc(2 * 3) calc(10% * 2)'&quot;);
+shouldBeEqualToString(&quot;testDiv.style['flex']&quot;, &quot;6 6 calc(20%)&quot;);
+shouldBeEqualToString(&quot;window.getComputedStyle(testDiv).getPropertyValue('flex')&quot;, &quot;6 6 20%&quot;);
+
+evalAndLog(&quot;testDiv.style['flex'] = 'calc(2 * 3) calc(2 * 3) calc(3 - 3)'&quot;);
+shouldBeEqualToString(&quot;testDiv.style['flex']&quot;, &quot;6 6 0px&quot;);
+shouldBeEqualToString(&quot;window.getComputedStyle(testDiv).getPropertyValue('flex')&quot;, &quot;6 6 0px&quot;);
+
+&lt;/script&gt;
+&lt;script src=&quot;../../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
</ins></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (176673 => 176674)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-12-02 19:04:13 UTC (rev 176673)
+++ trunk/Source/WebCore/ChangeLog        2014-12-02 19:15:33 UTC (rev 176674)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2014-12-02  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Crash when setting 'flex' CSS property to 'calc(2 * 3) calc(2 * 3)'
+        https://bugs.webkit.org/show_bug.cgi?id=139162
+
+        Reviewed by Darin Adler.
+
+        Add support for calculated values in 'flex' CSS property.
+        Previously, those did not work in release builds, and were hitting
+        an assertion in debug builds.
+
+        Test: fast/css/flex-calculated-value.html
+
+        * css/CSSParser.cpp:
+        (WebCore::CSSParser::validCalculationUnit):
+        Do not call RefPtr::release() as we are not interested in the return
+        value. Assign nullptr to the member instead.
+
+        (WebCore::CSSParser::parseValue):
+        (WebCore::CSSParser::parseFillPositionComponent):
+        (WebCore::CSSParser::parseCubicBezierTimingFunctionValue):
+        (WebCore::CSSParser::parseFontWeight):
+        (WebCore::CSSParser::parsedDouble):
+        (WebCore::CSSParser::colorIntFromValue):
+        (WebCore::CSSParser::parseColorParameters):
+        (WebCore::CSSParser::parseHSLParameters):
+        (WebCore::CSSParser::parseFlex):
+        * css/CSSParser.h:
+
</ins><span class="cx"> 2014-12-02  Eric Carlson  &lt;eric.carlson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix logging typo
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.cpp (176673 => 176674)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.cpp        2014-12-02 19:04:13 UTC (rev 176673)
+++ trunk/Source/WebCore/css/CSSParser.cpp        2014-12-02 19:15:33 UTC (rev 176674)
</span><span class="lines">@@ -1624,7 +1624,7 @@
</span><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx">     if (!b || releaseCalc == ReleaseParsedCalcValue)
</span><del>-        m_parsedCalculation.release();
</del><ins>+        m_parsedCalculation = nullptr;
</ins><span class="cx">     return b;    
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -2504,7 +2504,7 @@
</span><span class="cx">     case CSSPropertyOrder:
</span><span class="cx">         if (validUnit(value, FInteger, CSSStrictMode)) {
</span><span class="cx">             // We restrict the smallest value to int min + 2 because we use int min and int min + 1 as special values in a hash set.
</span><del>-            double result = std::max&lt;double&gt;(std::numeric_limits&lt;int&gt;::min() + 2, parsedDouble(value, ReleaseParsedCalcValue));
</del><ins>+            double result = std::max&lt;double&gt;(std::numeric_limits&lt;int&gt;::min() + 2, parsedDouble(*value, ReleaseParsedCalcValue));
</ins><span class="cx">             parsedValue = cssValuePool().createValue(result, CSSPrimitiveValue::CSS_NUMBER);
</span><span class="cx">             m_valueList-&gt;next();
</span><span class="cx">         }
</span><span class="lines">@@ -2720,7 +2720,7 @@
</span><span class="cx">     case CSSPropertyColumnSpan: // none | all | 1 (will be dropped in the unprefixed property)
</span><span class="cx">         if (id == CSSValueAll || id == CSSValueNone)
</span><span class="cx">             validPrimitive = true;
</span><del>-        else if (validUnit(value, FNumber | FNonNeg) &amp;&amp; parsedDouble(value, ReleaseParsedCalcValue) == 1) {
</del><ins>+        else if (validUnit(value, FNumber | FNonNeg) &amp;&amp; parsedDouble(*value, ReleaseParsedCalcValue) == 1) {
</ins><span class="cx">             addProperty(CSSPropertyColumnSpan, cssValuePool().createValue(1, CSSPrimitiveValue::CSS_NUMBER), important);
</span><span class="cx">             return true;
</span><span class="cx">         }
</span><span class="lines">@@ -2730,7 +2730,7 @@
</span><span class="cx">             validPrimitive = true;
</span><span class="cx">         else {
</span><span class="cx">             // Always parse this property in strict mode, since it would be ambiguous otherwise when used in the 'columns' shorthand property.
</span><del>-            validPrimitive = validUnit(value, FLength | FNonNeg, CSSStrictMode) &amp;&amp; parsedDouble(value);
</del><ins>+            validPrimitive = validUnit(value, FLength | FNonNeg, CSSStrictMode) &amp;&amp; parsedDouble(*value);
</ins><span class="cx">             if (!validPrimitive)
</span><span class="cx">                 m_parsedCalculation.clear();
</span><span class="cx">         }
</span><span class="lines">@@ -4002,7 +4002,7 @@
</span><span class="cx">         int percent = 0;
</span><span class="cx">         if (id == CSSValueLeft || id == CSSValueRight) {
</span><span class="cx">             if (cumulativeFlags &amp; XFillPosition)
</span><del>-                return 0;
</del><ins>+                return nullptr;
</ins><span class="cx">             cumulativeFlags |= XFillPosition;
</span><span class="cx">             individualFlag = XFillPosition;
</span><span class="cx">             if (id == CSSValueRight)
</span><span class="lines">@@ -4010,7 +4010,7 @@
</span><span class="cx">         }
</span><span class="cx">         else if (id == CSSValueTop || id == CSSValueBottom) {
</span><span class="cx">             if (cumulativeFlags &amp; YFillPosition)
</span><del>-                return 0;
</del><ins>+                return nullptr;
</ins><span class="cx">             cumulativeFlags |= YFillPosition;
</span><span class="cx">             individualFlag = YFillPosition;
</span><span class="cx">             if (id == CSSValueBottom)
</span><span class="lines">@@ -4036,12 +4036,12 @@
</span><span class="cx">             individualFlag = YFillPosition;
</span><span class="cx">         } else {
</span><span class="cx">             if (m_parsedCalculation)
</span><del>-                m_parsedCalculation.release();
-            return 0;
</del><ins>+                m_parsedCalculation = nullptr;
+            return nullptr;
</ins><span class="cx">         }
</span><span class="cx">         return createPrimitiveNumericValue(valueList-&gt;current());
</span><span class="cx">     }
</span><del>-    return 0;
</del><ins>+    return nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static bool isValueConflictingWithCurrentEdge(int value1, int value2)
</span><span class="lines">@@ -4682,15 +4682,16 @@
</span><span class="cx"> 
</span><span class="cx"> bool CSSParser::parseCubicBezierTimingFunctionValue(CSSParserValueList*&amp; args, double&amp; result)
</span><span class="cx"> {
</span><del>-    CSSParserValue* v = args-&gt;current();
-    if (!validUnit(v, FNumber))
</del><ins>+    CSSParserValue* value = args-&gt;current();
+    if (!validUnit(value, FNumber))
</ins><span class="cx">         return false;
</span><del>-    result = parsedDouble(v, ReleaseParsedCalcValue);
-    v = args-&gt;next();
-    if (!v)
</del><ins>+    result = parsedDouble(*value, ReleaseParsedCalcValue);
+    value = args-&gt;next();
+    if (!value) {
</ins><span class="cx">         // The last number in the function has no comma after it, so we're done.
</span><span class="cx">         return true;
</span><del>-    if (!isComma(v))
</del><ins>+    }
+    if (!isComma(value))
</ins><span class="cx">         return false;
</span><span class="cx">     args-&gt;next();
</span><span class="cx">     return true;
</span><span class="lines">@@ -6448,12 +6449,12 @@
</span><span class="cx"> 
</span><span class="cx"> bool CSSParser::parseFontWeight(bool important)
</span><span class="cx"> {
</span><del>-    CSSParserValue* value = m_valueList-&gt;current();
-    if ((value-&gt;id &gt;= CSSValueNormal) &amp;&amp; (value-&gt;id &lt;= CSSValue900)) {
-        addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierValue(value-&gt;id), important);
</del><ins>+    CSSParserValue&amp; value = *m_valueList-&gt;current();
+    if ((value.id &gt;= CSSValueNormal) &amp;&amp; (value.id &lt;= CSSValue900)) {
+        addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierValue(value.id), important);
</ins><span class="cx">         return true;
</span><span class="cx">     }
</span><del>-    if (validUnit(value, FInteger | FNonNeg, CSSQuirksMode)) {
</del><ins>+    if (validUnit(&amp;value, FInteger | FNonNeg, CSSQuirksMode)) {
</ins><span class="cx">         int weight = static_cast&lt;int&gt;(parsedDouble(value, ReleaseParsedCalcValue));
</span><span class="cx">         if (!(weight % 100) &amp;&amp; weight &gt;= 100 &amp;&amp; weight &lt;= 900) {
</span><span class="cx">             addProperty(CSSPropertyFontWeight, cssValuePool().createIdentifierValue(createFontWeightValueKeyword(weight)), important);
</span><span class="lines">@@ -6949,11 +6950,11 @@
</span><span class="cx">     return false;
</span><span class="cx"> }
</span><span class="cx">     
</span><del>-inline double CSSParser::parsedDouble(CSSParserValue *v, ReleaseParsedCalcValueCondition releaseCalc)
</del><ins>+inline double CSSParser::parsedDouble(CSSParserValue&amp; value, ReleaseParsedCalcValueCondition releaseCalc)
</ins><span class="cx"> {
</span><del>-    const double result = m_parsedCalculation ? m_parsedCalculation-&gt;doubleValue() : v-&gt;fValue;
</del><ins>+    double result = m_parsedCalculation ? m_parsedCalculation-&gt;doubleValue() : value.fValue;
</ins><span class="cx">     if (releaseCalc == ReleaseParsedCalcValue)
</span><del>-        m_parsedCalculation.release();
</del><ins>+        m_parsedCalculation = nullptr;
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -6966,66 +6967,66 @@
</span><span class="cx">             || equalIgnoringCase(value-&gt;function-&gt;name, &quot;-webkit-max(&quot;));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-inline int CSSParser::colorIntFromValue(CSSParserValue* v)
</del><ins>+inline int CSSParser::colorIntFromValue(CSSParserValue&amp; value)
</ins><span class="cx"> {
</span><span class="cx">     bool isPercent;
</span><span class="cx">     
</span><span class="cx">     if (m_parsedCalculation)
</span><span class="cx">         isPercent = m_parsedCalculation-&gt;category() == CalcPercent;
</span><span class="cx">     else
</span><del>-        isPercent = v-&gt;unit == CSSPrimitiveValue::CSS_PERCENTAGE;
</del><ins>+        isPercent = value.unit == CSSPrimitiveValue::CSS_PERCENTAGE;
</ins><span class="cx"> 
</span><del>-    const double value = parsedDouble(v, ReleaseParsedCalcValue);
</del><ins>+    const double doubleValue = parsedDouble(value, ReleaseParsedCalcValue);
</ins><span class="cx">     
</span><del>-    if (value &lt;= 0.0)
</del><ins>+    if (doubleValue &lt;= 0.0)
</ins><span class="cx">         return 0;
</span><span class="cx"> 
</span><span class="cx">     if (isPercent) {
</span><del>-        if (value &gt;= 100.0)
</del><ins>+        if (doubleValue &gt;= 100.0)
</ins><span class="cx">             return 255;
</span><del>-        return static_cast&lt;int&gt;(value * 256.0 / 100.0);
</del><ins>+        return static_cast&lt;int&gt;(doubleValue * 256.0 / 100.0);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (value &gt;= 255.0)
</del><ins>+    if (doubleValue &gt;= 255.0)
</ins><span class="cx">         return 255;
</span><span class="cx"> 
</span><del>-    return static_cast&lt;int&gt;(value);
</del><ins>+    return static_cast&lt;int&gt;(doubleValue);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool CSSParser::parseColorParameters(CSSParserValue* value, int* colorArray, bool parseAlpha)
</span><span class="cx"> {
</span><span class="cx">     CSSParserValueList* args = value-&gt;function-&gt;args.get();
</span><del>-    CSSParserValue* v = args-&gt;current();
</del><ins>+    CSSParserValue* currentValue = args-&gt;current();
</ins><span class="cx">     Units unitType = FUnknown;
</span><span class="cx">     // Get the first value and its type
</span><del>-    if (validUnit(v, FInteger, CSSStrictMode))
</del><ins>+    if (validUnit(currentValue, FInteger, CSSStrictMode))
</ins><span class="cx">         unitType = FInteger;
</span><del>-    else if (validUnit(v, FPercent, CSSStrictMode))
</del><ins>+    else if (validUnit(currentValue, FPercent, CSSStrictMode))
</ins><span class="cx">         unitType = FPercent;
</span><span class="cx">     else
</span><span class="cx">         return false;
</span><span class="cx">     
</span><del>-    colorArray[0] = colorIntFromValue(v);
</del><ins>+    colorArray[0] = colorIntFromValue(*currentValue);
</ins><span class="cx">     for (int i = 1; i &lt; 3; i++) {
</span><del>-        v = args-&gt;next();
-        if (v-&gt;unit != CSSParserValue::Operator &amp;&amp; v-&gt;iValue != ',')
</del><ins>+        currentValue = args-&gt;next();
+        if (currentValue-&gt;unit != CSSParserValue::Operator &amp;&amp; currentValue-&gt;iValue != ',')
</ins><span class="cx">             return false;
</span><del>-        v = args-&gt;next();
-        if (!validUnit(v, unitType, CSSStrictMode))
</del><ins>+        currentValue = args-&gt;next();
+        if (!validUnit(currentValue, unitType, CSSStrictMode))
</ins><span class="cx">             return false;
</span><del>-        colorArray[i] = colorIntFromValue(v);
</del><ins>+        colorArray[i] = colorIntFromValue(*currentValue);
</ins><span class="cx">     }
</span><span class="cx">     if (parseAlpha) {
</span><del>-        v = args-&gt;next();
-        if (v-&gt;unit != CSSParserValue::Operator &amp;&amp; v-&gt;iValue != ',')
</del><ins>+        currentValue = args-&gt;next();
+        if (currentValue-&gt;unit != CSSParserValue::Operator &amp;&amp; currentValue-&gt;iValue != ',')
</ins><span class="cx">             return false;
</span><del>-        v = args-&gt;next();
-        if (!validUnit(v, FNumber, CSSStrictMode))
</del><ins>+        currentValue = args-&gt;next();
+        if (!validUnit(currentValue, FNumber, CSSStrictMode))
</ins><span class="cx">             return false;
</span><del>-        const double value = parsedDouble(v, ReleaseParsedCalcValue);
</del><ins>+        double doubleValue = parsedDouble(*currentValue, ReleaseParsedCalcValue);
</ins><span class="cx">         // Convert the floating pointer number of alpha to an integer in the range [0, 256),
</span><span class="cx">         // with an equal distribution across all 256 values.
</span><del>-        colorArray[3] = static_cast&lt;int&gt;(std::max&lt;double&gt;(0, std::min&lt;double&gt;(1, value)) * nextafter(256.0, 0.0));
</del><ins>+        colorArray[3] = static_cast&lt;int&gt;(std::max&lt;double&gt;(0, std::min&lt;double&gt;(1, doubleValue)) * nextafter(256.0, 0.0));
</ins><span class="cx">     }
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -7038,29 +7039,29 @@
</span><span class="cx"> bool CSSParser::parseHSLParameters(CSSParserValue* value, double* colorArray, bool parseAlpha)
</span><span class="cx"> {
</span><span class="cx">     CSSParserValueList* args = value-&gt;function-&gt;args.get();
</span><del>-    CSSParserValue* v = args-&gt;current();
</del><ins>+    CSSParserValue* currentValue = args-&gt;current();
</ins><span class="cx">     // Get the first value
</span><del>-    if (!validUnit(v, FNumber, CSSStrictMode))
</del><ins>+    if (!validUnit(currentValue, FNumber, CSSStrictMode))
</ins><span class="cx">         return false;
</span><span class="cx">     // normalize the Hue value and change it to be between 0 and 1.0
</span><del>-    colorArray[0] = (((static_cast&lt;int&gt;(parsedDouble(v, ReleaseParsedCalcValue)) % 360) + 360) % 360) / 360.0;
-    for (int i = 1; i &lt; 3; i++) {
-        v = args-&gt;next();
-        if (v-&gt;unit != CSSParserValue::Operator &amp;&amp; v-&gt;iValue != ',')
</del><ins>+    colorArray[0] = (((static_cast&lt;int&gt;(parsedDouble(*currentValue, ReleaseParsedCalcValue)) % 360) + 360) % 360) / 360.0;
+    for (int i = 1; i &lt; 3; ++i) {
+        currentValue = args-&gt;next();
+        if (currentValue-&gt;unit != CSSParserValue::Operator &amp;&amp; currentValue-&gt;iValue != ',')
</ins><span class="cx">             return false;
</span><del>-        v = args-&gt;next();
-        if (!validUnit(v, FPercent, CSSStrictMode))
</del><ins>+        currentValue = args-&gt;next();
+        if (!validUnit(currentValue, FPercent, CSSStrictMode))
</ins><span class="cx">             return false;
</span><del>-        colorArray[i] = std::max&lt;double&gt;(0, std::min&lt;double&gt;(100, parsedDouble(v, ReleaseParsedCalcValue))) / 100.0; // needs to be value between 0 and 1.0
</del><ins>+        colorArray[i] = std::max&lt;double&gt;(0, std::min&lt;double&gt;(100, parsedDouble(*currentValue, ReleaseParsedCalcValue))) / 100.0; // needs to be value between 0 and 1.0
</ins><span class="cx">     }
</span><span class="cx">     if (parseAlpha) {
</span><del>-        v = args-&gt;next();
-        if (v-&gt;unit != CSSParserValue::Operator &amp;&amp; v-&gt;iValue != ',')
</del><ins>+        currentValue = args-&gt;next();
+        if (currentValue-&gt;unit != CSSParserValue::Operator &amp;&amp; currentValue-&gt;iValue != ',')
</ins><span class="cx">             return false;
</span><del>-        v = args-&gt;next();
-        if (!validUnit(v, FNumber, CSSStrictMode))
</del><ins>+        currentValue = args-&gt;next();
+        if (!validUnit(currentValue, FNumber, CSSStrictMode))
</ins><span class="cx">             return false;
</span><del>-        colorArray[3] = std::max&lt;double&gt;(0, std::min&lt;double&gt;(1, parsedDouble(v, ReleaseParsedCalcValue)));
</del><ins>+        colorArray[3] = std::max&lt;double&gt;(0, std::min&lt;double&gt;(1, parsedDouble(*currentValue, ReleaseParsedCalcValue)));
</ins><span class="cx">     }
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -7368,10 +7369,10 @@
</span><span class="cx">     while (CSSParserValue* arg = args-&gt;current()) {
</span><span class="cx">         if (validUnit(arg, FNumber | FNonNeg)) {
</span><span class="cx">             if (flexGrow == unsetValue)
</span><del>-                flexGrow = arg-&gt;fValue;
</del><ins>+                flexGrow = parsedDouble(*arg, ReleaseParsedCalcValue);
</ins><span class="cx">             else if (flexShrink == unsetValue)
</span><del>-                flexShrink = arg-&gt;fValue;
-            else if (!arg-&gt;fValue) {
</del><ins>+                flexShrink = parsedDouble(*arg, ReleaseParsedCalcValue);
+            else if (!parsedDouble(*arg, ReleaseParsedCalcValue)) {
</ins><span class="cx">                 // flex only allows a basis of 0 (sans units) if flex-grow and flex-shrink values have already been set.
</span><span class="cx">                 flexBasis = cssValuePool().createValue(0, CSSPrimitiveValue::CSS_PX);
</span><span class="cx">             } else {
</span></span></pre></div>
<a id="trunkSourceWebCorecssCSSParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.h (176673 => 176674)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/CSSParser.h        2014-12-02 19:04:13 UTC (rev 176673)
+++ trunk/Source/WebCore/css/CSSParser.h        2014-12-02 19:15:33 UTC (rev 176674)
</span><span class="lines">@@ -623,8 +623,8 @@
</span><span class="cx">     bool validUnit(CSSParserValue*, Units, CSSParserMode, ReleaseParsedCalcValueCondition releaseCalc = DoNotReleaseParsedCalcValue);
</span><span class="cx"> 
</span><span class="cx">     bool parseBorderImageQuad(Units, RefPtr&lt;CSSPrimitiveValue&gt;&amp;);
</span><del>-    int colorIntFromValue(CSSParserValue*);
-    double parsedDouble(CSSParserValue*, ReleaseParsedCalcValueCondition releaseCalc = DoNotReleaseParsedCalcValue);
</del><ins>+    int colorIntFromValue(CSSParserValue&amp;);
+    double parsedDouble(CSSParserValue&amp;, ReleaseParsedCalcValueCondition releaseCalc = DoNotReleaseParsedCalcValue);
</ins><span class="cx">     
</span><span class="cx">     friend class TransformOperationInfo;
</span><span class="cx">     friend class FilterOperationInfo;
</span></span></pre>
</div>
</div>

</body>
</html>