From 931314ef61ce982ac4bae782c67477d48028fc56 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Thu, 14 Jan 2021 17:17:28 +0000 Subject: Issue #1689 - Part 3: Add a preference for animation composite modes. This feature should not be shipped until the various definitions of addition for each additive property are properly specified and then implemented accordingly. Unlike other patches in this series, compositing is not frequently used internally so there is no need to enable this by default for chrome callers. --- dom/animation/KeyframeEffect.cpp | 5 +++-- dom/animation/test/mochitest.ini | 1 + layout/reftests/web-animations/reftest.list | 6 +++--- modules/libpref/init/all.js | 1 + 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/dom/animation/KeyframeEffect.cpp b/dom/animation/KeyframeEffect.cpp index 90230a5b4..090c7019d 100644 --- a/dom/animation/KeyframeEffect.cpp +++ b/dom/animation/KeyframeEffect.cpp @@ -10,6 +10,7 @@ #include "mozilla/dom/AnimationEffectTiming.h" #include "mozilla/dom/KeyframeEffectBinding.h" #include "mozilla/KeyframeUtils.h" +#include "mozilla/Preferences.h" #include "nsContentUtils.h" #include "nsDOMMutationObserver.h" // For nsAutoAnimationMutationBatch #include "nsIScriptError.h" @@ -135,9 +136,9 @@ void KeyframeEffect::SetIterationComposite( const IterationCompositeOperation& aIterationComposite) { - // Ignore iterationComposite if the Web Animations API is not enabled, + // Ignore iterationComposite if the API is not enabled, // then the default value 'Replace' will be used. - if (!AnimationUtils::IsCoreAPIEnabledForCaller()) { + if (!Preferences::GetBool("dom.animations-api.compositing.enabled")) { return; } diff --git a/dom/animation/test/mochitest.ini b/dom/animation/test/mochitest.ini index b56136d25..fff62ac7c 100644 --- a/dom/animation/test/mochitest.ini +++ b/dom/animation/test/mochitest.ini @@ -1,5 +1,6 @@ [DEFAULT] prefs = + dom.animations-api.compositing.enabled=true dom.animations-api.core.enabled=true dom.animations-api.implicit-keyframes.enabled=true dom.animations-api.timelines.enabled=true diff --git a/layout/reftests/web-animations/reftest.list b/layout/reftests/web-animations/reftest.list index eefd41f49..da1d07089 100644 --- a/layout/reftests/web-animations/reftest.list +++ b/layout/reftests/web-animations/reftest.list @@ -15,6 +15,6 @@ test-pref(dom.animations-api.core.enabled,true) == stacking-context-transform-ch test-pref(dom.animations-api.core.enabled,true) == stacking-context-transform-changing-effect.html stacking-context-animation-ref.html test-pref(dom.animations-api.core.enabled,true) == stacking-context-transform-changing-display-property.html stacking-context-animation-ref.html test-pref(dom.animations-api.core.enabled,true) == stacking-context-transform-losing-css-animation-in-delay.html stacking-context-animation-ref.html -test-pref(dom.animations-api.core.enabled,true) == style-updates-on-iteration-composition-changed-from-accumulate-to-replace.html style-updates-for-iteration-composite-ref.html -test-pref(dom.animations-api.core.enabled,true) == style-updates-on-iteration-composition-changed-from-replace-to-accumulate.html style-updates-for-iteration-composite-ref.html -test-pref(dom.animations-api.core.enabled,true) == style-updates-on-current-iteration-changed.html style-updates-for-iteration-composite-ref.html +test-pref(dom.animations-api.core.enabled,true) test-pref(dom.animations-api.compositing.enabled,true) == style-updates-on-iteration-composition-changed-from-accumulate-to-replace.html style-updates-for-iteration-composite-ref.html +test-pref(dom.animations-api.core.enabled,true) test-pref(dom.animations-api.compositing.enabled,true) == style-updates-on-iteration-composition-changed-from-replace-to-accumulate.html style-updates-for-iteration-composite-ref.html +test-pref(dom.animations-api.core.enabled,true) test-pref(dom.animations-api.compositing.enabled,true) == style-updates-on-current-iteration-changed.html style-updates-for-iteration-composite-ref.html diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index a4ebdde3e..3319045e7 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -2720,6 +2720,7 @@ pref("dom.animations-api.core.enabled", true); #endif pref("dom.animations-api.timelines.enabled", false); pref("dom.animations-api.implicit-keyframes.enabled", false); +pref("dom.animations-api.compositing.enabled", false); // Is support for the Element.animate() function (a subset of the Web Animations // API) enabled? -- cgit v1.2.3