mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Record source location for keyframes rule.
This commit is contained in:
parent
1c865ddc3c
commit
0c1fd2f26e
2 changed files with 10 additions and 3 deletions
|
@ -565,6 +565,8 @@ pub struct KeyframesRule {
|
||||||
pub keyframes: Vec<Arc<Locked<Keyframe>>>,
|
pub keyframes: Vec<Arc<Locked<Keyframe>>>,
|
||||||
/// Vendor prefix type the @keyframes has.
|
/// Vendor prefix type the @keyframes has.
|
||||||
pub vendor_prefix: Option<VendorPrefix>,
|
pub vendor_prefix: Option<VendorPrefix>,
|
||||||
|
/// The line and column of the rule's source code.
|
||||||
|
pub source_location: SourceLocation,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ToCssWithGuard for KeyframesRule {
|
impl ToCssWithGuard for KeyframesRule {
|
||||||
|
@ -1032,7 +1034,7 @@ enum AtRulePrelude {
|
||||||
/// A @viewport rule prelude.
|
/// A @viewport rule prelude.
|
||||||
Viewport,
|
Viewport,
|
||||||
/// A @keyframes rule, with its animation name and vendor prefix if exists.
|
/// A @keyframes rule, with its animation name and vendor prefix if exists.
|
||||||
Keyframes(KeyframesName, Option<VendorPrefix>),
|
Keyframes(KeyframesName, Option<VendorPrefix>, SourceLocation),
|
||||||
/// A @page rule prelude.
|
/// A @page rule prelude.
|
||||||
Page(SourceLocation),
|
Page(SourceLocation),
|
||||||
/// A @document rule, with its conditional.
|
/// A @document rule, with its conditional.
|
||||||
|
@ -1257,7 +1259,7 @@ impl<'a, 'b> AtRuleParser for NestedRuleParser<'a, 'b> {
|
||||||
}
|
}
|
||||||
let name = KeyframesName::parse(self.context, input)?;
|
let name = KeyframesName::parse(self.context, input)?;
|
||||||
|
|
||||||
Ok(AtRuleType::WithBlock(AtRulePrelude::Keyframes(name, prefix)))
|
Ok(AtRuleType::WithBlock(AtRulePrelude::Keyframes(name, prefix, location)))
|
||||||
},
|
},
|
||||||
"page" => {
|
"page" => {
|
||||||
if cfg!(feature = "gecko") {
|
if cfg!(feature = "gecko") {
|
||||||
|
@ -1311,12 +1313,13 @@ impl<'a, 'b> AtRuleParser for NestedRuleParser<'a, 'b> {
|
||||||
Ok(CssRule::Viewport(Arc::new(self.shared_lock.wrap(
|
Ok(CssRule::Viewport(Arc::new(self.shared_lock.wrap(
|
||||||
try!(ViewportRule::parse(&context, input))))))
|
try!(ViewportRule::parse(&context, input))))))
|
||||||
}
|
}
|
||||||
AtRulePrelude::Keyframes(name, prefix) => {
|
AtRulePrelude::Keyframes(name, prefix, location) => {
|
||||||
let context = ParserContext::new_with_rule_type(self.context, Some(CssRuleType::Keyframes));
|
let context = ParserContext::new_with_rule_type(self.context, Some(CssRuleType::Keyframes));
|
||||||
Ok(CssRule::Keyframes(Arc::new(self.shared_lock.wrap(KeyframesRule {
|
Ok(CssRule::Keyframes(Arc::new(self.shared_lock.wrap(KeyframesRule {
|
||||||
name: name,
|
name: name,
|
||||||
keyframes: parse_keyframe_list(&context, input, self.shared_lock),
|
keyframes: parse_keyframe_list(&context, input, self.shared_lock),
|
||||||
vendor_prefix: prefix,
|
vendor_prefix: prefix,
|
||||||
|
source_location: location,
|
||||||
}))))
|
}))))
|
||||||
}
|
}
|
||||||
AtRulePrelude::Page(location) => {
|
AtRulePrelude::Page(location) => {
|
||||||
|
|
|
@ -246,6 +246,10 @@ fn test_parse_stylesheet() {
|
||||||
})),
|
})),
|
||||||
],
|
],
|
||||||
vendor_prefix: None,
|
vendor_prefix: None,
|
||||||
|
source_location: SourceLocation {
|
||||||
|
line: 16,
|
||||||
|
column: 19,
|
||||||
|
},
|
||||||
})))
|
})))
|
||||||
|
|
||||||
], &stylesheet.shared_lock),
|
], &stylesheet.shared_lock),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue