Reviewers: felix8a,

Description:
It looks like the existing CSS parser handles the keyframe syntax
alright.

This change documents existing behaviour.

If we're OK with having the CSS parser call startRuleset and endRuleset
to
match keyframes, then I can handle @keyframes purely with changes to
sanitizecss.js.

Please review this at https://codereview.appspot.com/11795043/

Affected files:
  M     tests/com/google/caja/plugin/cssparser_test.js


Index: tests/com/google/caja/plugin/cssparser_test.js
===================================================================
--- tests/com/google/caja/plugin/cssparser_test.js      (revision 5503)
+++ tests/com/google/caja/plugin/cssparser_test.js      (working copy)
@@ -309,3 +309,57 @@
   jsunit.pass();
 });

+jsunitRegister('testKeyframes', function testKeyframes() {
+  // Mixture of example 1 and example 2 from
+  // http://dev.w3.org/csswg/css-animations/
+  var input = [
+    'div {',
+    '  animation-name: diagonal-slide;',
+    '  animation-duration: 5s;',
+    '  animation-iteration-count: 10;',
+    '}',
+    '',
+    '@keyframes diagonal-slide {',
+    '',
+    '  from {',
+    '    left: 0;',
+    '    top: 0;',
+    '  }',
+    '',
+    '  50% {',
+    '    left: 55px;',
+    '  }',
+    '',
+    '  to {',
+    '    left: 100px;',
+    '    top: 100px;',
+    '  }',
+    '',
+    '}'].join('\n');
+  assertParsedCssStylesheet(
+    [
+      "startStylesheet",     [],
+        "startRuleset",      [["div"]],
+          "declaration",     ["animation-name", ["diagonal-slide"]],
+          "declaration",     ["animation-duration", ["5s"]],
+          "declaration",     ["animation-iteration-count", ["10"]],
+        "endRuleset",        [],
+        "startAtrule",       ["@keyframes", ["diagonal-slide"]],
+          "startBlock",      [],
+            "startRuleset",  [["from"]],  // Not really a ruleset.
+              "declaration", ["left", ["0"]],
+              "declaration", ["top", ["0"]],
+            "endRuleset",    [],
+            "startRuleset",  [["50%"]],   // Not really a ruleset.
+              "declaration", ["left", ["55px"]],
+            "endRuleset",    [],
+            "startRuleset",  [["to"]],    // Not really a ruleset.
+              "declaration", ["left", ["100px"]],
+              "declaration", ["top", ["100px"]],
+            "endRuleset",    [],
+          "endBlock",        [],
+        "endAtrule",         [],
+      "endStylesheet",       []
+    ],
+    input);
+});


--

--- You received this message because you are subscribed to the Google Groups "Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to