Auto merge of #18624 - emilio:easier-is-better, r=nox

style: Early return and skip duplicate assertion in matching.rs

<!-- Reviewable:start -->
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/18624)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-09-25 05:29:48 -05:00 committed by GitHub
commit 30e007ba1a

View file

@ -186,8 +186,9 @@ trait PrivateMatchMethods: TElement {
use context::DISPLAY_CHANGED_FROM_NONE_FOR_SMIL; use context::DISPLAY_CHANGED_FROM_NONE_FOR_SMIL;
use properties::longhands::display::computed_value as display; use properties::longhands::display::computed_value as display;
debug_assert!(restyle_hints.intersects(RESTYLE_SMIL), if !restyle_hints.intersects(RESTYLE_SMIL) {
"Should have restyle hint for SMIL"); return;
}
let display_changed_from_none = old_values.map_or(false, |old| { let display_changed_from_none = old_values.map_or(false, |old| {
let old_display_style = old.get_box().clone_display(); let old_display_style = old.get_box().clone_display();
@ -197,16 +198,16 @@ trait PrivateMatchMethods: TElement {
}); });
if display_changed_from_none { if display_changed_from_none {
// When display value is changed from none to other, we need // When display value is changed from none to other, we need to
// to traverse descendant elements in a subsequent normal // traverse descendant elements in a subsequent normal
// traversal (we can't traverse them in this animation-only // traversal (we can't traverse them in this animation-only restyle
// restyle since we have no way to know whether the decendants // since we have no way to know whether the decendants
// need to be traversed at the beginning of the animation-only // need to be traversed at the beginning of the animation-only
// restyle) // restyle).
debug_assert!(restyle_hints.intersects(RESTYLE_SMIL), let task = ::context::SequentialTask::process_post_animation(
"Display animation should only happen for SMIL"); *self,
let task = ::context::SequentialTask::process_post_animation(*self, DISPLAY_CHANGED_FROM_NONE_FOR_SMIL,
DISPLAY_CHANGED_FROM_NONE_FOR_SMIL); );
context.thread_local.tasks.push(task); context.thread_local.tasks.push(task);
} }
} }
@ -222,12 +223,12 @@ trait PrivateMatchMethods: TElement {
use context::UpdateAnimationsTasks; use context::UpdateAnimationsTasks;
if context.shared.traversal_flags.for_animation_only() { if context.shared.traversal_flags.for_animation_only() {
if restyle_hint.intersects(RESTYLE_SMIL) { self.handle_display_change_for_smil_if_needed(
self.handle_display_change_for_smil_if_needed(context, context,
old_values.as_ref().map(|v| &**v), old_values.as_ref().map(|v| &**v),
new_values, new_values,
restyle_hint); restyle_hint,
} );
return; return;
} }