Handle display property change from 'none' only if there is restyle hint for SMIL

We only need to handle changes when the display property is changed from 'none'
when we have a restyle hint for SMIL.  The only other case where we expect to
see changes to display property during an animation are from using the CSSOM.
However, when the display property is changed from 'none' by the CSSOM, during
the animation-only restyle we can skip all descendants since they will be
traversed in the subsequent normal traversal because at that time we flush
style sheets and traverse all elements in the document. So we don't need to
care about the descendants during animation-only restyle.
This commit is contained in:
Hiroyuki Ikezoe 2017-09-25 13:49:39 +09:00
parent fd0295ead2
commit aefea7230f

View file

@ -186,6 +186,9 @@ trait PrivateMatchMethods: TElement {
use context::DISPLAY_CHANGED_FROM_NONE_FOR_SMIL;
use properties::longhands::display::computed_value as display;
debug_assert!(restyle_hints.intersects(RESTYLE_SMIL),
"Should have restyle hint for SMIL");
let display_changed_from_none = old_values.map_or(false, |old| {
let old_display_style = old.get_box().clone_display();
let new_display_style = new_values.get_box().clone_display();
@ -219,10 +222,12 @@ trait PrivateMatchMethods: TElement {
use context::UpdateAnimationsTasks;
if context.shared.traversal_flags.for_animation_only() {
if restyle_hint.intersects(RESTYLE_SMIL) {
self.handle_display_change_for_smil_if_needed(context,
old_values.as_ref().map(|v| &**v),
new_values,
restyle_hint);
}
return;
}