summaryrefslogtreecommitdiff
path: root/dom/base
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2021-01-14 14:46:52 +0000
committerMoonchild <moonchild@palemoon.org>2021-01-14 14:46:52 +0000
commitb0fe759f033f36a9a85afd7cc358b4800def5013 (patch)
treeefc8d2e0668b2f4506388cc92d6087809f84ee50 /dom/base
parent51581427794bb41142285bc837e9cf461d8abe7a (diff)
downloaduxp-b0fe759f033f36a9a85afd7cc358b4800def5013.tar.gz
Issue #1689 - Part 1: Add pref for DOM Animation timelines API
Default false, no intent to ship for web content. Always enabled for Chrome.
Diffstat (limited to 'dom/base')
-rw-r--r--dom/base/nsDocument.cpp9
-rw-r--r--dom/base/nsDocument.h2
2 files changed, 11 insertions, 0 deletions
diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp
index 0fed2db01a..4d6579a898 100644
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -2923,6 +2923,15 @@ nsDocument::IsWebAnimationsEnabled(JSContext* /*unused*/, JSObject* /*unused*/)
Preferences::GetBool("dom.animations-api.core.enabled");
}
+bool
+nsDocument::AreWebAnimationsTimelinesEnabled(JSContext* /*unused*/, JSObject* /*unused*/)
+{
+ MOZ_ASSERT(NS_IsMainThread());
+
+ return nsContentUtils::IsCallerChrome() ||
+ Preferences::GetBool("dom.animations-api.timelines.enabled");
+}
+
DocumentTimeline*
nsDocument::Timeline()
{
diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h
index 951ed26169..a1fb04c6b0 100644
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -433,6 +433,8 @@ public:
static bool IsElementAnimateEnabled(JSContext* aCx, JSObject* aObject);
static bool IsWebAnimationsEnabled(JSContext* aCx, JSObject* aObject);
+ static bool AreWebAnimationsTimelinesEnabled(JSContext* aCx, JSObject* aObject);
+
virtual mozilla::dom::DocumentTimeline* Timeline() override;
virtual void GetAnimations(
nsTArray<RefPtr<mozilla::dom::Animation>>& aAnimations) override;