Bug 1293106 - Ignore 'spacing' if dom.animations-api.core.enabled is false.
MozReview-Commit-ID: K7hbCjLP6vB
--- a/dom/animation/AnimationUtils.cpp
+++ b/dom/animation/AnimationUtils.cpp
@@ -57,9 +57,24 @@ AnimationUtils::IsOffscreenThrottlingEna
sPrefCached = true;
Preferences::AddBoolVarCache(&sOffscreenThrottlingEnabled,
"dom.animations.offscreen-throttling");
}
return sOffscreenThrottlingEnabled;
}
+/* static */ bool
+AnimationUtils::IsCoreAPIEnabled()
+{
+ static bool sCoreAPIEnabled;
+ static bool sPrefCached = false;
+
+ if (!sPrefCached) {
+ sPrefCached = true;
+ Preferences::AddBoolVarCache(&sCoreAPIEnabled,
+ "dom.animations-api.core.enabled");
+ }
+
+ return sCoreAPIEnabled;
+}
+
} // namespace mozilla
--- a/dom/animation/AnimationUtils.h
+++ b/dom/animation/AnimationUtils.h
@@ -55,13 +55,20 @@ public:
static nsIDocument*
GetCurrentRealmDocument(JSContext* aCx);
/**
* Checks if offscreen animation throttling is enabled.
*/
static bool
IsOffscreenThrottlingEnabled();
+
+ /**
+ * Returns true if the preference to enable the core Web Animations API is
+ * true.
+ */
+ static bool
+ IsCoreAPIEnabled();
};
} // namespace mozilla
#endif
--- a/dom/animation/KeyframeEffectParams.cpp
+++ b/dom/animation/KeyframeEffectParams.cpp
@@ -1,16 +1,17 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "mozilla/KeyframeEffectParams.h"
+#include "mozilla/AnimationUtils.h"
#include "mozilla/KeyframeUtils.h"
#include "mozilla/RangedPtr.h"
#include "nsReadableUtils.h"
namespace mozilla {
static inline bool
IsLetter(char16_t aCh)
@@ -106,16 +107,23 @@ ConsumeIdentToken(RangedPtr<const char16
KeyframeEffectParams::ParseSpacing(const nsAString& aSpacing,
SpacingMode& aSpacingMode,
nsCSSProperty& aPacedProperty,
nsAString& aInvalidPacedProperty,
ErrorResult& aRv)
{
aInvalidPacedProperty.Truncate();
+ // Ignore spacing if the core API is not enabled since it is not yet ready to
+ // ship.
+ if (!AnimationUtils::IsCoreAPIEnabled()) {
+ aSpacingMode = SpacingMode::distribute;
+ return;
+ }
+
// Parse spacing.
// distribute | paced({ident})
// https://w3c.github.io/web-animations/#dom-keyframeeffectreadonly-spacing
// 1. distribute spacing.
if (aSpacing.EqualsLiteral("distribute")) {
aSpacingMode = SpacingMode::distribute;
return;
}