From cd6c2e6bffc40e8d38fbd10ef4e6399ca6a5aced Mon Sep 17 00:00:00 2001 From: Boris Chiou Date: Fri, 23 Sep 2016 14:31:34 +0800 Subject: [PATCH] Bug 1304805 - Make spacing, iteration composite and effect composite work if the caller is chrome. r=hiro MozReview-Commit-ID: 30BOUA8QPh8 --HG-- extra : rebase_source : 21af58ad6f27f47404affe2f87fb9a426f01b496 --- dom/animation/AnimationUtils.cpp | 5 +++-- dom/animation/AnimationUtils.h | 4 ++-- dom/animation/KeyframeEffect.cpp | 2 +- dom/animation/KeyframeEffectParams.cpp | 2 +- dom/animation/KeyframeEffectReadOnly.cpp | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dom/animation/AnimationUtils.cpp b/dom/animation/AnimationUtils.cpp index 0add3c3a6b8b..476652f77876 100644 --- a/dom/animation/AnimationUtils.cpp +++ b/dom/animation/AnimationUtils.cpp @@ -6,6 +6,7 @@ #include "AnimationUtils.h" +#include "nsContentUtils.h" // For nsContentUtils::IsCallerChrome #include "nsDebug.h" #include "nsIAtom.h" #include "nsIContent.h" @@ -63,7 +64,7 @@ AnimationUtils::IsOffscreenThrottlingEnabled() } /* static */ bool -AnimationUtils::IsCoreAPIEnabled() +AnimationUtils::IsCoreAPIEnabledForCaller() { static bool sCoreAPIEnabled; static bool sPrefCached = false; @@ -74,7 +75,7 @@ AnimationUtils::IsCoreAPIEnabled() "dom.animations-api.core.enabled"); } - return sCoreAPIEnabled; + return sCoreAPIEnabled || nsContentUtils::IsCallerChrome(); } } // namespace mozilla diff --git a/dom/animation/AnimationUtils.h b/dom/animation/AnimationUtils.h index 94d346abc135..82ae69bc85af 100644 --- a/dom/animation/AnimationUtils.h +++ b/dom/animation/AnimationUtils.h @@ -63,10 +63,10 @@ public: /** * Returns true if the preference to enable the core Web Animations API is - * true. + * true or the caller is chrome. */ static bool - IsCoreAPIEnabled(); + IsCoreAPIEnabledForCaller(); }; } // namespace mozilla diff --git a/dom/animation/KeyframeEffect.cpp b/dom/animation/KeyframeEffect.cpp index c48867cb1361..00f63bc000a0 100644 --- a/dom/animation/KeyframeEffect.cpp +++ b/dom/animation/KeyframeEffect.cpp @@ -132,7 +132,7 @@ KeyframeEffect::SetIterationComposite( { // Ignore iterationComposite if the Web Animations API is not enabled, // then the default value 'Replace' will be used. - if (!AnimationUtils::IsCoreAPIEnabled()) { + if (!AnimationUtils::IsCoreAPIEnabledForCaller()) { return; } diff --git a/dom/animation/KeyframeEffectParams.cpp b/dom/animation/KeyframeEffectParams.cpp index 4490faed105a..25764069194c 100644 --- a/dom/animation/KeyframeEffectParams.cpp +++ b/dom/animation/KeyframeEffectParams.cpp @@ -115,7 +115,7 @@ KeyframeEffectParams::ParseSpacing(const nsAString& aSpacing, // Ignore spacing if the core API is not enabled since it is not yet ready to // ship. - if (!AnimationUtils::IsCoreAPIEnabled()) { + if (!AnimationUtils::IsCoreAPIEnabledForCaller()) { aSpacingMode = SpacingMode::distribute; return; } diff --git a/dom/animation/KeyframeEffectReadOnly.cpp b/dom/animation/KeyframeEffectReadOnly.cpp index cb8e668796a3..58349a669473 100644 --- a/dom/animation/KeyframeEffectReadOnly.cpp +++ b/dom/animation/KeyframeEffectReadOnly.cpp @@ -512,7 +512,7 @@ KeyframeEffectParamsFromUnion(const OptionsType& aOptions, aRv); // Ignore iterationComposite if the Web Animations API is not enabled, // then the default value 'Replace' will be used. - if (AnimationUtils::IsCoreAPIEnabled()) { + if (AnimationUtils::IsCoreAPIEnabledForCaller()) { result.mIterationComposite = options.mIterationComposite; } }