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
This commit is contained in:
Boris Chiou 2016-09-23 14:31:34 +08:00
parent bd2546e3ae
commit cd6c2e6bff
5 changed files with 8 additions and 7 deletions

View File

@ -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

View File

@ -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

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}
}