Sign in front of keyframe selector causes stylesheet parsing to abort
https://bugs.webkit.org/show_bug.cgi?id=96844

Patch by Glenn Adams <glenn@skynav.com> on 2012-09-30
Reviewed by Simon Fraser.

Source/WebCore:

Allow optional unary operator (+|-) on PERCENTAGE in keyframe selector.

Test: animations/keyframe-selector-negative-percentage.html

* css/CSSGrammar.y:
Add maybe_unary_operator to PERCENTAGE on keyframe selector. Negative keyframe
selector value is already ignored in StyleKeyframe::parseKeyString.

LayoutTests:

Add test case for correct handling of negative percentage in keyframe selector.

* animations/keyframe-selector-negative-percentage-expected.txt: Added.
* animations/keyframe-selector-negative-percentage.html: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk/LayoutTests@130007 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/ChangeLog b/ChangeLog
index 0cb034b..dc04ce7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2012-09-30  Glenn Adams  <glenn@skynav.com>
+
+        Sign in front of keyframe selector causes stylesheet parsing to abort
+        https://bugs.webkit.org/show_bug.cgi?id=96844
+
+        Reviewed by Simon Fraser.
+
+        Add test case for correct handling of negative percentage in keyframe selector.
+
+        * animations/keyframe-selector-negative-percentage-expected.txt: Added.
+        * animations/keyframe-selector-negative-percentage.html: Added.
+
 2012-09-30  Keishi Hattori  <keishi@webkit.org>
 
         Web Inspector: Modifications in a shadow tree don't update the Elements panel.
diff --git a/animations/keyframe-selector-negative-percentage-expected.txt b/animations/keyframe-selector-negative-percentage-expected.txt
new file mode 100644
index 0000000..9242004
--- /dev/null
+++ b/animations/keyframe-selector-negative-percentage-expected.txt
@@ -0,0 +1,4 @@
+The background color of this element should be green and the text should be white.
+PASS: background color is green
+PASS: text color is white
+
diff --git a/animations/keyframe-selector-negative-percentage.html b/animations/keyframe-selector-negative-percentage.html
new file mode 100644
index 0000000..29de1c6
--- /dev/null
+++ b/animations/keyframe-selector-negative-percentage.html
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Check that negative (out of range) key frame percentage doesn't cause subsequent first or second ruleset to be skipped.</title>
+<style>
+#test { background-color: red; color: black }
+@-webkit-keyframes fade { -10% { color: red; } }
+#test { background-color: green; }                 /* if skipped, then background will be red */ 
+#test { color: white; }                            /* if skipped, then text will be black */
+</style>
+</head>
+<body>
+<div id="test">The background color of this element should be green and the text should be white.</div>
+<div id="result"></div>
+<script>
+if (window.testRunner)
+    testRunner.dumpAsText();
+var r = '';
+var s = getComputedStyle(document.getElementById("test"));
+if (s.backgroundColor === "rgb(0, 128, 0)") {
+  r += 'PASS: background color is green';
+} else {
+  r += 'FAIL: background color not green';
+}
+r += '<br>';
+if (s.color === "rgb(255, 255, 255)") {
+  r += 'PASS: text color is white';
+} else {
+  r += 'FAIL: text color not white';
+}
+r += '<br>';
+document.getElementById("result").innerHTML = r;
+</script>
+</body>
+</html>