No subject
Mon Jan 28 08:41:14 PST 2013
8714">r148714</a> by <apavlov at chromium.org>.
* animations/keyframes-invalid-keys-expected.txt: Added.
* animations/keyframes-invalid-keys.html: Added.
* fast/css/webkit-keyframes-errors-expected.html: Added.
* fast/css/webkit-keyframes-errors.html: Added.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href=3D"#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a=
></li>
<li><a href=3D"#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeL=
og</a></li>
<li><a href=3D"#trunkSourceWebCorecssCSSGrammaryin">trunk/Source/WebCore/=
css/CSSGrammar.y.in</a></li>
<li><a href=3D"#trunkSourceWebCorecssCSSParsercpp">trunk/Source/WebCore/c=
ss/CSSParser.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href=3D"#trunkLayoutTestsanimationskeyframesinvalidkeysexpectedtxt=
">trunk/LayoutTests/animations/keyframes-invalid-keys-expected.txt</a></l=
i>
<li><a href=3D"#trunkLayoutTestsanimationskeyframesinvalidkeyshtml">trunk=
/LayoutTests/animations/keyframes-invalid-keys.html</a></li>
<li><a href=3D"#trunkLayoutTestsfastcsswebkitkeyframeserrorsexpectedhtml"=
>trunk/LayoutTests/fast/css/webkit-keyframes-errors-expected.html</a></li=
>
<li><a href=3D"#trunkLayoutTestsfastcsswebkitkeyframeserrorshtml">trunk/L=
ayoutTests/fast/css/webkit-keyframes-errors.html</a></li>
</ul>
</div>
<div id=3D"patch">
<h3>Diff</h3>
<a id=3D"trunkLayoutTestsChangeLog"></a>
<div class=3D"modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (149105 =
=3D> 149106)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/ChangeLog 2013-04-25 13:23:47 =
UTC (rev 149105)
+++ trunk/LayoutTests/ChangeLog 2013-04-25 13:43:33 UTC (rev 149106)
</span><span class=3D"lines">@@ -1,3 +1,15 @@
</span><ins>+2013-04-25 Andreas Kling <akling at apple.com>
+
+ CSS parser: Add error recovery while parsing @-webkit-keyframes =
key values.
+ <http://webkit.org/b/115175>
+
+ From Blink r148714 by <apavlov at chromium.org>.
+
+ * animations/keyframes-invalid-keys-expected.txt: Added.
+ * animations/keyframes-invalid-keys.html: Added.
+ * fast/css/webkit-keyframes-errors-expected.html: Added.
+ * fast/css/webkit-keyframes-errors.html: Added.
+
</ins><span class=3D"cx"> 2013-04-25 =C3=81d=C3=A1m Kallai <kadam at in=
f.u-szeged.hu>
</span><span class=3D"cx">=20
</span><span class=3D"cx"> [Qt] Unreviewed gardening. Skip some f=
ailing tests after r148996.
</span></span></pre></div>
<a id=3D"trunkLayoutTestsanimationskeyframesinvalidkeysexpectedtxt"></a>
<div class=3D"addfile"><h4>Added: trunk/LayoutTests/animations/keyframes-=
invalid-keys-expected.txt (0 =3D> 149106)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/animations/keyframes-invalid-k=
eys-expected.txt (rev 0)
+++ trunk/LayoutTests/animations/keyframes-invalid-keys-expected.txt 2013=
-04-25 13:43:33 UTC (rev 149106)
</span><span class=3D"lines">@@ -0,0 +1,4 @@
</span><ins>+This test performs an animation of the left property. It sho=
uld always remain 3px, unless there are errors during parsing, resulting =
in other values in keyframes with bad keys. Four of the keyframes contain=
invalid keys, and should be discarded altogether ("If a keyframe se=
lector specifies negative percentage values or values higher than 100%, t=
hen the keyframe will be ignored", see http://www.w3.org/TR/css3-ani=
mations/#keyframes).
+PASS - "left" property for "box" element at 0.2s saw=
something close to: 3
+PASS - "left" property for "box" element at 0.8s saw=
something close to: 3
+
</ins></span></pre></div>
<a id=3D"trunkLayoutTestsanimationskeyframesinvalidkeyshtml"></a>
<div class=3D"addfile"><h4>Added: trunk/LayoutTests/animations/keyframes-=
invalid-keys.html (0 =3D> 149106)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/animations/keyframes-invalid-k=
eys.html (rev 0)
+++ trunk/LayoutTests/animations/keyframes-invalid-keys.html 2013-04-25 1=
3:43:33 UTC (rev 149106)
</span><span class=3D"lines">@@ -0,0 +1,60 @@
</span><ins>+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transit=
ional//EN"
+ "http://www.w3.org/TR/html4/loose.dtd">
+
+<html lang=3D"en">
+<head>
+ <meta http-equiv=3D"Content-Type" content=3D"text/ht=
ml; charset=3Dutf-8">
+ <title>Keyframes with invalid keys</title>
+ <style type=3D"text/css" media=3D"screen">
+ @-webkit-keyframes "anim" {
+ 50% { left: 3px; }
+
+ /* Out-of-range percentage values */
+ -10% { left: 100px; }
+ -10%, from { left: 100px; }
+ from, 110% { left: 100px; }
+ 110% { left: 100px; }
+
+ /* Invalid keys (numbers and identifiers) */
+ 0, from { left: 100px; }
+ fromto { left: 100px; }
+ 60%, unknown { left: 100px; }
+ 100 { left: 100px; }
+ }
+ #box {
+ position: absolute;
+ left: 3px;
+ top: 100px;
+ height: 100px;
+ width: 100px;
+ background-color: blue;
+ -webkit-animation-duration: 1s;
+ -webkit-animation-timing-function: linear;
+ -webkit-animation-name: "anim";
+ }
+
+ </style>
+ <script src=3D"resources/animation-test-helpers.js" typ=
e=3D"text/javascript" charset=3D"utf-8"></scrip=
t>
+ <script type=3D"text/javascript" charset=3D"utf-8&=
quot;>
+
+ const expectedValues =3D [
+ // [animation-name, time, element-id, property, expected-value, to=
lerance]
+ ["anim", 0.2, "box", "left", 3, 1],
+ ["anim", 0.8, "box", "left", 3, 1],
+ ];
+
+ runAnimationTest(expectedValues);
+
+ </script>
+</head>
+<body>
+This test performs an animation of the left property. It should always r=
emain 3px, unless there are
+errors during parsing, resulting in other values in keyframes with bad k=
eys.
+Four of the keyframes contain invalid keys, and should be discarded alto=
gether
+("If a keyframe selector specifies negative percentage values or va=
lues higher than 100%, then the keyframe will be ignored", see <a=
href=3D"http://www.w3.org/TR/css3-animations/#keyframes">ht=
tp://www.w3.org/TR/css3-animations/#keyframes</a>).
+<div id=3D"box">
+</div>
+<div id=3D"result">
+</div>
+</body>
+</html>
</ins></span></pre></div>
<a id=3D"trunkLayoutTestsfastcsswebkitkeyframeserrorsexpectedhtml"></a>
<div class=3D"addfile"><h4>Added: trunk/LayoutTests/fast/css/webkit-keyfr=
ames-errors-expected.html (0 =3D> 149106)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/fast/css/webkit-keyframes-erro=
rs-expected.html (rev 0)
+++ trunk/LayoutTests/fast/css/webkit-keyframes-errors-expected.html 2013=
-04-25 13:43:33 UTC (rev 149106)
</span><span class=3D"lines">@@ -0,0 +1,26 @@
</span><ins>+<html>
+<body>
+ <p>Test for Blink bug <a href=3D"https://code.google.c=
om/p/chromium/issues/detail?id=3D228870">228870</a>: CSS pa=
rser incorrectly handles invalid @-webkit-keyframes key values</p>
+ <style>
+ #output-1:before {
+ content: "PASSED";
+ }
+
+ #output-2:before {
+ content: "PASSED";
+ }
+
+ #output-3:before {
+ content: "PASSED";
+ }
+
+ #output-4:before {
+ content: "PASSED";
+ }
+ </style>
+ <div id=3D"output-1"> (INTEGER single key)</div&g=
t;
+ <div id=3D"output-2"> (INTEGER in a key list)</di=
v>
+ <div id=3D"output-3"> (unknown IDENT in a key list)&=
lt;/div>
+ <div id=3D"output-4"> (out-of-range percentage key v=
alue in a key list)</div>
+</body>
+</html>
</ins></span></pre></div>
<a id=3D"trunkLayoutTestsfastcsswebkitkeyframeserrorshtml"></a>
<div class=3D"addfile"><h4>Added: trunk/LayoutTests/fast/css/webkit-keyfr=
ames-errors.html (0 =3D> 149106)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/LayoutTests/fast/css/webkit-keyframes-erro=
rs.html (rev 0)
+++ trunk/LayoutTests/fast/css/webkit-keyframes-errors.html 2013-04-25 13=
:43:33 UTC (rev 149106)
</span><span class=3D"lines">@@ -0,0 +1,42 @@
</span><ins>+<html>
+<body>
+ <p>Test for Blink bug <a href=3D"https://code.google.c=
om/p/chromium/issues/detail?id=3D228870">228870</a>: CSS pa=
rser incorrectly handles invalid @-webkit-keyframes key values</p>
+ <style>
+ @-webkit-keyframes foo {
+ 0 {foo: bar;}
+ }
+
+ #output-1:before {
+ content: "PASSED";
+ }
+
+ @-webkit-keyframes foo {
+ 0, 100% {foo: bar;}
+ }
+
+ #output-2:before {
+ content: "PASSED";
+ }
+
+ @-webkit-keyframes foo {
+ 10%, none {foo: bar;}
+ }
+
+ #output-3:before {
+ content: "PASSED";
+ }
+
+ @-webkit-keyframes foo {
+ -10%, from {foo: bar;}
+ }
+
+ #output-4:before {
+ content: "PASSED";
+ }
+ </style>
+ <div id=3D"output-1"> (INTEGER single key)</div&g=
t;
+ <div id=3D"output-2"> (INTEGER in a key list)</di=
v>
+ <div id=3D"output-3"> (unknown IDENT in a key list)&=
lt;/div>
+ <div id=3D"output-4"> (out-of-range percentage key v=
alue in a key list)</div>
+</body>
+</html>
</ins></span></pre></div>
<a id=3D"trunkSourceWebCoreChangeLog"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (1491=
05 =3D> 149106)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/WebCore/ChangeLog 2013-04-25 13:23:=
47 UTC (rev 149105)
+++ trunk/Source/WebCore/ChangeLog 2013-04-25 13:43:33 UTC (rev 149106)
</span><span class=3D"lines">@@ -1,3 +1,23 @@
</span><ins>+2013-04-25 Andreas Kling <akling at apple.com>
+
+ CSS parser: Add error recovery while parsing @-webkit-keyframes =
key values.
+ <http://webkit.org/b/115175>
+
+ From Blink r148714 by <apavlov at chromium.org>:
+
+ If not a percentage, "from", or "to" value i=
s used in a key list, the rule is erroneous,
+ and due to the absense of recovery, the parser skips the followi=
ng, valid CSS rule.
+
+ On a related note, keyframes, whose selectors contain invalid ke=
ys, should be discarded
+ altogether, according to <http://www.w3.org/TR/css3-animation=
s/#keyframes>
+
+ Tests: animations/keyframes-invalid-keys.html
+ fast/css/webkit-keyframes-errors.html
+
+ * css/CSSGrammar.y.in:
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::rewriteSpecifiers):
+
</ins><span class=3D"cx"> 2013-04-25 Antti Koivisto <antti at apple.com=
>
</span><span class=3D"cx">=20
</span><span class=3D"cx"> REGRESSION (r147797): Animations slide=
shows of images on www.thesuperficial.com are slow
</span></span></pre></div>
<a id=3D"trunkSourceWebCorecssCSSGrammaryin"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/WebCore/css/CSSGrammar.=
y.in (149105 =3D> 149106)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/WebCore/css/CSSGrammar.y.in 2013-04=
-25 13:23:47 UTC (rev 149105)
+++ trunk/Source/WebCore/css/CSSGrammar.y.in 2013-04-25 13:43:33 UTC (rev=
149106)
</span><span class=3D"lines">@@ -876,9 +876,14 @@
</span><span class=3D"cx"> $$.fValue =3D 0;
</span><span class=3D"cx"> else if (str.equalIgnoringCase("t=
o"))
</span><span class=3D"cx"> $$.fValue =3D 100;
</span><del>- else
</del><ins>+ else {
+ $$.unit =3D 0;
</ins><span class=3D"cx"> YYERROR;
</span><ins>+ }
</ins><span class=3D"cx"> }
</span><ins>+ | error {
+ $$.unit =3D 0;
+ }
</ins><span class=3D"cx"> ;
</span><span class=3D"cx">=20
</span><span class=3D"cx"> before_page_rule:
</span></span></pre></div>
<a id=3D"trunkSourceWebCorecssCSSParsercpp"></a>
<div class=3D"modfile"><h4>Modified: trunk/Source/WebCore/css/CSSParser.c=
pp (149105 =3D> 149106)</h4>
<pre class=3D"diff"><span>
<span class=3D"info">--- trunk/Source/WebCore/css/CSSParser.cpp 2013-04-2=
5 13:23:47 UTC (rev 149105)
+++ trunk/Source/WebCore/css/CSSParser.cpp 2013-04-25 13:43:33 UTC (rev 1=
49106)
</span><span class=3D"lines">@@ -11791,7 +11791,23 @@
</span><span class=3D"cx"> // Create a key string from the passed key=
s
</span><span class=3D"cx"> StringBuilder keyString;
</span><span class=3D"cx"> for (unsigned i =3D 0; i < keys->siz=
e(); ++i) {
</span><ins>+ // Just as per the comment below, we ignore keyframe=
s with
+ // invalid key values (plain numbers or unknown identifiers)
+ // marked as CSSPrimitiveValue::CSS_UNKNOWN during parsing.
+ if (keys->valueAt(i)->unit =3D=3D CSSPrimitiveValue::CSS_U=
NKNOWN) {
+ clearProperties();
+ return 0;
+ }
+
+ ASSERT(keys->valueAt(i)->unit =3D=3D CSSPrimitiveValue::CS=
S_NUMBER);
</ins><span class=3D"cx"> float key =3D static_cast<float>(=
keys->valueAt(i)->fValue);
</span><ins>+ if (key < 0 || key > 100) {
+ // As per http://www.w3.org/TR/css3-animations/#keyframes,
+ // "If a keyframe selector specifies negative percentag=
e values
+ // or values higher than 100%, then the keyframe will be ign=
ored."
+ clearProperties();
+ return 0;
+ }
</ins><span class=3D"cx"> if (i !=3D 0)
</span><span class=3D"cx"> keyString.append(',');
</span><span class=3D"cx"> keyString.append(String::number(key));
</span></span></pre>
</div>
</div>
</body>
</html>
More information about the webkit-changes
mailing list