mirror of
https://github.com/servo/servo.git
synced 2025-08-08 23:15:33 +01:00
style: Fix parsing and add generated keyframes
This commit is contained in:
parent
46eec45886
commit
2d566ef0ef
10 changed files with 189 additions and 94 deletions
|
@ -5,7 +5,7 @@
|
|||
//! Style sheets and their CSS rules.
|
||||
|
||||
use cssparser::{AtRuleParser, Parser, QualifiedRuleParser, decode_stylesheet_bytes};
|
||||
use cssparser::{AtRuleType, RuleListParser};
|
||||
use cssparser::{AtRuleType, RuleListParser, Token};
|
||||
use encoding::EncodingRef;
|
||||
use error_reporting::ParseErrorReporter;
|
||||
use font_face::{FontFaceRule, parse_font_face_block};
|
||||
|
@ -506,7 +506,12 @@ impl<'a, 'b, Impl: SelectorImpl> AtRuleParser for NestedRuleParser<'a, 'b, Impl>
|
|||
}
|
||||
},
|
||||
"keyframes" => {
|
||||
let name = try!(input.expect_ident());
|
||||
let name = match input.next() {
|
||||
Ok(Token::Ident(ref value)) if value != "none" => Atom::from(&**value),
|
||||
Ok(Token::QuotedString(value)) => Atom::from(&*value),
|
||||
_ => return Err(())
|
||||
};
|
||||
|
||||
Ok(AtRuleType::WithBlock(AtRulePrelude::Keyframes(Atom::from(name))))
|
||||
},
|
||||
_ => Err(())
|
||||
|
@ -530,7 +535,7 @@ impl<'a, 'b, Impl: SelectorImpl> AtRuleParser for NestedRuleParser<'a, 'b, Impl>
|
|||
AtRulePrelude::Keyframes(name) => {
|
||||
Ok(CSSRule::Keyframes(KeyframesRule {
|
||||
name: name,
|
||||
keyframes: try!(parse_keyframe_list(&self.context, input)),
|
||||
keyframes: parse_keyframe_list(&self.context, input),
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue