Bug 1309752: Cleanup might_need_transitions_update. r=birtles
authorEmilio Cobos Álvarez <emilio@crisal.io>
Sun, 08 Jul 2018 16:15:41 +0200
changeset 427070 9ba634ab98bd3e7a770ab5c226bf83237590bd81
parent 427069 c4bd0fbb78654005886cb3d02c4d836b010763a1
child 427071 e9afe9ab29893fe9c986677e948ae810fe96bfb6
push id105397
push useremilio@crisal.io
push dateWed, 18 Jul 2018 10:10:47 +0000
treeherdermozilla-inbound@1467f56b0eee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1309752
milestone63.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
dom/base/nsIDocument.h
layout/style/ServoStyleSet.cpp
servo/components/style/gecko/wrapper.rs
--- a/dom/base/nsIDocument.h
+++ b/dom/base/nsIDocument.h
@@ -2906,25 +2906,23 @@ public:
   void RemoveResponsiveContent(mozilla::dom::HTMLImageElement* aContent)
   {
     MOZ_ASSERT(aContent);
     mResponsiveContent.RemoveEntry(aContent);
   }
 
   void AddComposedDocShadowRoot(mozilla::dom::ShadowRoot& aShadowRoot)
   {
-    MOZ_ASSERT(IsShadowDOMEnabled());
     mComposedShadowRoots.PutEntry(&aShadowRoot);
   }
 
   using ShadowRootSet = nsTHashtable<nsPtrHashKey<mozilla::dom::ShadowRoot>>;
 
   void RemoveComposedDocShadowRoot(mozilla::dom::ShadowRoot& aShadowRoot)
   {
-    MOZ_ASSERT(IsShadowDOMEnabled());
     mComposedShadowRoots.RemoveEntry(&aShadowRoot);
   }
 
   // If you're considering using this, you probably want to use
   // ShadowRoot::IsComposedDocParticipant instead. This is just for
   // sanity-checking.
   bool IsComposedDocShadowRoot(mozilla::dom::ShadowRoot& aShadowRoot)
   {
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -167,20 +167,16 @@ ServoStyleSet::Init(nsPresContext* aPres
   // owned by the document.
   SetStylistXBLStyleSheetsDirty();
 }
 
 template<typename Functor>
 void
 EnumerateShadowRoots(const nsIDocument& aDoc, const Functor& aCb)
 {
-  if (!aDoc.IsShadowDOMEnabled()) {
-    return;
-  }
-
   const nsIDocument::ShadowRootSet& shadowRoots = aDoc.ComposedShadowRoots();
   for (auto iter = shadowRoots.ConstIter(); !iter.Done(); iter.Next()) {
     ShadowRoot* root = iter.Get()->GetKey();
     MOZ_ASSERT(root);
     MOZ_DIAGNOSTIC_ASSERT(root->IsComposedDocParticipant());
     aCb(*root);
   }
 }
--- 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