Browse Source

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.
pull/24/head
Moonchild 2 years ago committed by roytam1
parent
commit
15feed4c00
  1. 1
      dom/animation/test/mochitest.ini
  2. 9
      dom/base/nsDocument.cpp
  3. 1
      dom/base/nsDocument.h
  4. 2
      dom/webidl/Animatable.webidl
  5. 2
      dom/webidl/CSSPseudoElement.webidl
  6. 2
      dom/webidl/Document.webidl
  7. 5
      modules/libpref/init/all.js

1
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

9
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()
{

1
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(

2
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);
};

2
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;

2
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();
};

5
modules/libpref/init/all.js

@ -2710,17 +2710,16 @@ pref("layout.idle_period.required_quiescent_frames", 2);
pref("layout.idle_period.time_limit", 1);
// Is support for the Web Animations API enabled?
// Before enabling this by default, make sure also CSSPseudoElement interface
// has been spec'ed properly, or we should add a separate pref for
// CSSPseudoElement interface. See Bug 1174575 for further details.
#ifdef RELEASE_OR_BETA
pref("dom.animations-api.core.enabled", false);
#else
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);
pref("dom.animations-api.getAnimations.enabled", false);
// Is support for the Element.animate() function (a subset of the Web Animations
// API) enabled?

Loading…
Cancel
Save