<!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:
<rdar://problems/29057705>
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 <dino@apple.com>
+
+ Filter functions grayscale/invert/opacity/sepia should clamp values over 100%, not fail
+ https://bugs.webkit.org/show_bug.cgi?id=164310
+ <rdar://problems/29057705>
+
+ 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 <bfulgham@apple.com>
</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 ""
</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 ""
-
</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 ""
</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 ""
-
</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 ""
</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 ""
-
</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 ""
</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 ""
-
</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("Trailing comma", "grayscale(0.5,)");
</span><span class="cx"> testInvalidFilterRule("Negative parameter", "grayscale(-0.5)");
</span><span class="cx"> testInvalidFilterRule("Negative percent", "grayscale(-10%)");
</span><del>-testInvalidFilterRule("Parameter out of bounds", "grayscale(1.5)");
</del><span class="cx">
</span><span class="cx"> testInvalidFilterRule("Too many parameters", "sepia(0.5 0.5 3.0)");
</span><span class="cx"> testInvalidFilterRule("Too many parameters and commas", "sepia(0.1, 0.1)");
</span><span class="lines">@@ -45,7 +44,6 @@
</span><span class="cx"> testInvalidFilterRule("Trailing comma", "sepia(0.5,)");
</span><span class="cx"> testInvalidFilterRule("Negative parameter", "sepia(-0.01)");
</span><span class="cx"> testInvalidFilterRule("Negative percent", "sepia(-10%)");
</span><del>-testInvalidFilterRule("Parameter out of bounds", "sepia(10000)");
</del><span class="cx">
</span><span class="cx"> testInvalidFilterRule("Length instead of number", "saturate(10px)");
</span><span class="cx"> testInvalidFilterRule("Too many parameters", "saturate(0.5 0.5)");
</span><span class="lines">@@ -65,7 +63,6 @@
</span><span class="cx"> testInvalidFilterRule("Too many parameters and commas", "invert(0.5, 0.5)");
</span><span class="cx"> testInvalidFilterRule("Trailing comma", "invert(0.5,)");
</span><span class="cx"> testInvalidFilterRule("Negative parameter", "invert(-0.5)");
</span><del>-testInvalidFilterRule("Parameter out of bounds", "invert(1.5)");
</del><span class="cx">
</span><span class="cx"> testInvalidFilterRule("Length instead of number", "opacity(10px)");
</span><span class="cx"> testInvalidFilterRule("Too many parameters", "opacity(0.5 0.5)");
</span><span class="lines">@@ -73,7 +70,6 @@
</span><span class="cx"> testInvalidFilterRule("Trailing comma", "opacity(0.5,)");
</span><span class="cx"> testInvalidFilterRule("Negative parameter", "opacity(-0.5)");
</span><span class="cx"> testInvalidFilterRule("Negative percent", "opacity(-10%)");
</span><del>-testInvalidFilterRule("Parameter out of bounds", "opacity(1.5)");
</del><span class="cx">
</span><span class="cx"> testInvalidFilterRule("Length instead of number", "brightness(10px)");
</span><span class="cx"> testInvalidFilterRule("Too many parameters", "brightness(0.5 0.5)");
</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 "grayscale(1)"
</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 "grayscale(1)"
+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 "grayscale(1)"
+
+Percentages over 100 are clamped : grayscale(320%)
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('filter') is "grayscale(100%)"
+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 "grayscale(100%)"
+
</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 "sepia(1)"
</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 "sepia(1)"
+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 "sepia(1)"
+
+Percentages over 100 are clamped : sepia(101%)
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('filter') is "sepia(100%)"
+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 "sepia(100%)"
+
</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 "invert(1)"
</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 "invert(1)"
+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 "invert(1)"
+
+Percentages over 100 are clamped : invert(500000%)
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('filter') is "invert(100%)"
+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 "invert(100%)"
+
</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 "opacity(1)"
</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 "opacity(1)"
+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 "opacity(1)"
+
+Percentages over 100 are clamped : opacity(500%)
+PASS cssRule.type is 1
+PASS declaration.length is 1
+PASS declaration.getPropertyValue('filter') is "opacity(100%)"
+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 "opacity(100%)"
+
</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 ""
</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 ""
-
</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 ""
</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 ""
-
</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 ""
</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 ""
-
</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 ""
</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 ""
-
</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("declaration.length", "0");
</span><span class="cx"> shouldBeEqualToString("declaration.getPropertyValue('-webkit-filter')", "");
</span><ins>+ stylesheet.deleteRule(0);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> testInvalidFilterRule("Too many parameters", "url(#a #b)");
</span><span class="lines">@@ -38,7 +39,6 @@
</span><span class="cx"> testInvalidFilterRule("Trailing comma", "grayscale(0.5,)");
</span><span class="cx"> testInvalidFilterRule("Negative parameter", "grayscale(-0.5)");
</span><span class="cx"> testInvalidFilterRule("Negative percent", "grayscale(-10%)");
</span><del>-testInvalidFilterRule("Parameter out of bounds", "grayscale(1.5)");
</del><span class="cx">
</span><span class="cx"> testInvalidFilterRule("Too many parameters", "sepia(0.5 0.5 3.0)");
</span><span class="cx"> testInvalidFilterRule("Too many parameters and commas", "sepia(0.1, 0.1)");
</span><span class="lines">@@ -45,7 +45,6 @@
</span><span class="cx"> testInvalidFilterRule("Trailing comma", "sepia(0.5,)");
</span><span class="cx"> testInvalidFilterRule("Negative parameter", "sepia(-0.01)");
</span><span class="cx"> testInvalidFilterRule("Negative percent", "sepia(-10%)");
</span><del>-testInvalidFilterRule("Parameter out of bounds", "sepia(10000)");
</del><span class="cx">
</span><span class="cx"> testInvalidFilterRule("Length instead of number", "saturate(10px)");
</span><span class="cx"> testInvalidFilterRule("Too many parameters", "saturate(0.5 0.5)");
</span><span class="lines">@@ -65,7 +64,6 @@
</span><span class="cx"> testInvalidFilterRule("Too many parameters and commas", "invert(0.5, 0.5)");
</span><span class="cx"> testInvalidFilterRule("Trailing comma", "invert(0.5,)");
</span><span class="cx"> testInvalidFilterRule("Negative parameter", "invert(-0.5)");
</span><del>-testInvalidFilterRule("Parameter out of bounds", "invert(1.5)");
</del><span class="cx">
</span><span class="cx"> testInvalidFilterRule("Length instead of number", "opacity(10px)");
</span><span class="cx"> testInvalidFilterRule("Too many parameters", "opacity(0.5 0.5)");
</span><span class="lines">@@ -73,7 +71,6 @@
</span><span class="cx"> testInvalidFilterRule("Trailing comma", "opacity(0.5,)");
</span><span class="cx"> testInvalidFilterRule("Negative parameter", "opacity(-0.5)");
</span><span class="cx"> testInvalidFilterRule("Negative percent", "opacity(-10%)");
</span><del>-testInvalidFilterRule("Parameter out of bounds", "opacity(1.5)");
</del><span class="cx">
</span><span class="cx"> testInvalidFilterRule("Length instead of number", "brightness(10px)");
</span><span class="cx"> testInvalidFilterRule("Too many parameters", "brightness(0.5 0.5)");
</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"> "grayscale(1.0)", 1, "grayscale(1)",
</span><span class="cx"> ["grayscale(1)"]);
</span><span class="cx">
</span><ins>+testFilterRule("Values over 1 are clamped",
+ "grayscale(1.5)", 1, "grayscale(1)",
+ ["grayscale(1)"]);
+
+testFilterRule("Percentages over 100 are clamped",
+ "grayscale(320%)", 1, "grayscale(100%)",
+ ["grayscale(100%)"]);
+
</ins><span class="cx"> testFilterRule("Zero value",
</span><span class="cx"> "grayscale(0)", 1, "grayscale(0)",
</span><span class="cx"> ["grayscale(0)"]);
</span><span class="lines">@@ -114,6 +122,14 @@
</span><span class="cx"> "sepia(1.0)", 1, "sepia(1)",
</span><span class="cx"> ["sepia(1)"]);
</span><span class="cx">
</span><ins>+testFilterRule("Values over 1 are clamped",
+ "sepia(8)", 1, "sepia(1)",
+ ["sepia(1)"]);
+
+testFilterRule("Percentages over 100 are clamped",
+ "sepia(101%)", 1, "sepia(100%)",
+ ["sepia(100%)"]);
+
</ins><span class="cx"> testFilterRule("Zero value",
</span><span class="cx"> "sepia(0)", 1, "sepia(0)",
</span><span class="cx"> ["sepia(0)"]);
</span><span class="lines">@@ -210,6 +226,14 @@
</span><span class="cx"> "invert(1.0)", 1, "invert(1)",
</span><span class="cx"> ["invert(1)"]);
</span><span class="cx">
</span><ins>+testFilterRule("Values over 1 are clamped",
+ "invert(1.01)", 1, "invert(1)",
+ ["invert(1)"]);
+
+testFilterRule("Percentages over 100 are clamped",
+ "invert(500000%)", 1, "invert(100%)",
+ ["invert(100%)"]);
+
</ins><span class="cx"> testFilterRule("Zero value",
</span><span class="cx"> "invert(0)", 1, "invert(0)",
</span><span class="cx"> ["invert(0)"]);
</span><span class="lines">@@ -238,6 +262,14 @@
</span><span class="cx"> "opacity(1.0)", 1, "opacity(1)",
</span><span class="cx"> ["opacity(1)"]);
</span><span class="cx">
</span><ins>+testFilterRule("Values over 1 are clamped",
+ "opacity(2134687326)", 1, "opacity(1)",
+ ["opacity(1)"]);
+
+testFilterRule("Percentages over 100 are clamped",
+ "opacity(500%)", 1, "opacity(100%)",
+ ["opacity(100%)"]);
+
</ins><span class="cx"> testFilterRule("Zero value",
</span><span class="cx"> "opacity(0)", 1, "opacity(0)",
</span><span class="cx"> ["opacity(0)"]);
</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 <dino@apple.com>
+
+ 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 <bfulgham@apple.com>
</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 && filterFunction != CSSValueContrast) {
</span><span class="cx"> double maxAllowed = primitiveValue->primitiveType() == CSSPrimitiveValue::CSS_PERCENTAGE ? 100.0 : 1.0;
</span><span class="cx"> if (primitiveValue->doubleValue() > maxAllowed)
</span><del>- return nullptr;
</del><ins>+ primitiveValue = CSSValuePool::singleton().createValue(maxAllowed, static_cast<CSSPrimitiveValue::UnitTypes>(primitiveValue->primitiveType()));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> filterValue->append(WTFMove(primitiveValue));
</span></span></pre>
</div>
</div>
</body>
</html>