diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 8381c525365..89d8ed9a696 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -1515,6 +1515,12 @@ impl<'le> TElement for GeckoElement<'le> { let after_change_ui_style = after_change_style.get_ui(); let existing_transitions = self.css_transitions_info(); + + if after_change_style.get_box().clone_display().is_none() { + // We need to cancel existing transitions. + return !existing_transitions.is_empty(); + } + let mut transitions_to_keep = LonghandIdSet::new(); for transition_property in after_change_style.transition_properties() { let physical_longhand = transition_property diff --git a/components/style/matching.rs b/components/style/matching.rs index 2e18a8de962..1c1da3e05ad 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -347,7 +347,7 @@ trait PrivateMatchMethods: TElement { return false; } - if new_style.clone_display().is_none() || old_style.clone_display().is_none() { + if old_style.clone_display().is_none() { return false; }