From 38c84639c3606c209b4e1aad3a56ffb85ad65051 Mon Sep 17 00:00:00 2001
From: Marijn Haverbeke <marijnh@gmail.com>
Date: Thu, 23 Jan 2014 15:12:48 +0100
Subject: [PATCH] [css mode] Add simple support for @keyframes

Closes #2161
---
 mode/css/css.js | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/mode/css/css.js b/mode/css/css.js
index 2e61dcec..06d73455 100644
--- a/mode/css/css.js
+++ b/mode/css/css.js
@@ -140,6 +140,8 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
       return pushContext(state, stream, "media");
     } else if (type == "@font-face") {
       return "font_face_before";
+    } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {
+      return "keyframes";
     } else if (type && type.charAt(0) == "@") {
       return pushContext(state, stream, "at");
     } else if (type == "hash") {
@@ -264,6 +266,12 @@ CodeMirror.defineMode("css", function(config, parserConfig) {
     return "font_face";
   };
 
+  states.keyframes = function(type, stream, state) {
+    if (type == "word") { override = "variable"; return "keyframes"; }
+    if (type == "{") return pushContext(state, stream, "top");
+    return pass(type, stream, state);
+  };
+
   states.at = function(type, stream, state) {
     if (type == ";") return popContext(state);
     if (type == "{" || type == "}") return popAndPass(type, stream, state);
-- 
GitLab