Bug 1518374 - Mark GetKeyframes and GetTargetComputedStyle as const; r=hiro
authorBrian Birtles <birtles@gmail.com>
Tue, 08 Jan 2019 06:42:17 +0000
changeset 452808 c19867adc2c78839543c18eecd2c6425e736b894
parent 452807 d497b0f223c9f1836cf320b594964794fd54f4bd
child 452809 b1f4b8412f62416c82bf0dba41ca7cb7125910e9
push id35330
push useropoprus@mozilla.com
push dateTue, 08 Jan 2019 09:41:12 +0000
treeherdermozilla-central@4ad5b70956ab [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershiro
bugs1518374
milestone66.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 1518374 - Mark GetKeyframes and GetTargetComputedStyle as const; r=hiro Depends on D15899 Differential Revision: https://phabricator.services.mozilla.com/D15900
dom/animation/KeyframeEffect.cpp
dom/animation/KeyframeEffect.h
--- a/dom/animation/KeyframeEffect.cpp
+++ b/dom/animation/KeyframeEffect.cpp
@@ -758,17 +758,17 @@ void KeyframeEffect::RequestRestyle(
       nsContentUtils::GetContextForContent(mTarget->mElement);
   if (presContext && mAnimation) {
     presContext->EffectCompositor()->RequestRestyle(
         mTarget->mElement, mTarget->mPseudoType, aRestyleType,
         mAnimation->CascadeLevel());
   }
 }
 
-already_AddRefed<ComputedStyle> KeyframeEffect::GetTargetComputedStyle() {
+already_AddRefed<ComputedStyle> KeyframeEffect::GetTargetComputedStyle() const {
   if (!GetRenderedDocument()) {
     return nullptr;
   }
 
   MOZ_ASSERT(mTarget,
              "Should only have a document when we have a target element");
 
   nsAtom* pseudo =
@@ -990,17 +990,17 @@ void KeyframeEffect::GetProperties(
       }
     }
 
     aProperties.AppendElement(propertyDetails);
   }
 }
 
 void KeyframeEffect::GetKeyframes(JSContext*& aCx, nsTArray<JSObject*>& aResult,
-                                  ErrorResult& aRv) {
+                                  ErrorResult& aRv) const {
   MOZ_ASSERT(aResult.IsEmpty());
   MOZ_ASSERT(!aRv.Failed());
 
   if (!aResult.SetCapacity(mKeyframes.Length(), mozilla::fallible)) {
     aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
     return;
   }
 
--- a/dom/animation/KeyframeEffect.h
+++ b/dom/animation/KeyframeEffect.h
@@ -154,17 +154,17 @@ class KeyframeEffect : public AnimationE
   // This method calls GetTargetComputedStyle which is not safe to use when
   // we are in the middle of updating style. If we need to use this when
   // updating style, we should pass the ComputedStyle into this method and use
   // that to update the properties rather than calling
   // GetComputedStyle.
   void SetTarget(const Nullable<ElementOrCSSPseudoElement>& aTarget);
 
   void GetKeyframes(JSContext*& aCx, nsTArray<JSObject*>& aResult,
-                    ErrorResult& aRv);
+                    ErrorResult& aRv) const;
   void GetProperties(nsTArray<AnimationPropertyDetails>& aProperties,
                      ErrorResult& aRv) const;
 
   IterationCompositeOperation IterationComposite() const;
   void SetIterationComposite(
       const IterationCompositeOperation& aIterationComposite);
 
   CompositeOperation Composite() const;
@@ -356,17 +356,17 @@ class KeyframeEffect : public AnimationE
   // have changed, or when the target frame might have changed.
   void MaybeUpdateFrameForCompositor();
 
   // Looks up the ComputedStyle 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 GetComputedStyle when we are in the process
   // of building a ComputedStyle may trigger various forms of infinite
   // recursion.
-  already_AddRefed<ComputedStyle> GetTargetComputedStyle();
+  already_AddRefed<ComputedStyle> GetTargetComputedStyle() const;
 
   // A wrapper for marking cascade update according to the current
   // target and its effectSet.
   void MarkCascadeNeedsUpdate();
 
   void EnsureBaseStyles(const ComputedStyle* aComputedValues,
                         const nsTArray<AnimationProperty>& aProperties,
                         bool* aBaseStylesChanged);