Use animation values that have been processed during animation-only restyle for normal restyle.

This commit is contained in:
Hiroyuki Ikezoe 2017-05-24 11:11:56 +09:00
parent 35e0e3aa11
commit 4935d972e5
7 changed files with 76 additions and 47 deletions

View file

@ -8,7 +8,7 @@
#[cfg(feature = "servo")]
use heapsize::HeapSizeOf;
use properties::{Importance, LonghandIdSet, PropertyDeclarationBlock};
use properties::{AnimationRules, Importance, LonghandIdSet, PropertyDeclarationBlock};
use shared_lock::{Locked, StylesheetGuards, SharedRwLockReadGuard};
use smallvec::SmallVec;
use std::io::{self, Write};
@ -1152,6 +1152,32 @@ impl StrongRuleNode {
.find(|node| node.cascade_level() == CascadeLevel::SMILOverride)
.map(|node| node.get_animation_style())
}
/// Returns AnimationRules that has processed during animation-only restyles.
pub fn get_animation_rules(&self) -> AnimationRules {
if cfg!(feature = "servo") {
return AnimationRules(None, None);
}
let mut animation = None;
let mut transition = None;
for node in self.self_and_ancestors()
.take_while(|node| node.cascade_level() >= CascadeLevel::Animations) {
match node.cascade_level() {
CascadeLevel::Animations => {
debug_assert!(animation.is_none());
animation = Some(node.get_animation_style())
},
CascadeLevel::Transitions => {
debug_assert!(transition.is_none());
transition = Some(node.get_animation_style())
},
_ => {},
}
}
AnimationRules(animation, transition)
}
}
/// An iterator over a rule node and its ancestors.