Skip snapshot handling during animation-only restyle.

This commit is contained in:
Hiroyuki Ikezoe 2017-07-18 19:14:22 +09:00
parent f91126ba86
commit 9c05481923
2 changed files with 13 additions and 3 deletions

View file

@ -241,6 +241,11 @@ impl ElementData {
element: E,
shared_context: &SharedStyleContext)
{
// In animation-only restyle we shouldn't touch snapshot at all.
if shared_context.traversal_flags.for_animation_only() {
return;
}
use invalidation::element::invalidator::TreeStyleInvalidator;
debug!("invalidate_style_if_needed: {:?}, flags: {:?}, has_snapshot: {}, \

View file

@ -235,7 +235,9 @@ pub trait DomTraversal<E: TElement> : Sync {
// Look at whether there has been any attribute or state change, and
// invalidate our style, and the one of our siblings and descendants as
// needed.
data.invalidate_style_if_needed(root, shared_context);
if !flags.for_animation_only() {
data.invalidate_style_if_needed(root, shared_context);
}
let parent = root.traversal_parent();
let parent_data = match parent {
@ -523,7 +525,8 @@ where
{
context.thread_local.begin_element(element, data);
context.thread_local.statistics.elements_traversed += 1;
debug_assert!(!element.has_snapshot() || element.handled_snapshot(),
debug_assert!(context.shared.traversal_flags.for_animation_only() ||
!element.has_snapshot() || element.handled_snapshot(),
"Should've handled snapshots here already");
let compute_self =
@ -810,7 +813,9 @@ where
// as needed.
//
// NB: This will be a no-op if there's no snapshot.
child_data.invalidate_style_if_needed(child, &context.shared);
if !flags.for_animation_only() {
child_data.invalidate_style_if_needed(child, &context.shared);
}
if D::element_needs_traversal(child, flags, &*child_data, Some(data)) {
note_child(child_node);