Issue #1689 - Part 1: Add pref for DOM Animation timelines API

Default false, no intent to ship for web content. Always enabled for Chrome.
This commit is contained in:
Moonchild 2021-01-14 14:46:52 +00:00 • committed by roytam1
commit ad1e2abea1
10 changed files with 27 additions and 12 deletions

View file

@ -1,13 +1,13 @@
pref(dom.animations-api.core.enabled,true) load 1239889-1.html pref(dom.animations-api.core.enabled,true) load 1239889-1.html
pref(dom.animations-api.core.enabled,true) load 1244595-1.html pref(dom.animations-api.core.enabled,true) load 1244595-1.html
pref(dom.animations-api.core.enabled,true) load 1216842-1.html pref(dom.animations-api.core.enabled,true) pref(dom.animations-api.timelines.enabled,true) load 1216842-1.html
pref(dom.animations-api.core.enabled,true) load 1216842-2.html pref(dom.animations-api.core.enabled,true) pref(dom.animations-api.timelines.enabled,true) load 1216842-2.html
pref(dom.animations-api.core.enabled,true) load 1216842-3.html pref(dom.animations-api.core.enabled,true) pref(dom.animations-api.timelines.enabled,true) load 1216842-3.html
pref(dom.animations-api.core.enabled,true) load 1216842-4.html pref(dom.animations-api.core.enabled,true) pref(dom.animations-api.timelines.enabled,true) load 1216842-4.html
pref(dom.animations-api.core.enabled,true) load 1216842-5.html pref(dom.animations-api.core.enabled,true) pref(dom.animations-api.timelines.enabled,true) load 1216842-5.html
pref(dom.animations-api.core.enabled,true) load 1216842-6.html pref(dom.animations-api.core.enabled,true) pref(dom.animations-api.timelines.enabled,true) load 1216842-6.html
pref(dom.animations-api.core.enabled,true) load 1272475-1.html pref(dom.animations-api.core.enabled,true) load 1272475-1.html
pref(dom.animations-api.core.enabled,true) load 1272475-2.html pref(dom.animations-api.core.enabled,true) load 1272475-2.html
pref(dom.animations-api.core.enabled,true) load 1278485-1.html pref(dom.animations-api.core.enabled,true) load 1278485-1.html
pref(dom.animations-api.core.enabled,true) load 1277272-1.html pref(dom.animations-api.core.enabled,true) pref(dom.animations-api.timelines.enabled,true) load 1277272-1.html
pref(dom.animations-api.core.enabled,true) load 1290535-1.html pref(dom.animations-api.core.enabled,true) load 1290535-1.html

View file

@ -2923,6 +2923,15 @@ nsDocument::IsWebAnimationsEnabled(JSContext* /*unused*/, JSObject* /*unused*/)
Preferences::GetBool("dom.animations-api.core.enabled"); 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* DocumentTimeline*
nsDocument::Timeline() nsDocument::Timeline()
{ {

View file

@ -433,6 +433,8 @@ public:
static bool IsElementAnimateEnabled(JSContext* aCx, JSObject* aObject); static bool IsElementAnimateEnabled(JSContext* aCx, JSObject* aObject);
static bool IsWebAnimationsEnabled(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 mozilla::dom::DocumentTimeline* Timeline() override;
virtual void GetAnimations( virtual void GetAnimations(
nsTArray<RefPtr<mozilla::dom::Animation>>& aAnimations) override; nsTArray<RefPtr<mozilla::dom::Animation>>& aAnimations) override;

View file

@ -19,7 +19,7 @@ interface Animation : EventTarget {
attribute DOMString id; attribute DOMString id;
[Func="nsDocument::IsWebAnimationsEnabled", Pure] [Func="nsDocument::IsWebAnimationsEnabled", Pure]
attribute AnimationEffectReadOnly? effect; attribute AnimationEffectReadOnly? effect;
[Func="nsDocument::IsWebAnimationsEnabled"] [Func="nsDocument::AreWebAnimationsTimelinesEnabled"]
attribute AnimationTimeline? timeline; attribute AnimationTimeline? timeline;
[BinaryName="startTimeAsDouble"] [BinaryName="startTimeAsDouble"]
attribute double? startTime; attribute double? startTime;

View file

@ -10,7 +10,7 @@
* liability, trademark and document use rules apply. * liability, trademark and document use rules apply.
*/ */
[Func="nsDocument::IsWebAnimationsEnabled"] [Func="nsDocument::AreWebAnimationsTimelinesEnabled"]
interface AnimationTimeline { interface AnimationTimeline {
[BinaryName="currentTimeAsDouble"] [BinaryName="currentTimeAsDouble"]
readonly attribute double? currentTime; readonly attribute double? currentTime;

View file

@ -312,7 +312,7 @@ partial interface Document {
// http://w3c.github.io/web-animations/#extensions-to-the-document-interface // http://w3c.github.io/web-animations/#extensions-to-the-document-interface
partial interface Document { partial interface Document {
[Func="nsDocument::IsWebAnimationsEnabled"] [Func="nsDocument::AreWebAnimationsTimelinesEnabled"]
readonly attribute DocumentTimeline timeline; readonly attribute DocumentTimeline timeline;
[Func="nsDocument::IsWebAnimationsEnabled"] [Func="nsDocument::IsWebAnimationsEnabled"]
sequence<Animation> getAnimations(); sequence<Animation> getAnimations();

View file

@ -14,7 +14,7 @@ dictionary DocumentTimelineOptions {
DOMHighResTimeStamp originTime = 0; DOMHighResTimeStamp originTime = 0;
}; };
[Func="nsDocument::IsWebAnimationsEnabled", [Func="nsDocument::AreWebAnimationsTimelinesEnabled",
Constructor (optional DocumentTimelineOptions options)] Constructor (optional DocumentTimelineOptions options)]
interface DocumentTimeline : AnimationTimeline { interface DocumentTimeline : AnimationTimeline {
}; };

View file

@ -27,7 +27,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1135764
} }
addLoadEvent(function() { addLoadEvent(function() {
SpecialPowers.pushPrefEnv( SpecialPowers.pushPrefEnv(
{ "set": [[ "dom.animations-api.core.enabled", true]] }, { "set": [[ "dom.animations-api.timelines.enabled", true]] },
function() { function() {
var ifr = document.querySelector("iframe"); var ifr = document.querySelector("iframe");
ifr.onload = function() { ifr.onload = function() {

View file

@ -1,4 +1,7 @@
[DEFAULT] [DEFAULT]
prefs =
dom.animations-api.core.enabled=true
dom.animations-api.timelines.enabled=true
support-files = support-files =
animation_utils.js animation_utils.js
ccd-quirks.html ccd-quirks.html

View file

@ -2718,6 +2718,7 @@ pref("dom.animations-api.core.enabled", false);
#else #else
pref("dom.animations-api.core.enabled", true); pref("dom.animations-api.core.enabled", true);
#endif #endif
pref("dom.animations-api.timelines.enabled", false);
// Is support for the Element.animate() function (a subset of the Web Animations // Is support for the Element.animate() function (a subset of the Web Animations
// API) enabled? // API) enabled?