Bug 1540220 - Stop uselessly calling EffectCompositor from ResolveStyleLazily. r=hiro
authorEmilio Cobos Álvarez <emilio@crisal.io>
Tue, 09 Apr 2019 18:05:08 +0000
changeset 468611 e1fa16165c528ccb201e8f9e2a24ce6833aeeded
parent 468610 07a87bbee9ca37c2852b620e52b62679719e64f4
child 468612 bd12a191e5af168f52a03e0546cf4b02054d5414
push id35843
push usernbeleuzu@mozilla.com
push dateTue, 09 Apr 2019 22:08:13 +0000
treeherdermozilla-central@a31032a16330 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiro
bugs1540220
milestone68.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 1540220 - Stop uselessly calling EffectCompositor from ResolveStyleLazily. r=hiro It's the caller's responsibility to have up-to-date styles, and nsComputedDOMStyle (which is the only of those callers that could ever care about EffectCompositor stuff) already does it. There's no need to explicitly update animation rules from here, since it would only have a difference for display: none subtrees anyway (otherwise we re-use the cached style already in the element before having a chance to process the potential animation restyles). My guess is that this was just copy-pasta from other functions. This doesn't break any test. Differential Revision: https://phabricator.services.mozilla.com/D25458
layout/style/ServoStyleSet.cpp
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -890,20 +890,20 @@ void ServoStyleSet::StyleNewSubtree(Elem
   MOZ_ASSERT(!postTraversalRequired);
 
   // Annoyingly, the newly-styled content may have animations that need
   // starting, which requires traversing them again. Mark the elements
   // that need animation processing, then do a forgetful traversal to
   // update the styles and clear the animation bits.
   if (GetPresContext()->EffectCompositor()->PreTraverseInSubtree(flags,
                                                                  aRoot)) {
-    postTraversalRequired = Servo_TraverseSubtree(
-        aRoot, mRawSet.get(), &snapshots,
-        ServoTraversalFlags::AnimationOnly |
-            ServoTraversalFlags::FinalAnimationTraversal);
+    postTraversalRequired =
+        Servo_TraverseSubtree(aRoot, mRawSet.get(), &snapshots,
+                              ServoTraversalFlags::AnimationOnly |
+                                  ServoTraversalFlags::FinalAnimationTraversal);
     MOZ_ASSERT(!postTraversalRequired);
   }
 }
 
 void ServoStyleSet::MarkOriginsDirty(OriginFlags aChangedOrigins) {
   SetStylistStyleSheetsDirty();
   Servo_StyleSet_NoteStyleSheetsChanged(mRawSet.get(), aChangedOrigins);
 }
@@ -1130,17 +1130,16 @@ void ServoStyleSet::ClearNonInheritingCo
 }
 
 already_AddRefed<ComputedStyle> ServoStyleSet::ResolveStyleLazily(
     Element& aElement, PseudoStyleType aPseudoType,
     StyleRuleInclusion aRuleInclusion) {
   PreTraverseSync();
   MOZ_ASSERT(GetPresContext(),
              "For now, no style resolution without a pres context");
-  GetPresContext()->EffectCompositor()->PreTraverse(&aElement, aPseudoType);
   MOZ_ASSERT(!StylistNeedsUpdate());
 
   AutoSetInServoTraversal guard(this);
 
   /**
    * NB: This is needed because we process animations and transitions on the
    * pseudo-elements themselves, not on the parent's EagerPseudoStyles.
    *
@@ -1165,32 +1164,20 @@ already_AddRefed<ComputedStyle> ServoSty
     }
   } else if (aPseudoType == PseudoStyleType::marker) {
     if (Element* pseudo = nsLayoutUtils::GetMarkerPseudo(&aElement)) {
       elementForStyleResolution = pseudo;
       pseudoTypeForStyleResolution = PseudoStyleType::NotPseudo;
     }
   }
 
-  RefPtr<ComputedStyle> computedValues =
-      Servo_ResolveStyleLazily(elementForStyleResolution,
-                               pseudoTypeForStyleResolution, aRuleInclusion,
-                               &Snapshots(), mRawSet.get())
-          .Consume();
-
-  if (GetPresContext()->EffectCompositor()->PreTraverse(&aElement,
-                                                        aPseudoType)) {
-    computedValues =
-        Servo_ResolveStyleLazily(elementForStyleResolution,
-                                 pseudoTypeForStyleResolution, aRuleInclusion,
-                                 &Snapshots(), mRawSet.get())
-            .Consume();
-  }
-
-  return computedValues.forget();
+  return Servo_ResolveStyleLazily(elementForStyleResolution,
+                                  pseudoTypeForStyleResolution, aRuleInclusion,
+                                  &Snapshots(), mRawSet.get())
+      .Consume();
 }
 
 void ServoStyleSet::AppendFontFaceRules(
     nsTArray<nsFontFaceRuleContainer>& aArray) {
   // TODO(emilio): Can we make this so this asserts instead?
   UpdateStylistIfNeeded();
   Servo_StyleSet_GetFontFaceRules(mRawSet.get(), &aArray);
 }