diff --git a/components/style/matching.rs b/components/style/matching.rs index e7433fdc002..0e03d1e2ea5 100644 --- a/components/style/matching.rs +++ b/components/style/matching.rs @@ -298,7 +298,7 @@ impl StyleSharingCandidateCache { } let box_style = style.get_box(); - if box_style.transition_property_count() > 0 { + if box_style.specifies_transitions() { debug!("Failing to insert to the cache: transitions"); return; } diff --git a/components/style/properties/gecko.mako.rs b/components/style/properties/gecko.mako.rs index 63f4a5abbfa..c2eb70ea979 100644 --- a/components/style/properties/gecko.mako.rs +++ b/components/style/properties/gecko.mako.rs @@ -1890,6 +1890,19 @@ fn static_assert() { self.gecko.mTransitions[0].mProperty = nsCSSPropertyID_eCSSPropertyExtra_no_properties; } } + + /// Returns whether there are any transitions specified. + pub fn specifies_transitions(&self) -> bool { + use gecko_bindings::structs::nsCSSPropertyID::eCSSPropertyExtra_all_properties; + if self.gecko.mTransitionPropertyCount == 1 && + self.gecko.mTransitions[0].mProperty == eCSSPropertyExtra_all_properties && + self.gecko.mTransitions[0].mDuration.max(0.0) + self.gecko.mTransitions[0].mDelay <= 0.0f32 { + return false; + } + + self.gecko.mTransitionPropertyCount > 0 + } + pub fn transition_property_at(&self, index: usize) -> longhands::transition_property::computed_value::SingleComputedValue { self.gecko.mTransitions[index].mProperty.into() diff --git a/components/style/properties/properties.mako.rs b/components/style/properties/properties.mako.rs index a483a82b862..28bfc925cb7 100644 --- a/components/style/properties/properties.mako.rs +++ b/components/style/properties/properties.mako.rs @@ -1509,6 +1509,12 @@ pub mod style_structs { pub fn specifies_animations(&self) -> bool { self.animation_name_iter().any(|name| name.0 != atom!("")) } + + /// Returns whether there are any transitions specified. + #[cfg(feature = "servo")] + pub fn specifies_transitions(&self) -> bool { + self.transition_property_count() > 0 + } % endif }