mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
Use SMIL override value that has been processed during animation-only restyles for normal restyle.
In the case where we process an element which has SMIL animations in normal travesal the SMIL styles must have been computed in animation-only restyles. So we have only to pick the computed styles instead of recomputing it.
This commit is contained in:
parent
96d6b30eff
commit
d30c4fe79d
3 changed files with 60 additions and 21 deletions
|
@ -1128,6 +1128,30 @@ impl StrongRuleNode {
|
|||
}
|
||||
result
|
||||
}
|
||||
|
||||
/// Returns PropertyDeclarationBlock for this node.
|
||||
/// This function must be called only for animation level node.
|
||||
fn get_animation_style(&self) -> &Arc<Locked<PropertyDeclarationBlock>> {
|
||||
debug_assert!(self.cascade_level().is_animation(),
|
||||
"The cascade level should be an animation level");
|
||||
match *self.style_source().unwrap() {
|
||||
StyleSource::Declarations(ref block) => block,
|
||||
StyleSource::Style(_) => unreachable!("animating style should not be a style rule"),
|
||||
}
|
||||
}
|
||||
|
||||
/// Returns SMIL override declaration block if exists.
|
||||
pub fn get_smil_animation_rule(&self) -> Option<&Arc<Locked<PropertyDeclarationBlock>>> {
|
||||
if cfg!(feature = "servo") {
|
||||
// Servo has no knowledge of a SMIL rule, so just avoid looking for it.
|
||||
return None;
|
||||
}
|
||||
|
||||
self.self_and_ancestors()
|
||||
.take_while(|node| node.cascade_level() >= CascadeLevel::SMILOverride)
|
||||
.find(|node| node.cascade_level() == CascadeLevel::SMILOverride)
|
||||
.map(|node| node.get_animation_style())
|
||||
}
|
||||
}
|
||||
|
||||
/// An iterator over a rule node and its ancestors.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue