Bug 1331704 - Part 3: Drop all of unused stuff. r=birtles, a=gchang
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Sat, 11 Feb 2017 19:11:45 +0900
changeset 378420 08243c8a96514bb8de3e655170c023790af54549
parent 378419 a0897e0e0d0fc1c1a3dc76682c81424e87fefe59
child 378421 a453af7168f3290b05e01aca27dbda196d5da62a
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles, gchang
bugs1331704
milestone53.0a2
Bug 1331704 - Part 3: Drop all of unused stuff. r=birtles, a=gchang MozReview-Commit-ID: BWAC0iZLw6t
dom/animation/EffectCompositor.cpp
dom/animation/EffectCompositor.h
dom/animation/EffectSet.h
dom/animation/KeyframeEffectReadOnly.cpp
dom/animation/KeyframeEffectReadOnly.h
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -338,18 +338,16 @@ EffectCompositor::UpdateEffectProperties
   if (!effectSet) {
     return;
   }
 
   // Style context change might cause CSS cascade level,
   // e.g removing !important, so we should update the cascading result.
   effectSet->MarkCascadeNeedsUpdate();
 
-  ClearBaseStyles(*aElement, aPseudoType);
-
   for (KeyframeEffectReadOnly* effect : *effectSet) {
     effect->UpdateProperties(aStyleContext);
   }
 }
 
 void
 EffectCompositor::MaybeUpdateAnimationRule(dom::Element* aElement,
                                            CSSPseudoElementType aPseudoType,
@@ -879,89 +877,16 @@ EffectCompositor::SetPerformanceWarning(
     return;
   }
 
   for (KeyframeEffectReadOnly* effect : *effects) {
     effect->SetPerformanceWarning(aProperty, aWarning);
   }
 }
 
-/* static */ StyleAnimationValue
-EffectCompositor::GetBaseStyle(nsCSSPropertyID aProperty,
-                               nsStyleContext* aStyleContext,
-                               dom::Element& aElement,
-                               CSSPseudoElementType aPseudoType)
-{
-  MOZ_ASSERT(aStyleContext, "Need style context to resolve the base value");
-  MOZ_ASSERT(!aStyleContext->StyleSource().IsServoComputedValues(),
-             "Bug 1311257: Servo backend does not support the base value yet");
-
-  StyleAnimationValue result;
-
-  EffectSet* effectSet =
-    EffectSet::GetEffectSet(&aElement, aPseudoType);
-  if (!effectSet) {
-    return result;
-  }
-
-  // Check whether there is a cached style.
-  result = effectSet->GetBaseStyle(aProperty);
-  if (!result.IsNull()) {
-    return result;
-  }
-
-  RefPtr<nsStyleContext> styleContextWithoutAnimation =
-    aStyleContext->PresContext()->StyleSet()->AsGecko()->
-      ResolveStyleByRemovingAnimation(&aElement, aStyleContext,
-                                      eRestyle_AllHintsWithAnimations);
-
-  DebugOnly<bool> success =
-    StyleAnimationValue::ExtractComputedValue(aProperty,
-                                              styleContextWithoutAnimation,
-                                              result);
-  MOZ_ASSERT(success, "Should be able to extract computed animation value");
-  MOZ_ASSERT(!result.IsNull(), "Should have a valid StyleAnimationValue");
-
-  effectSet->PutBaseStyle(aProperty, result);
-
-  return result;
-}
-
-/* static */ StyleAnimationValue
-EffectCompositor::GetBaseStyle(nsCSSPropertyID aProperty,
-                               const nsIFrame* aFrame)
-{
-  MOZ_ASSERT(aFrame->StyleContext(),
-             "The frame should have a valid style context");
-
-  Maybe<NonOwningAnimationTarget> pseudoElement =
-    EffectCompositor::GetAnimationElementAndPseudoForFrame(aFrame);
-
-  MOZ_ASSERT(pseudoElement && pseudoElement->mElement,
-             "The frame should have an associated element");
-
-  return EffectCompositor::GetBaseStyle(aProperty,
-                                        aFrame->StyleContext(),
-                                        *pseudoElement->mElement,
-                                        pseudoElement->mPseudoType);
-}
-
-/* static */ void
-EffectCompositor::ClearBaseStyles(dom::Element& aElement,
-                                  CSSPseudoElementType aPseudoType)
-{
-  EffectSet* effectSet =
-    EffectSet::GetEffectSet(&aElement, aPseudoType);
-  if (!effectSet) {
-    return;
-  }
-
-  effectSet->ClearBaseStyles();
-}
-
 // ---------------------------------------------------------
 //
 // Nested class: AnimationStyleRuleProcessor
 //
 // ---------------------------------------------------------
 
 NS_IMPL_ISUPPORTS(EffectCompositor::AnimationStyleRuleProcessor,
                   nsIStyleRuleProcessor)
--- a/dom/animation/EffectCompositor.h
+++ b/dom/animation/EffectCompositor.h
@@ -212,35 +212,16 @@ public:
 
   // Associates a performance warning with effects on |aFrame| that animates
   // |aProperty|.
   static void SetPerformanceWarning(
     const nsIFrame* aFrame,
     nsCSSPropertyID aProperty,
     const AnimationPerformanceWarning& aWarning);
 
-  // Returns the base style of (pseudo-)element for |aProperty|.
-  // If there is no cached base style for the property, a new base style value
-  // is resolved with |aStyleContext|. The new resolved base style is cached
-  // until ClearBaseStyles is called.
-  static StyleAnimationValue GetBaseStyle(nsCSSPropertyID aProperty,
-                                          nsStyleContext* aStyleContext,
-                                          dom::Element& aElement,
-                                          CSSPseudoElementType aPseudoType);
-
-  // Returns the base style corresponding to |aFrame|.
-  // This function should be called only after restyle process has done, i.e.
-  // |aFrame| has a resolved style context.
-  static StyleAnimationValue GetBaseStyle(nsCSSPropertyID aProperty,
-                                          const nsIFrame* aFrame);
-
-  // Clear cached base styles of (pseudo-)element.
-  static void ClearBaseStyles(dom::Element& aElement,
-                              CSSPseudoElementType aPseudoType);
-
 private:
   ~EffectCompositor() = default;
 
   // Rebuilds the animation rule corresponding to |aCascadeLevel| on the
   // EffectSet associated with the specified (pseudo-)element.
   static void ComposeAnimationRule(dom::Element* aElement,
                                    CSSPseudoElementType aPseudoType,
                                    CascadeLevel aCascadeLevel,
--- a/dom/animation/EffectSet.h
+++ b/dom/animation/EffectSet.h
@@ -194,36 +194,16 @@ public:
   {
     return mPropertiesWithImportantRules;
   }
   nsCSSPropertyIDSet& PropertiesForAnimationsLevel()
   {
     return mPropertiesForAnimationsLevel;
   }
 
-  // This function is intended to be called by EffectCompositor::GetBaseStyle
-  // and should not be called directly.
-  StyleAnimationValue GetBaseStyle(nsCSSPropertyID aProperty) const
-  {
-    StyleAnimationValue result;
-    DebugOnly<bool> hasProperty = mBaseStyleValues.Get(aProperty, &result);
-    MOZ_ASSERT(hasProperty || result.IsNull());
-    return result;
-  }
-
-  void PutBaseStyle(nsCSSPropertyID aProperty,
-                    const StyleAnimationValue& aValue)
-  {
-    return mBaseStyleValues.Put(aProperty, aValue);
-  }
-  void ClearBaseStyles()
-  {
-    return mBaseStyleValues.Clear();
-  }
-
 private:
   static nsIAtom* GetEffectSetPropertyAtom(CSSPseudoElementType aPseudoType);
 
   OwningEffectSet mEffects;
 
   // These style rules contain the style data for currently animating
   // values.  They only match when styling with animation.  When we
   // style without animation, we need to not use them so that we can
@@ -262,21 +242,16 @@ private:
   // Specifies the compositor-animatable properties that are overridden by
   // !important rules.
   nsCSSPropertyIDSet mPropertiesWithImportantRules;
   // Specifies the properties for which the result will be added to the
   // animations level of the cascade and hence should be skipped when we are
   // composing the animation style for the transitions level of the cascede.
   nsCSSPropertyIDSet mPropertiesForAnimationsLevel;
 
-  // The non-animated values for properties animated by effects in this set that
-  // contain at least one animation value that is composited with the underlying
-  // value (i.e. it uses the additive or accumulate composite mode).
-  nsDataHashtable<nsUint32HashKey, StyleAnimationValue> mBaseStyleValues;
-
 #ifdef DEBUG
   // Track how many iterators are referencing this effect set when we are
   // destroyed, we can assert that nothing is still pointing to us.
   uint64_t mActiveIterators;
 
   bool mCalledPropertyDtor;
 #endif
 };
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -882,52 +882,34 @@ KeyframeEffectReadOnly::RequestRestyle(
   nsPresContext* presContext = GetPresContext();
   if (presContext && mTarget && mAnimation) {
     presContext->EffectCompositor()->
       RequestRestyle(mTarget->mElement, mTarget->mPseudoType,
                      aRestyleType, mAnimation->CascadeLevel());
   }
 }
 
-template<KeyframeEffectReadOnly::AnimationStyle aAnimationStyle>
 already_AddRefed<nsStyleContext>
-KeyframeEffectReadOnly::DoGetTargetStyleContext()
+KeyframeEffectReadOnly::GetTargetStyleContext()
 {
   nsIPresShell* shell = GetPresShell();
   if (!shell) {
     return nullptr;
   }
 
   MOZ_ASSERT(mTarget,
              "Should only have a presshell when we have a target element");
 
   nsIAtom* pseudo = mTarget->mPseudoType < CSSPseudoElementType::Count
                     ? nsCSSPseudoElements::GetPseudoAtom(mTarget->mPseudoType)
                     : nullptr;
 
-  if (aAnimationStyle == AnimationStyle::Include) {
-    return nsComputedDOMStyle::GetStyleContextForElement(mTarget->mElement,
-                                                         pseudo,
-                                                         shell);
-  }
-
-  return nsComputedDOMStyle::GetStyleContextForElementWithoutAnimation(
-    mTarget->mElement, pseudo, shell);
-}
-
-already_AddRefed<nsStyleContext>
-KeyframeEffectReadOnly::GetTargetStyleContext()
-{
-  return DoGetTargetStyleContext<AnimationStyle::Include>();
-}
-
-already_AddRefed<nsStyleContext>
-KeyframeEffectReadOnly::GetTargetStyleContextWithoutAnimation()
-{
-  return DoGetTargetStyleContext<AnimationStyle::Skip>();
+  return nsComputedDOMStyle::GetStyleContextForElement(mTarget->mElement,
+                                                       pseudo,
+                                                       shell);
 }
 
 #ifdef DEBUG
 void
 DumpAnimationProperties(nsTArray<AnimationProperty>& aAnimationProperties)
 {
   for (auto& p : aAnimationProperties) {
     printf("%s\n", nsCSSProps::GetStringValue(p.mProperty).get());
--- a/dom/animation/KeyframeEffectReadOnly.h
+++ b/dom/animation/KeyframeEffectReadOnly.h
@@ -414,28 +414,16 @@ protected:
 
   // Looks up the style context associated with the target element, if any.
   // We need to be careful to *not* call this when we are updating the style
   // context. That's because calling GetStyleContextForElement when we are in
   // the process of building a style context may trigger various forms of
   // infinite recursion.
   already_AddRefed<nsStyleContext> GetTargetStyleContext();
 
-  // Similar to the above but ignoring animation rules. We use this to get base
-  // styles (which don't include animation rules).
-  already_AddRefed<nsStyleContext>
-  GetTargetStyleContextWithoutAnimation();
-
-  enum AnimationStyle {
-    Skip,
-    Include
-  };
-  template<AnimationStyle aAnimationStyle>
-  already_AddRefed<nsStyleContext> DoGetTargetStyleContext();
-
   // A wrapper for marking cascade update according to the current
   // target and its effectSet.
   void MarkCascadeNeedsUpdate();
 
   // Composites |aValueToComposite| using |aCompositeOperation| onto the value
   // for |aProperty| in |aAnimationRule|, or, if there is no suitable value in
   // |aAnimationRule|, uses the base value for the property recorded on the
   // target element's EffectSet.