Add flag that represents the traversal is only for animation-only restyle.

We will set the flag when the root node of the traversal has
has-animation-only-dirty-descendants flag or has animation restyle hints.
Also we will use this flag to detect whether we need to trigger CSS transitions
or not.
This commit is contained in:
Hiroyuki Ikezoe 2017-03-26 18:47:16 +09:00
parent 499d1c4117
commit be332fe5a4
4 changed files with 20 additions and 3 deletions

View file

@ -520,6 +520,7 @@ impl LayoutThread {
local_context_creation_data: Mutex::new(thread_local_style_context_creation_data),
timer: self.timer.clone(),
quirks_mode: self.quirks_mode.unwrap(),
animation_only_restyle: false,
},
image_cache_thread: Mutex::new(self.image_cache_thread.clone()),
font_cache_thread: Mutex::new(self.font_cache_thread.clone()),

View file

@ -87,6 +87,9 @@ pub struct SharedStyleContext<'a> {
/// The QuirksMode state which the document needs to be rendered with
pub quirks_mode: QuirksMode,
/// True if the traversal is processing only animation restyles.
pub animation_only_restyle: bool,
}
impl<'a> SharedStyleContext<'a> {

View file

@ -372,6 +372,16 @@ pub trait TElement : PartialEq + Debug + Sized + Copy + Clone + ElementExt + Pre
/// Returns true if the element has a CSS animation.
fn has_css_animations(&self, _pseudo: Option<&PseudoElement>) -> bool;
/// Returns true if the element has animation restyle hints.
fn has_animation_restyle_hints(&self) -> bool {
let data = match self.borrow_data() {
Some(d) => d,
None => return false,
};
return data.get_restyle()
.map_or(false, |r| r.hint.has_animation_hint());
}
}
/// TNode and TElement aren't Send because we want to be careful and explicit