Bug 1471814 - Add a preference for animation composite modes; r=bz,hiro

This feature should not be shipped until the various definitions of addition for
each additive property are properly specified.

Unlike other patches in this series, compositing is not frequently used
internally (e.g. by DevTools etc.) so there is no need to enable this by default
for system code.

Also, it turns out we have inadvertently been shipping part of this feature for
some time now. The next patch in this series will add tests for that case and
disable that part of the feature (a suitable intent to unship will follow). This
patch merely adapts and extends the existing tests without affecting the surface
area covered by the combination of the newly-added pref and the existing
dom.animations-api.core.enabled pref.

MozReview-Commit-ID: Htr6mlyCBav
This commit is contained in:
Brian Birtles
2018-07-14 09:23:03 +09:00
parent 9857d54b1c
commit e72222f013
16 changed files with 125 additions and 70 deletions

View File

@@ -21,6 +21,7 @@
#include "mozilla/LookAndFeel.h" // For LookAndFeel::GetInt
#include "mozilla/KeyframeUtils.h"
#include "mozilla/ServoBindings.h"
#include "mozilla/StaticPrefs.h"
#include "mozilla/TypeTraits.h"
#include "Layers.h" // For Layer
#include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetComputedStyle
@@ -28,7 +29,6 @@
#include "nsCSSPropertyIDSet.h"
#include "nsCSSProps.h" // For nsCSSProps::PropHasFlags
#include "nsCSSPseudoElements.h" // For CSSPseudoElementType
#include "nsDocument.h" // For nsDocument::IsWebAnimationsEnabled
#include "nsIFrame.h"
#include "nsIPresShell.h"
#include "nsIScriptError.h"
@@ -88,23 +88,15 @@ KeyframeEffect::WrapObject(JSContext* aCx,
return KeyframeEffect_Binding::Wrap(aCx, this, aGivenProto);
}
IterationCompositeOperation KeyframeEffect::IterationComposite(
CallerType /*aCallerType*/) const
IterationCompositeOperation KeyframeEffect::IterationComposite() const
{
return mEffectOptions.mIterationComposite;
}
void
KeyframeEffect::SetIterationComposite(
const IterationCompositeOperation& aIterationComposite,
CallerType aCallerType)
const IterationCompositeOperation& aIterationComposite)
{
// Ignore iterationComposite if the Web Animations API is not enabled,
// then the default value 'Replace' will be used.
if (!nsDocument::IsWebAnimationsEnabled(aCallerType)) {
return;
}
if (mEffectOptions.mIterationComposite == aIterationComposite) {
return;
}
@@ -597,9 +589,9 @@ KeyframeEffectParamsFromUnion(const OptionsType& aOptions,
{
KeyframeEffectParams result;
if (aOptions.IsUnrestrictedDouble() ||
// Ignore iterationComposite if the Web Animations API is not enabled,
// then the default value 'Replace' will be used.
!nsDocument::IsWebAnimationsEnabled(aCallerType)) {
// Ignore iterationComposite and composite if the corresponding pref is
// not set. The default value 'Replace' will be used instead.
!StaticPrefs::dom_animations_api_compositing_enabled()) {
return result;
}