No subject


Mon Jan 28 08:41:14 PST 2013


8714">r148714</a> by &lt;apavlov at chromium.org&gt;.

* 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  &lt;akling at apple.com&gt;
+
+        CSS parser: Add error recovery while parsing @-webkit-keyframes =
key values.
+        &lt;http://webkit.org/b/115175&gt;
+
+        From Blink r148714 by &lt;apavlov at chromium.org&gt;.
+
+        * 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  &lt;kadam at in=
f.u-szeged.hu&gt;
</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 (&quot;If a keyframe se=
lector specifies negative percentage values or values higher than 100%, t=
hen the keyframe will be ignored&quot;, see http://www.w3.org/TR/css3-ani=
mations/#keyframes).
+PASS - &quot;left&quot; property for &quot;box&quot; element at 0.2s saw=
 something close to: 3
+PASS - &quot;left&quot; property for &quot;box&quot; 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>+&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD HTML 4.01 Transit=
ional//EN&quot;
+   &quot;http://www.w3.org/TR/html4/loose.dtd&quot;&gt;
+
+&lt;html lang=3D&quot;en&quot;&gt;
+&lt;head&gt;
+  &lt;meta http-equiv=3D&quot;Content-Type&quot; content=3D&quot;text/ht=
ml; charset=3Dutf-8&quot;&gt;
+  &lt;title&gt;Keyframes with invalid keys&lt;/title&gt;
+  &lt;style type=3D&quot;text/css&quot; media=3D&quot;screen&quot;&gt;
+    @-webkit-keyframes &quot;anim&quot; {
+        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: &quot;anim&quot;;
+    }
+
+    &lt;/style&gt;
+    &lt;script src=3D&quot;resources/animation-test-helpers.js&quot; typ=
e=3D&quot;text/javascript&quot; charset=3D&quot;utf-8&quot;&gt;&lt;/scrip=
t&gt;
+    &lt;script type=3D&quot;text/javascript&quot; charset=3D&quot;utf-8&=
quot;&gt;
+
+    const expectedValues =3D [
+      // [animation-name, time, element-id, property, expected-value, to=
lerance]
+      [&quot;anim&quot;, 0.2, &quot;box&quot;, &quot;left&quot;, 3, 1],
+      [&quot;anim&quot;, 0.8, &quot;box&quot;, &quot;left&quot;, 3, 1],
+    ];
+
+    runAnimationTest(expectedValues);
+
+  &lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+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
+(&quot;If a keyframe selector specifies negative percentage values or va=
lues higher than 100%, then the keyframe will be ignored&quot;, see &lt;a=
 href=3D&quot;http://www.w3.org/TR/css3-animations/#keyframes&quot;&gt;ht=
tp://www.w3.org/TR/css3-animations/#keyframes&lt;/a&gt;).
+&lt;div id=3D&quot;box&quot;&gt;
+&lt;/div&gt;
+&lt;div id=3D&quot;result&quot;&gt;
+&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</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>+&lt;html&gt;
+&lt;body&gt;
+    &lt;p&gt;Test for Blink bug &lt;a href=3D&quot;https://code.google.c=
om/p/chromium/issues/detail?id=3D228870&quot;&gt;228870&lt;/a&gt;: CSS pa=
rser incorrectly handles invalid @-webkit-keyframes key values&lt;/p&gt;
+    &lt;style&gt;
+        #output-1:before {
+            content: &quot;PASSED&quot;;
+        }
+
+        #output-2:before {
+            content: &quot;PASSED&quot;;
+        }
+
+        #output-3:before {
+            content: &quot;PASSED&quot;;
+        }
+
+        #output-4:before {
+            content: &quot;PASSED&quot;;
+        }
+    &lt;/style&gt;
+    &lt;div id=3D&quot;output-1&quot;&gt; (INTEGER single key)&lt;/div&g=
t;
+    &lt;div id=3D&quot;output-2&quot;&gt; (INTEGER in a key list)&lt;/di=
v&gt;
+    &lt;div id=3D&quot;output-3&quot;&gt; (unknown IDENT in a key list)&=
lt;/div&gt;
+    &lt;div id=3D&quot;output-4&quot;&gt; (out-of-range percentage key v=
alue in a key list)&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</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>+&lt;html&gt;
+&lt;body&gt;
+    &lt;p&gt;Test for Blink bug &lt;a href=3D&quot;https://code.google.c=
om/p/chromium/issues/detail?id=3D228870&quot;&gt;228870&lt;/a&gt;: CSS pa=
rser incorrectly handles invalid @-webkit-keyframes key values&lt;/p&gt;
+    &lt;style&gt;
+        @-webkit-keyframes foo {
+            0 {foo: bar;}
+        }
+
+        #output-1:before {
+            content: &quot;PASSED&quot;;
+        }
+
+        @-webkit-keyframes foo {
+            0, 100% {foo: bar;}
+        }
+
+        #output-2:before {
+            content: &quot;PASSED&quot;;
+        }
+
+        @-webkit-keyframes foo {
+            10%, none {foo: bar;}
+        }
+
+        #output-3:before {
+            content: &quot;PASSED&quot;;
+        }
+
+        @-webkit-keyframes foo {
+            -10%, from {foo: bar;}
+        }
+
+        #output-4:before {
+            content: &quot;PASSED&quot;;
+        }
+    &lt;/style&gt;
+    &lt;div id=3D&quot;output-1&quot;&gt; (INTEGER single key)&lt;/div&g=
t;
+    &lt;div id=3D&quot;output-2&quot;&gt; (INTEGER in a key list)&lt;/di=
v&gt;
+    &lt;div id=3D&quot;output-3&quot;&gt; (unknown IDENT in a key list)&=
lt;/div&gt;
+    &lt;div id=3D&quot;output-4&quot;&gt; (out-of-range percentage key v=
alue in a key list)&lt;/div&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</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  &lt;akling at apple.com&gt;
+
+        CSS parser: Add error recovery while parsing @-webkit-keyframes =
key values.
+        &lt;http://webkit.org/b/115175&gt;
+
+        From Blink r148714 by &lt;apavlov at chromium.org&gt;:
+
+        If not a percentage, &quot;from&quot;, or &quot;to&quot; 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 &lt;http://www.w3.org/TR/css3-animation=
s/#keyframes&gt;
+
+        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  &lt;antti at apple.com=
&gt;
</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(&quot;t=
o&quot;))
</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 &lt; keys-&gt;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-&gt;valueAt(i)-&gt;unit =3D=3D CSSPrimitiveValue::CSS_U=
NKNOWN) {
+            clearProperties();
+            return 0;
+        }
+
+        ASSERT(keys-&gt;valueAt(i)-&gt;unit =3D=3D CSSPrimitiveValue::CS=
S_NUMBER);
</ins><span class=3D"cx">         float key =3D static_cast&lt;float&gt;(=
keys-&gt;valueAt(i)-&gt;fValue);
</span><ins>+        if (key &lt; 0 || key &gt; 100) {
+            // As per http://www.w3.org/TR/css3-animations/#keyframes,
+            // &quot;If a keyframe selector specifies negative percentag=
e values
+            // or values higher than 100%, then the keyframe will be ign=
ored.&quot;
+            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