diff --git a/components/style/keyframes.rs b/components/style/keyframes.rs index c12856dd108..cc8a9229b85 100644 --- a/components/style/keyframes.rs +++ b/components/style/keyframes.rs @@ -405,7 +405,7 @@ impl<'a, 'b> DeclarationParser for KeyframeDeclarationParser<'a, 'b> { fn parse_value(&mut self, name: &str, input: &mut Parser) -> Result { let id = try!(PropertyId::parse(name.into())); - match ParsedDeclaration::parse(id, self.context, input, true) { + match ParsedDeclaration::parse(id, self.context, input) { Ok(parsed) => { // In case there is still unparsed text in the declaration, we should roll back. if !input.is_exhausted() { diff --git a/components/style/properties/declaration_block.rs b/components/style/properties/declaration_block.rs index bd23f73748f..fd0704b8971 100644 --- a/components/style/properties/declaration_block.rs +++ b/components/style/properties/declaration_block.rs @@ -628,7 +628,7 @@ pub fn parse_one_declaration(id: PropertyId, -> Result { let context = ParserContext::new(Origin::Author, url_data, error_reporter, Some(CssRuleType::Style)); Parser::new(input).parse_entirely(|parser| { - ParsedDeclaration::parse(id, &context, parser, false) + ParsedDeclaration::parse(id, &context, parser) .map_err(|_| ()) }) } @@ -653,7 +653,7 @@ impl<'a, 'b> DeclarationParser for PropertyDeclarationParser<'a, 'b> { -> Result<(ParsedDeclaration, Importance), ()> { let id = try!(PropertyId::parse(name.into())); let parsed = input.parse_until_before(Delimiter::Bang, |input| { - ParsedDeclaration::parse(id, self.context, input, false) + ParsedDeclaration::parse(id, self.context, input) .map_err(|_| ()) })?; let importance = match input.try(parse_important) { diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index db9eaa9651f..d4957461fc2 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -976,8 +976,7 @@ impl ParsedDeclaration { /// This will not actually parse Importance values, and will always set things /// to Importance::Normal. Parsing Importance values is the job of PropertyDeclarationParser, /// we only set them here so that we don't have to reallocate - pub fn parse(id: PropertyId, context: &ParserContext, input: &mut Parser, - in_keyframe_block: bool) + pub fn parse(id: PropertyId, context: &ParserContext, input: &mut Parser) -> Result { let rule_type = context.rule_type(); debug_assert!(rule_type == CssRuleType::Keyframe || @@ -1000,7 +999,7 @@ impl ParsedDeclaration { LonghandId::${property.camel_case} => { % if not property.derived_from: % if not property.allowed_in_keyframe_block: - if in_keyframe_block { + if rule_type == CssRuleType::Keyframe { return Err(PropertyDeclarationParseError::AnimationPropertyInKeyframeBlock) } % endif @@ -1033,7 +1032,7 @@ impl ParsedDeclaration { % for shorthand in data.shorthands: ShorthandId::${shorthand.camel_case} => { % if not shorthand.allowed_in_keyframe_block: - if in_keyframe_block { + if rule_type == CssRuleType::Keyframe { return Err(PropertyDeclarationParseError::AnimationPropertyInKeyframeBlock) } % endif diff --git a/components/style/supports.rs b/components/style/supports.rs index 37926c2fc9e..932b8bc2880 100644 --- a/components/style/supports.rs +++ b/components/style/supports.rs @@ -213,7 +213,7 @@ impl Declaration { }; let mut input = Parser::new(&self.val); let context = ParserContext::new_with_rule_type(cx, Some(CssRuleType::Style)); - let res = ParsedDeclaration::parse(id, &context, &mut input, /* in_keyframe */ false); + let res = ParsedDeclaration::parse(id, &context, &mut input); let _ = input.try(parse_important); res.is_ok() && input.is_exhausted() } diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 438bd79369d..f4867e2b292 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -952,7 +952,7 @@ pub extern "C" fn Servo_ParseProperty(property: *const nsACString, value: *const let reporter = StdoutErrorReporter; let context = ParserContext::new(Origin::Author, url_data, &reporter, Some(CssRuleType::Style)); - match ParsedDeclaration::parse(id, &context, &mut Parser::new(value), false) { + match ParsedDeclaration::parse(id, &context, &mut Parser::new(value)) { Ok(parsed) => { let global_style_data = &*GLOBAL_STYLE_DATA; let mut block = PropertyDeclarationBlock::new();