summaryrefslogtreecommitdiffstats
path: root/dom
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2021-01-14 17:43:44 +0000
committerMoonchild <moonchild@palemoon.org>2021-01-14 17:43:44 +0000
commitabc58d2ed0fd7739b31be78d6338ae79206ce879 (patch)
treeb44936cf95aea75ecb8de43d17f46967929f7bfd /dom
parent931314ef61ce982ac4bae782c67477d48028fc56 (diff)
downloadUXP-abc58d2ed0fd7739b31be78d6338ae79206ce879.tar
UXP-abc58d2ed0fd7739b31be78d6338ae79206ce879.tar.gz
UXP-abc58d2ed0fd7739b31be78d6338ae79206ce879.tar.lz
UXP-abc58d2ed0fd7739b31be78d6338ae79206ce879.tar.xz
UXP-abc58d2ed0fd7739b31be78d6338ae79206ce879.zip
Issue #1689 - Part 4: Add a preference for {Document,Element}.getAnimations()
This is probably the last thing we will ship (if ever) since it needs the most spec and implementation work for arbitrary use that is pretty far into a corner.
Diffstat (limited to 'dom')
-rw-r--r--dom/animation/test/mochitest.ini1
-rw-r--r--dom/base/nsDocument.cpp9
-rw-r--r--dom/base/nsDocument.h1
-rw-r--r--dom/webidl/Animatable.webidl2
-rw-r--r--dom/webidl/CSSPseudoElement.webidl2
-rw-r--r--dom/webidl/Document.webidl2
6 files changed, 14 insertions, 3 deletions
diff --git a/dom/animation/test/mochitest.ini b/dom/animation/test/mochitest.ini
index fff62ac7c..ecdb674fe 100644
--- a/dom/animation/test/mochitest.ini
+++ b/dom/animation/test/mochitest.ini
@@ -2,6 +2,7 @@
prefs =
dom.animations-api.compositing.enabled=true
dom.animations-api.core.enabled=true
+ dom.animations-api.getAnimations.enabled=true
dom.animations-api.implicit-keyframes.enabled=true
dom.animations-api.timelines.enabled=true
# Support files for chrome tests that we want to load over HTTP need
diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp
index 43f11c031..1c3e7a421 100644
--- a/dom/base/nsDocument.cpp
+++ b/dom/base/nsDocument.cpp
@@ -2941,6 +2941,15 @@ nsDocument::AreWebAnimationsImplicitKeyframesEnabled(JSContext* /*unused*/, JSOb
Preferences::GetBool("dom.animations-api.implicit-keyframes.enabled");
}
+bool
+nsDocument::IsWebAnimationsGetAnimationsEnabled(JSContext* /*unused*/, JSObject* /*unused*/)
+{
+ MOZ_ASSERT(NS_IsMainThread());
+
+ return nsContentUtils::IsCallerChrome() ||
+ Preferences::GetBool("dom.animations-api.getAnimations.enabled");
+}
+
DocumentTimeline*
nsDocument::Timeline()
{
diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h
index f544166c2..010f95ae2 100644
--- a/dom/base/nsDocument.h
+++ b/dom/base/nsDocument.h
@@ -435,6 +435,7 @@ public:
static bool IsWebAnimationsEnabled(JSContext* aCx, JSObject* aObject);
static bool AreWebAnimationsImplicitKeyframesEnabled(JSContext* aCx, JSObject* aObject);
static bool AreWebAnimationsTimelinesEnabled(JSContext* aCx, JSObject* aObject);
+ static bool IsWebAnimationsGetAnimationsEnabled(JSContext* aCx, JSObject* aObject);
virtual mozilla::dom::DocumentTimeline* Timeline() override;
virtual void GetAnimations(
diff --git a/dom/webidl/Animatable.webidl b/dom/webidl/Animatable.webidl
index 4c1396c99..decc13960 100644
--- a/dom/webidl/Animatable.webidl
+++ b/dom/webidl/Animatable.webidl
@@ -23,6 +23,6 @@ interface Animatable {
[Func="nsDocument::IsElementAnimateEnabled", Throws]
Animation animate(object? keyframes,
optional UnrestrictedDoubleOrKeyframeAnimationOptions options);
- [Func="nsDocument::IsWebAnimationsEnabled"]
+ [Func="nsDocument::IsWebAnimationsGetAnimationsEnabled"]
sequence<Animation> getAnimations(optional AnimationFilter filter);
};
diff --git a/dom/webidl/CSSPseudoElement.webidl b/dom/webidl/CSSPseudoElement.webidl
index 96d191e3a..250bef03c 100644
--- a/dom/webidl/CSSPseudoElement.webidl
+++ b/dom/webidl/CSSPseudoElement.webidl
@@ -15,7 +15,7 @@
// this interface.
// What we implement here is a minimal subset of the two definitions which we
// ship behind a pref until the specification issues have been resolved.
-[Func="nsDocument::IsWebAnimationsEnabled"]
+[Func="nsDocument::IsWebAnimationsGetAnimationsEnabled"]
interface CSSPseudoElement {
readonly attribute DOMString type;
readonly attribute Element parentElement;
diff --git a/dom/webidl/Document.webidl b/dom/webidl/Document.webidl
index 46db00876..2ade9a2c9 100644
--- a/dom/webidl/Document.webidl
+++ b/dom/webidl/Document.webidl
@@ -314,7 +314,7 @@ partial interface Document {
partial interface Document {
[Func="nsDocument::AreWebAnimationsTimelinesEnabled"]
readonly attribute DocumentTimeline timeline;
- [Func="nsDocument::IsWebAnimationsEnabled"]
+ [Func="nsDocument::IsWebAnimationsGetAnimationsEnabled"]
sequence<Animation> getAnimations();
};