<!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>[208294] 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/208294">208294</a></dd>
<dt>Author</dt> <dd>dino@apple.com</dd>
<dt>Date</dt> <dd>2016-11-02 11:26:26 -0700 (Wed, 02 Nov 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Filter functions grayscale/invert/opacity/sepia should clamp values over 100%, not fail
https://bugs.webkit.org/show_bug.cgi?id=164310
Source/WebCore:

Reviewed by Sam Weinig.

When bringing up the new CSS parser, I discovered that our old parser was
not conforming to the specification.

Covered by existing tests.

* css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseBuiltinFilterArguments): For these functions, clamp to
100% rather than fail.

LayoutTests:

&lt;rdar://problems/29057705&gt;

Reviewed by Sam Weinig.

Some of our tests were incorrectly suggesting values over 100% should fail.

* css3/filters/backdrop/backdropfilter-property-parsing-invalid-expected.txt:
* css3/filters/backdrop/backdropfilter-property-parsing-invalid.html:
* css3/filters/filter-property-parsing-expected.txt:
* css3/filters/filter-property-parsing-invalid-expected.txt:
* css3/filters/filter-property-parsing-invalid.html:
* css3/filters/filter-property-parsing.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestscss3filtersbackdropbackdropfilterpropertyparsinginvalidexpectedtxt">trunk/LayoutTests/css3/filters/backdrop/backdropfilter-property-parsing-invalid-expected.txt</a></li>
<li><a href="#trunkLayoutTestscss3filtersbackdropbackdropfilterpropertyparsinginvalidhtml">trunk/LayoutTests/css3/filters/backdrop/backdropfilter-property-parsing-invalid.html</a></li>
<li><a href="#trunkLayoutTestscss3filtersfilterpropertyparsingexpectedtxt">trunk/LayoutTests/css3/filters/filter-property-parsing-expected.txt</a></li>
<li><a href="#trunkLayoutTestscss3filtersfilterpropertyparsinginvalidexpectedtxt">trunk/LayoutTests/css3/filters/filter-property-parsing-invalid-expected.txt</a></li>
<li><a href="#trunkLayoutTestscss3filtersfilterpropertyparsinginvalidhtml">trunk/LayoutTests/css3/filters/filter-property-parsing-invalid.html</a></li>
<li><a href="#trunkLayoutTestscss3filtersfilterpropertyparsinghtml">trunk/LayoutTests/css3/filters/filter-property-parsing.html</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorecssparserCSSParsercpp">trunk/Source/WebCore/css/parser/CSSParser.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (208293 => 208294)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-11-02 18:24:18 UTC (rev 208293)
+++ trunk/LayoutTests/ChangeLog        2016-11-02 18:26:26 UTC (rev 208294)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-11-01  Dean Jackson  &lt;dino@apple.com&gt;
+
+        Filter functions grayscale/invert/opacity/sepia should clamp values over 100%, not fail
+        https://bugs.webkit.org/show_bug.cgi?id=164310
+        &lt;rdar://problems/29057705&gt;
+
+        Reviewed by Sam Weinig.
+
+        Some of our tests were incorrectly suggesting values over 100% should fail.
+
+        * css3/filters/backdrop/backdropfilter-property-parsing-invalid-expected.txt:
+        * css3/filters/backdrop/backdropfilter-property-parsing-invalid.html:
+        * css3/filters/filter-property-parsing-expected.txt:
+        * css3/filters/filter-property-parsing-invalid-expected.txt:
+        * css3/filters/filter-property-parsing-invalid.html:
+        * css3/filters/filter-property-parsing.html:
+
</ins><span class="cx"> 2016-11-02  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WebKit nullptr dereference Archive Subframe
</span></span></pre></div>
<a id="trunkLayoutTestscss3filtersbackdropbackdropfilterpropertyparsinginvalidexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/css3/filters/backdrop/backdropfilter-property-parsing-invalid-expected.txt (208293 => 208294)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/filters/backdrop/backdropfilter-property-parsing-invalid-expected.txt        2016-11-02 18:24:18 UTC (rev 208293)
+++ trunk/LayoutTests/css3/filters/backdrop/backdropfilter-property-parsing-invalid-expected.txt        2016-11-02 18:26:26 UTC (rev 208294)
</span><span class="lines">@@ -39,11 +39,6 @@
</span><span class="cx"> PASS declaration.length is 0
</span><span class="cx"> PASS declaration.getPropertyValue('-webkit-backdrop-filter') is &quot;&quot;
</span><span class="cx"> 
</span><del>-Parameter out of bounds : grayscale(1.5)
-PASS cssRule.type is 1
-PASS declaration.length is 0
-PASS declaration.getPropertyValue('-webkit-backdrop-filter') is &quot;&quot;
-
</del><span class="cx"> Too many parameters : sepia(0.5 0.5 3.0)
</span><span class="cx"> PASS cssRule.type is 1
</span><span class="cx"> PASS declaration.length is 0
</span><span class="lines">@@ -69,11 +64,6 @@
</span><span class="cx"> PASS declaration.length is 0
</span><span class="cx"> PASS declaration.getPropertyValue('-webkit-backdrop-filter') is &quot;&quot;
</span><span class="cx"> 
</span><del>-Parameter out of bounds : sepia(10000)
-PASS cssRule.type is 1
-PASS declaration.length is 0
-PASS declaration.getPropertyValue('-webkit-backdrop-filter') is &quot;&quot;
-
</del><span class="cx"> Length instead of number : saturate(10px)
</span><span class="cx"> PASS cssRule.type is 1
</span><span class="cx"> PASS declaration.length is 0
</span><span class="lines">@@ -154,11 +144,6 @@
</span><span class="cx"> PASS declaration.length is 0
</span><span class="cx"> PASS declaration.getPropertyValue('-webkit-backdrop-filter') is &quot;&quot;
</span><span class="cx"> 
</span><del>-Parameter out of bounds : invert(1.5)
-PASS cssRule.type is 1
-PASS declaration.length is 0
-PASS declaration.getPropertyValue('-webkit-backdrop-filter') is &quot;&quot;
-
</del><span class="cx"> Length instead of number : opacity(10px)
</span><span class="cx"> PASS cssRule.type is 1
</span><span class="cx"> PASS declaration.length is 0
</span><span class="lines">@@ -189,11 +174,6 @@
</span><span class="cx"> PASS declaration.length is 0
</span><span class="cx"> PASS declaration.getPropertyValue('-webkit-backdrop-filter') is &quot;&quot;
</span><span class="cx"> 
</span><del>-Parameter out of bounds : opacity(1.5)
-PASS cssRule.type is 1
-PASS declaration.length is 0
-PASS declaration.getPropertyValue('-webkit-backdrop-filter') is &quot;&quot;
-
</del><span class="cx"> Length instead of number : brightness(10px)
</span><span class="cx"> PASS cssRule.type is 1
</span><span class="cx"> PASS declaration.length is 0
</span></span></pre></div>
<a id="trunkLayoutTestscss3filtersbackdropbackdropfilterpropertyparsinginvalidhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/css3/filters/backdrop/backdropfilter-property-parsing-invalid.html (208293 => 208294)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/filters/backdrop/backdropfilter-property-parsing-invalid.html        2016-11-02 18:24:18 UTC (rev 208293)
+++ trunk/LayoutTests/css3/filters/backdrop/backdropfilter-property-parsing-invalid.html        2016-11-02 18:26:26 UTC (rev 208294)
</span><span class="lines">@@ -38,7 +38,6 @@
</span><span class="cx"> testInvalidFilterRule(&quot;Trailing comma&quot;, &quot;grayscale(0.5,)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Negative parameter&quot;, &quot;grayscale(-0.5)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Negative percent&quot;, &quot;grayscale(-10%)&quot;);
</span><del>-testInvalidFilterRule(&quot;Parameter out of bounds&quot;, &quot;grayscale(1.5)&quot;);
</del><span class="cx"> 
</span><span class="cx"> testInvalidFilterRule(&quot;Too many parameters&quot;, &quot;sepia(0.5 0.5 3.0)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Too many parameters and commas&quot;, &quot;sepia(0.1, 0.1)&quot;);
</span><span class="lines">@@ -45,7 +44,6 @@
</span><span class="cx"> testInvalidFilterRule(&quot;Trailing comma&quot;, &quot;sepia(0.5,)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Negative parameter&quot;, &quot;sepia(-0.01)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Negative percent&quot;, &quot;sepia(-10%)&quot;);
</span><del>-testInvalidFilterRule(&quot;Parameter out of bounds&quot;, &quot;sepia(10000)&quot;);
</del><span class="cx"> 
</span><span class="cx"> testInvalidFilterRule(&quot;Length instead of number&quot;, &quot;saturate(10px)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Too many parameters&quot;, &quot;saturate(0.5 0.5)&quot;);
</span><span class="lines">@@ -65,7 +63,6 @@
</span><span class="cx"> testInvalidFilterRule(&quot;Too many parameters and commas&quot;, &quot;invert(0.5, 0.5)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Trailing comma&quot;, &quot;invert(0.5,)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Negative parameter&quot;, &quot;invert(-0.5)&quot;);
</span><del>-testInvalidFilterRule(&quot;Parameter out of bounds&quot;, &quot;invert(1.5)&quot;);
</del><span class="cx"> 
</span><span class="cx"> testInvalidFilterRule(&quot;Length instead of number&quot;, &quot;opacity(10px)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Too many parameters&quot;, &quot;opacity(0.5 0.5)&quot;);
</span><span class="lines">@@ -73,7 +70,6 @@
</span><span class="cx"> testInvalidFilterRule(&quot;Trailing comma&quot;, &quot;opacity(0.5,)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Negative parameter&quot;, &quot;opacity(-0.5)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Negative percent&quot;, &quot;opacity(-10%)&quot;);
</span><del>-testInvalidFilterRule(&quot;Parameter out of bounds&quot;, &quot;opacity(1.5)&quot;);
</del><span class="cx"> 
</span><span class="cx"> testInvalidFilterRule(&quot;Length instead of number&quot;, &quot;brightness(10px)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Too many parameters&quot;, &quot;brightness(0.5 0.5)&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestscss3filtersfilterpropertyparsingexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/css3/filters/filter-property-parsing-expected.txt (208293 => 208294)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/filters/filter-property-parsing-expected.txt        2016-11-02 18:24:18 UTC (rev 208293)
+++ trunk/LayoutTests/css3/filters/filter-property-parsing-expected.txt        2016-11-02 18:26:26 UTC (rev 208294)
</span><span class="lines">@@ -76,6 +76,26 @@
</span><span class="cx"> PASS filterRule.length is 1
</span><span class="cx"> PASS subRule.cssText is &quot;grayscale(1)&quot;
</span><span class="cx"> 
</span><ins>+Values over 1 are clamped : grayscale(1.5)
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('filter') is &quot;grayscale(1)&quot;
+PASS jsWrapperClass(filterRule) is 'CSSValueList'
+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype'
+PASS jsWrapperClass(filterRule.constructor) is 'Function'
+PASS filterRule.length is 1
+PASS subRule.cssText is &quot;grayscale(1)&quot;
+
+Percentages over 100 are clamped : grayscale(320%)
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('filter') is &quot;grayscale(100%)&quot;
+PASS jsWrapperClass(filterRule) is 'CSSValueList'
+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype'
+PASS jsWrapperClass(filterRule.constructor) is 'Function'
+PASS filterRule.length is 1
+PASS subRule.cssText is &quot;grayscale(100%)&quot;
+
</ins><span class="cx"> Zero value : grayscale(0)
</span><span class="cx"> PASS cssRule.type is 1
</span><span class="cx"> PASS declaration.length is 1
</span><span class="lines">@@ -137,6 +157,26 @@
</span><span class="cx"> PASS filterRule.length is 1
</span><span class="cx"> PASS subRule.cssText is &quot;sepia(1)&quot;
</span><span class="cx"> 
</span><ins>+Values over 1 are clamped : sepia(8)
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('filter') is &quot;sepia(1)&quot;
+PASS jsWrapperClass(filterRule) is 'CSSValueList'
+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype'
+PASS jsWrapperClass(filterRule.constructor) is 'Function'
+PASS filterRule.length is 1
+PASS subRule.cssText is &quot;sepia(1)&quot;
+
+Percentages over 100 are clamped : sepia(101%)
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('filter') is &quot;sepia(100%)&quot;
+PASS jsWrapperClass(filterRule) is 'CSSValueList'
+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype'
+PASS jsWrapperClass(filterRule.constructor) is 'Function'
+PASS filterRule.length is 1
+PASS subRule.cssText is &quot;sepia(100%)&quot;
+
</ins><span class="cx"> Zero value : sepia(0)
</span><span class="cx"> PASS cssRule.type is 1
</span><span class="cx"> PASS declaration.length is 1
</span><span class="lines">@@ -382,6 +422,26 @@
</span><span class="cx"> PASS filterRule.length is 1
</span><span class="cx"> PASS subRule.cssText is &quot;invert(1)&quot;
</span><span class="cx"> 
</span><ins>+Values over 1 are clamped : invert(1.01)
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('filter') is &quot;invert(1)&quot;
+PASS jsWrapperClass(filterRule) is 'CSSValueList'
+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype'
+PASS jsWrapperClass(filterRule.constructor) is 'Function'
+PASS filterRule.length is 1
+PASS subRule.cssText is &quot;invert(1)&quot;
+
+Percentages over 100 are clamped : invert(500000%)
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('filter') is &quot;invert(100%)&quot;
+PASS jsWrapperClass(filterRule) is 'CSSValueList'
+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype'
+PASS jsWrapperClass(filterRule.constructor) is 'Function'
+PASS filterRule.length is 1
+PASS subRule.cssText is &quot;invert(100%)&quot;
+
</ins><span class="cx"> Zero value : invert(0)
</span><span class="cx"> PASS cssRule.type is 1
</span><span class="cx"> PASS declaration.length is 1
</span><span class="lines">@@ -454,6 +514,26 @@
</span><span class="cx"> PASS filterRule.length is 1
</span><span class="cx"> PASS subRule.cssText is &quot;opacity(1)&quot;
</span><span class="cx"> 
</span><ins>+Values over 1 are clamped : opacity(2134687326)
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('filter') is &quot;opacity(1)&quot;
+PASS jsWrapperClass(filterRule) is 'CSSValueList'
+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype'
+PASS jsWrapperClass(filterRule.constructor) is 'Function'
+PASS filterRule.length is 1
+PASS subRule.cssText is &quot;opacity(1)&quot;
+
+Percentages over 100 are clamped : opacity(500%)
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('filter') is &quot;opacity(100%)&quot;
+PASS jsWrapperClass(filterRule) is 'CSSValueList'
+PASS jsWrapperClass(filterRule.__proto__) is 'CSSValueListPrototype'
+PASS jsWrapperClass(filterRule.constructor) is 'Function'
+PASS filterRule.length is 1
+PASS subRule.cssText is &quot;opacity(100%)&quot;
+
</ins><span class="cx"> Zero value : opacity(0)
</span><span class="cx"> PASS cssRule.type is 1
</span><span class="cx"> PASS declaration.length is 1
</span></span></pre></div>
<a id="trunkLayoutTestscss3filtersfilterpropertyparsinginvalidexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/css3/filters/filter-property-parsing-invalid-expected.txt (208293 => 208294)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/filters/filter-property-parsing-invalid-expected.txt        2016-11-02 18:24:18 UTC (rev 208293)
+++ trunk/LayoutTests/css3/filters/filter-property-parsing-invalid-expected.txt        2016-11-02 18:26:26 UTC (rev 208294)
</span><span class="lines">@@ -39,11 +39,6 @@
</span><span class="cx"> PASS declaration.length is 0
</span><span class="cx"> PASS declaration.getPropertyValue('-webkit-filter') is &quot;&quot;
</span><span class="cx"> 
</span><del>-Parameter out of bounds : grayscale(1.5)
-PASS cssRule.type is 1
-PASS declaration.length is 0
-PASS declaration.getPropertyValue('-webkit-filter') is &quot;&quot;
-
</del><span class="cx"> Too many parameters : sepia(0.5 0.5 3.0)
</span><span class="cx"> PASS cssRule.type is 1
</span><span class="cx"> PASS declaration.length is 0
</span><span class="lines">@@ -69,11 +64,6 @@
</span><span class="cx"> PASS declaration.length is 0
</span><span class="cx"> PASS declaration.getPropertyValue('-webkit-filter') is &quot;&quot;
</span><span class="cx"> 
</span><del>-Parameter out of bounds : sepia(10000)
-PASS cssRule.type is 1
-PASS declaration.length is 0
-PASS declaration.getPropertyValue('-webkit-filter') is &quot;&quot;
-
</del><span class="cx"> Length instead of number : saturate(10px)
</span><span class="cx"> PASS cssRule.type is 1
</span><span class="cx"> PASS declaration.length is 0
</span><span class="lines">@@ -154,11 +144,6 @@
</span><span class="cx"> PASS declaration.length is 0
</span><span class="cx"> PASS declaration.getPropertyValue('-webkit-filter') is &quot;&quot;
</span><span class="cx"> 
</span><del>-Parameter out of bounds : invert(1.5)
-PASS cssRule.type is 1
-PASS declaration.length is 0
-PASS declaration.getPropertyValue('-webkit-filter') is &quot;&quot;
-
</del><span class="cx"> Length instead of number : opacity(10px)
</span><span class="cx"> PASS cssRule.type is 1
</span><span class="cx"> PASS declaration.length is 0
</span><span class="lines">@@ -189,11 +174,6 @@
</span><span class="cx"> PASS declaration.length is 0
</span><span class="cx"> PASS declaration.getPropertyValue('-webkit-filter') is &quot;&quot;
</span><span class="cx"> 
</span><del>-Parameter out of bounds : opacity(1.5)
-PASS cssRule.type is 1
-PASS declaration.length is 0
-PASS declaration.getPropertyValue('-webkit-filter') is &quot;&quot;
-
</del><span class="cx"> Length instead of number : brightness(10px)
</span><span class="cx"> PASS cssRule.type is 1
</span><span class="cx"> PASS declaration.length is 0
</span></span></pre></div>
<a id="trunkLayoutTestscss3filtersfilterpropertyparsinginvalidhtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/css3/filters/filter-property-parsing-invalid.html (208293 => 208294)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/filters/filter-property-parsing-invalid.html        2016-11-02 18:24:18 UTC (rev 208293)
+++ trunk/LayoutTests/css3/filters/filter-property-parsing-invalid.html        2016-11-02 18:26:26 UTC (rev 208294)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx">     declaration = cssRule.style;
</span><span class="cx">     shouldBe(&quot;declaration.length&quot;, &quot;0&quot;);
</span><span class="cx">     shouldBeEqualToString(&quot;declaration.getPropertyValue('-webkit-filter')&quot;, &quot;&quot;);
</span><ins>+    stylesheet.deleteRule(0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> testInvalidFilterRule(&quot;Too many parameters&quot;, &quot;url(#a #b)&quot;);
</span><span class="lines">@@ -38,7 +39,6 @@
</span><span class="cx"> testInvalidFilterRule(&quot;Trailing comma&quot;, &quot;grayscale(0.5,)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Negative parameter&quot;, &quot;grayscale(-0.5)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Negative percent&quot;, &quot;grayscale(-10%)&quot;);
</span><del>-testInvalidFilterRule(&quot;Parameter out of bounds&quot;, &quot;grayscale(1.5)&quot;);
</del><span class="cx"> 
</span><span class="cx"> testInvalidFilterRule(&quot;Too many parameters&quot;, &quot;sepia(0.5 0.5 3.0)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Too many parameters and commas&quot;, &quot;sepia(0.1, 0.1)&quot;);
</span><span class="lines">@@ -45,7 +45,6 @@
</span><span class="cx"> testInvalidFilterRule(&quot;Trailing comma&quot;, &quot;sepia(0.5,)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Negative parameter&quot;, &quot;sepia(-0.01)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Negative percent&quot;, &quot;sepia(-10%)&quot;);
</span><del>-testInvalidFilterRule(&quot;Parameter out of bounds&quot;, &quot;sepia(10000)&quot;);
</del><span class="cx"> 
</span><span class="cx"> testInvalidFilterRule(&quot;Length instead of number&quot;, &quot;saturate(10px)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Too many parameters&quot;, &quot;saturate(0.5 0.5)&quot;);
</span><span class="lines">@@ -65,7 +64,6 @@
</span><span class="cx"> testInvalidFilterRule(&quot;Too many parameters and commas&quot;, &quot;invert(0.5, 0.5)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Trailing comma&quot;, &quot;invert(0.5,)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Negative parameter&quot;, &quot;invert(-0.5)&quot;);
</span><del>-testInvalidFilterRule(&quot;Parameter out of bounds&quot;, &quot;invert(1.5)&quot;);
</del><span class="cx"> 
</span><span class="cx"> testInvalidFilterRule(&quot;Length instead of number&quot;, &quot;opacity(10px)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Too many parameters&quot;, &quot;opacity(0.5 0.5)&quot;);
</span><span class="lines">@@ -73,7 +71,6 @@
</span><span class="cx"> testInvalidFilterRule(&quot;Trailing comma&quot;, &quot;opacity(0.5,)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Negative parameter&quot;, &quot;opacity(-0.5)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Negative percent&quot;, &quot;opacity(-10%)&quot;);
</span><del>-testInvalidFilterRule(&quot;Parameter out of bounds&quot;, &quot;opacity(1.5)&quot;);
</del><span class="cx"> 
</span><span class="cx"> testInvalidFilterRule(&quot;Length instead of number&quot;, &quot;brightness(10px)&quot;);
</span><span class="cx"> testInvalidFilterRule(&quot;Too many parameters&quot;, &quot;brightness(0.5 0.5)&quot;);
</span></span></pre></div>
<a id="trunkLayoutTestscss3filtersfilterpropertyparsinghtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/css3/filters/filter-property-parsing.html (208293 => 208294)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/css3/filters/filter-property-parsing.html        2016-11-02 18:24:18 UTC (rev 208293)
+++ trunk/LayoutTests/css3/filters/filter-property-parsing.html        2016-11-02 18:26:26 UTC (rev 208294)
</span><span class="lines">@@ -90,6 +90,14 @@
</span><span class="cx">                &quot;grayscale(1.0)&quot;, 1, &quot;grayscale(1)&quot;,
</span><span class="cx">                [&quot;grayscale(1)&quot;]);
</span><span class="cx"> 
</span><ins>+testFilterRule(&quot;Values over 1 are clamped&quot;,
+               &quot;grayscale(1.5)&quot;, 1, &quot;grayscale(1)&quot;,
+               [&quot;grayscale(1)&quot;]);
+
+testFilterRule(&quot;Percentages over 100 are clamped&quot;,
+               &quot;grayscale(320%)&quot;, 1, &quot;grayscale(100%)&quot;,
+               [&quot;grayscale(100%)&quot;]);
+
</ins><span class="cx"> testFilterRule(&quot;Zero value&quot;,
</span><span class="cx">                &quot;grayscale(0)&quot;, 1, &quot;grayscale(0)&quot;,
</span><span class="cx">                [&quot;grayscale(0)&quot;]);
</span><span class="lines">@@ -114,6 +122,14 @@
</span><span class="cx">                &quot;sepia(1.0)&quot;, 1, &quot;sepia(1)&quot;,
</span><span class="cx">                [&quot;sepia(1)&quot;]);
</span><span class="cx"> 
</span><ins>+testFilterRule(&quot;Values over 1 are clamped&quot;,
+               &quot;sepia(8)&quot;, 1, &quot;sepia(1)&quot;,
+               [&quot;sepia(1)&quot;]);
+
+testFilterRule(&quot;Percentages over 100 are clamped&quot;,
+               &quot;sepia(101%)&quot;, 1, &quot;sepia(100%)&quot;,
+               [&quot;sepia(100%)&quot;]);
+
</ins><span class="cx"> testFilterRule(&quot;Zero value&quot;,
</span><span class="cx">                &quot;sepia(0)&quot;, 1, &quot;sepia(0)&quot;,
</span><span class="cx">                [&quot;sepia(0)&quot;]);
</span><span class="lines">@@ -210,6 +226,14 @@
</span><span class="cx">                &quot;invert(1.0)&quot;, 1, &quot;invert(1)&quot;,
</span><span class="cx">                [&quot;invert(1)&quot;]);
</span><span class="cx"> 
</span><ins>+testFilterRule(&quot;Values over 1 are clamped&quot;,
+               &quot;invert(1.01)&quot;, 1, &quot;invert(1)&quot;,
+               [&quot;invert(1)&quot;]);
+
+testFilterRule(&quot;Percentages over 100 are clamped&quot;,
+               &quot;invert(500000%)&quot;, 1, &quot;invert(100%)&quot;,
+               [&quot;invert(100%)&quot;]);
+
</ins><span class="cx"> testFilterRule(&quot;Zero value&quot;,
</span><span class="cx">                &quot;invert(0)&quot;, 1, &quot;invert(0)&quot;,
</span><span class="cx">                [&quot;invert(0)&quot;]);
</span><span class="lines">@@ -238,6 +262,14 @@
</span><span class="cx">                &quot;opacity(1.0)&quot;, 1, &quot;opacity(1)&quot;,
</span><span class="cx">                [&quot;opacity(1)&quot;]);
</span><span class="cx"> 
</span><ins>+testFilterRule(&quot;Values over 1 are clamped&quot;,
+               &quot;opacity(2134687326)&quot;, 1, &quot;opacity(1)&quot;,
+               [&quot;opacity(1)&quot;]);
+
+testFilterRule(&quot;Percentages over 100 are clamped&quot;,
+               &quot;opacity(500%)&quot;, 1, &quot;opacity(100%)&quot;,
+               [&quot;opacity(100%)&quot;]);
+
</ins><span class="cx"> testFilterRule(&quot;Zero value&quot;,
</span><span class="cx">                &quot;opacity(0)&quot;, 1, &quot;opacity(0)&quot;,
</span><span class="cx">                [&quot;opacity(0)&quot;]);
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (208293 => 208294)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-11-02 18:24:18 UTC (rev 208293)
+++ trunk/Source/WebCore/ChangeLog        2016-11-02 18:26:26 UTC (rev 208294)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2016-11-01  Dean Jackson  &lt;dino@apple.com&gt;
+
+        Filter functions grayscale/invert/opacity/sepia should clamp values over 100%, not fail
+        https://bugs.webkit.org/show_bug.cgi?id=164310
+
+        Reviewed by Sam Weinig.
+
+        When bringing up the new CSS parser, I discovered that our old parser was
+        not conforming to the specification.
+
+        Covered by existing tests.
+
+        * css/parser/CSSParser.cpp:
+        (WebCore::CSSParser::parseBuiltinFilterArguments): For these functions, clamp to
+        100% rather than fail.
+
</ins><span class="cx"> 2016-11-02  Brent Fulgham  &lt;bfulgham@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         WebKit nullptr dereference Archive Subframe
</span></span></pre></div>
<a id="trunkSourceWebCorecssparserCSSParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/css/parser/CSSParser.cpp (208293 => 208294)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/css/parser/CSSParser.cpp        2016-11-02 18:24:18 UTC (rev 208293)
+++ trunk/Source/WebCore/css/parser/CSSParser.cpp        2016-11-02 18:26:26 UTC (rev 208294)
</span><span class="lines">@@ -10060,11 +10060,11 @@
</span><span class="cx"> 
</span><span class="cx">             auto primitiveValue = createPrimitiveNumericValue(argumentWithCalculation);
</span><span class="cx"> 
</span><del>-            // Saturate and Contrast allow values over 100%.
</del><ins>+            // Saturate and contrast allow values over 100%. Otherwise clamp.
</ins><span class="cx">             if (filterFunction != CSSValueSaturate &amp;&amp; filterFunction != CSSValueContrast) {
</span><span class="cx">                 double maxAllowed = primitiveValue-&gt;primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE ? 100.0 : 1.0;
</span><span class="cx">                 if (primitiveValue-&gt;doubleValue() &gt; maxAllowed)
</span><del>-                    return nullptr;
</del><ins>+                    primitiveValue = CSSValuePool::singleton().createValue(maxAllowed, static_cast&lt;CSSPrimitiveValue::UnitTypes&gt;(primitiveValue-&gt;primitiveType()));
</ins><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             filterValue-&gt;append(WTFMove(primitiveValue));
</span></span></pre>
</div>
</div>

</body>
</html>