Bug 1309752: Cleanup might_need_transitions_update. r?birtles draft
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 08 Jul 2018 16:15:41 +0200
changeset 815645 4074c169373c04ddd78e39c322b104cf88930746
parent 815644 7b4dd75f61b2d5884f105d4a9b6aa93ec022d00e
push id115591
push userbmo:emilio@crisal.io
push dateMon, 09 Jul 2018 16:15:39 +0000
reviewersbirtles
bugs1309752
milestone63.0a1
Bug 1309752: Cleanup might_need_transitions_update. r?birtles Thought I had to update this as well, but nope. When basically any style changes we already update transitions. needs_transitions_update already handles the physical mapping changing by checking whether any transition for the physical property remain there or not. MozReview-Commit-ID: 6vKwal4yzRU
servo/components/style/gecko/wrapper.rs
--- a/servo/components/style/gecko/wrapper.rs
+++ b/servo/components/style/gecko/wrapper.rs
@@ -1584,35 +1584,34 @@ impl<'le> TElement for GeckoElement<'le>
 
     fn xbl_binding_anonymous_content(&self) -> Option<GeckoNode<'le>> {
         self.xbl_binding_with_content()
             .map(|b| unsafe { GeckoNode::from_content(&*b.anon_content()) })
     }
 
     fn might_need_transitions_update(
         &self,
-        old_values: Option<&ComputedValues>,
-        new_values: &ComputedValues,
+        old_style: Option<&ComputedValues>,
+        new_style: &ComputedValues,
     ) -> bool {
-        use properties::longhands::display::computed_value::T as Display;
-
-        let old_values = match old_values {
+        let old_style = match old_style {
             Some(v) => v,
             None => return false,
         };
 
-        let new_box_style = new_values.get_box();
-        let transition_not_running = !self.has_css_transitions() &&
-            new_box_style.transition_property_count() == 1 &&
-            new_box_style.transition_combined_duration_at(0) <= 0.0f32;
-        let new_display_style = new_box_style.clone_display();
-        let old_display_style = old_values.get_box().clone_display();
+        let new_box_style = new_style.get_box();
+        if !self.has_css_transitions() && !new_box_style.specifies_transitions() {
+            return false;
+        }
 
-        new_box_style.transition_property_count() > 0 && !transition_not_running &&
-            (new_display_style != Display::None && old_display_style != Display::None)
+        if new_box_style.clone_display().is_none() || old_style.clone_display().is_none() {
+            return false;
+        }
+
+        return true;
     }
 
     // Detect if there are any changes that require us to update transitions.
     // This is used as a more thoroughgoing check than the, cheaper
     // might_need_transitions_update check.
     //
     // The following logic shadows the logic used on the Gecko side
     // (nsTransitionManager::DoUpdateTransitions) where we actually perform the