mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-04 13:07:52 +00:00
Backed out changeset 25a5ae2711f3 (bug 1265718) for test failures in browser_animation_emitMutations.js
This commit is contained in:
parent
dec72f0621
commit
56436e5293
@ -19,7 +19,7 @@ var { Task } = require("devtools/shared/task");
|
||||
|
||||
loader.lazyRequireGetter(this, "promise");
|
||||
loader.lazyRequireGetter(this, "EventEmitter", "devtools/shared/event-emitter");
|
||||
loader.lazyRequireGetter(this, "AnimationsFront", "devtools/shared/fronts/animation", true);
|
||||
loader.lazyRequireGetter(this, "AnimationsFront", "devtools/server/actors/animation", true);
|
||||
|
||||
const { LocalizationHelper } = require("devtools/client/shared/l10n");
|
||||
|
||||
|
@ -31,7 +31,10 @@ const {Task} = require("devtools/shared/task");
|
||||
const protocol = require("devtools/shared/protocol");
|
||||
const {ActorClass, Actor, FrontClass, Front,
|
||||
Arg, method, RetVal, types} = protocol;
|
||||
const {animationPlayerSpec, animationsSpec} = require("devtools/shared/specs/animation");
|
||||
// Make sure the nodeActor type is know here.
|
||||
const {NodeActor} = require("devtools/server/actors/inspector");
|
||||
const {AnimationPlayerFront} = require("devtools/shared/fronts/animation");
|
||||
const {animationPlayerSpec} = require("devtools/shared/specs/animation");
|
||||
const events = require("sdk/event/core");
|
||||
|
||||
// Types of animations.
|
||||
@ -431,11 +434,31 @@ var AnimationPlayerActor = protocol.ActorClassWithSpec(animationPlayerSpec, {
|
||||
|
||||
exports.AnimationPlayerActor = AnimationPlayerActor;
|
||||
|
||||
/**
|
||||
* Sent with the 'mutations' event as part of an array of changes, used to
|
||||
* inform fronts of the type of change that occured.
|
||||
*/
|
||||
types.addDictType("animationMutationChange", {
|
||||
// The type of change ("added" or "removed").
|
||||
type: "string",
|
||||
// The changed AnimationPlayerActor.
|
||||
player: "animationplayer"
|
||||
});
|
||||
|
||||
/**
|
||||
* The Animations actor lists animation players for a given node.
|
||||
*/
|
||||
var AnimationsActor = exports.AnimationsActor = protocol.ActorClassWithSpec(animationsSpec, {
|
||||
initialize: function(conn, tabActor) {
|
||||
var AnimationsActor = exports.AnimationsActor = ActorClass({
|
||||
typeName: "animations",
|
||||
|
||||
events: {
|
||||
"mutations": {
|
||||
type: "mutations",
|
||||
changes: Arg(0, "array:animationMutationChange")
|
||||
}
|
||||
},
|
||||
|
||||
initialize: function (conn, tabActor) {
|
||||
Actor.prototype.initialize.call(this, conn);
|
||||
this.tabActor = tabActor;
|
||||
|
||||
@ -473,9 +496,14 @@ var AnimationsActor = exports.AnimationsActor = protocol.ActorClassWithSpec(anim
|
||||
* to the server to get a NodeActor for a particular animation.
|
||||
* @param {WalkerActor} walker
|
||||
*/
|
||||
setWalkerActor: function (walker) {
|
||||
setWalkerActor: method(function (walker) {
|
||||
this.walker = walker;
|
||||
},
|
||||
}, {
|
||||
request: {
|
||||
walker: Arg(0, "domwalker")
|
||||
},
|
||||
response: {}
|
||||
}),
|
||||
|
||||
/**
|
||||
* Retrieve the list of AnimationPlayerActor actors for currently running
|
||||
@ -487,7 +515,7 @@ var AnimationsActor = exports.AnimationsActor = protocol.ActorClassWithSpec(anim
|
||||
* @param {NodeActor} nodeActor The NodeActor as defined in
|
||||
* /devtools/server/actors/inspector
|
||||
*/
|
||||
getAnimationPlayersForNode: function (nodeActor) {
|
||||
getAnimationPlayersForNode: method(function (nodeActor) {
|
||||
let animations = nodeActor.rawNode.getAnimations({subtree: true});
|
||||
|
||||
// Destroy previously stored actors
|
||||
@ -514,7 +542,14 @@ var AnimationsActor = exports.AnimationsActor = protocol.ActorClassWithSpec(anim
|
||||
});
|
||||
|
||||
return this.actors;
|
||||
},
|
||||
}, {
|
||||
request: {
|
||||
actorID: Arg(0, "domnode")
|
||||
},
|
||||
response: {
|
||||
players: RetVal("array:animationplayer")
|
||||
}
|
||||
}),
|
||||
|
||||
onAnimationMutation: function (mutations) {
|
||||
let eventData = [];
|
||||
@ -594,11 +629,14 @@ var AnimationsActor = exports.AnimationsActor = protocol.ActorClassWithSpec(anim
|
||||
* node, the actor starts sending animation mutations for this node. If the
|
||||
* client doesn't want this to happen anymore, it should call this method.
|
||||
*/
|
||||
stopAnimationPlayerUpdates: function () {
|
||||
stopAnimationPlayerUpdates: method(function () {
|
||||
if (this.observer && !Cu.isDeadWrapper(this.observer)) {
|
||||
this.observer.disconnect();
|
||||
}
|
||||
},
|
||||
}, {
|
||||
request: {},
|
||||
response: {}
|
||||
}),
|
||||
|
||||
/**
|
||||
* Iterates through all nodes below a given rootNode (optionally also in
|
||||
@ -636,7 +674,7 @@ var AnimationsActor = exports.AnimationsActor = protocol.ActorClassWithSpec(anim
|
||||
/**
|
||||
* Pause all animations in the current tabActor's frames.
|
||||
*/
|
||||
pauseAll: function () {
|
||||
pauseAll: method(function () {
|
||||
let readyPromises = [];
|
||||
// Until the WebAnimations API provides a way to play/pause via the document
|
||||
// timeline, we have to iterate through the whole DOM to find all players.
|
||||
@ -647,13 +685,16 @@ var AnimationsActor = exports.AnimationsActor = protocol.ActorClassWithSpec(anim
|
||||
}
|
||||
this.allAnimationsPaused = true;
|
||||
return promise.all(readyPromises);
|
||||
},
|
||||
}, {
|
||||
request: {},
|
||||
response: {}
|
||||
}),
|
||||
|
||||
/**
|
||||
* Play all animations in the current tabActor's frames.
|
||||
* This method only returns when animations have left their pending states.
|
||||
*/
|
||||
playAll: function () {
|
||||
playAll: method(function () {
|
||||
let readyPromises = [];
|
||||
// Until the WebAnimations API provides a way to play/pause via the document
|
||||
// timeline, we have to iterate through the whole DOM to find all players.
|
||||
@ -664,14 +705,20 @@ var AnimationsActor = exports.AnimationsActor = protocol.ActorClassWithSpec(anim
|
||||
}
|
||||
this.allAnimationsPaused = false;
|
||||
return promise.all(readyPromises);
|
||||
},
|
||||
}, {
|
||||
request: {},
|
||||
response: {}
|
||||
}),
|
||||
|
||||
toggleAll: function () {
|
||||
toggleAll: method(function () {
|
||||
if (this.allAnimationsPaused) {
|
||||
return this.playAll();
|
||||
}
|
||||
return this.pauseAll();
|
||||
},
|
||||
}, {
|
||||
request: {},
|
||||
response: {}
|
||||
}),
|
||||
|
||||
/**
|
||||
* Toggle (play/pause) several animations at the same time.
|
||||
@ -679,11 +726,17 @@ var AnimationsActor = exports.AnimationsActor = protocol.ActorClassWithSpec(anim
|
||||
* @param {Boolean} shouldPause If set to true, the players will be paused,
|
||||
* otherwise they will be played.
|
||||
*/
|
||||
toggleSeveral: function (players, shouldPause) {
|
||||
toggleSeveral: method(function (players, shouldPause) {
|
||||
return promise.all(players.map(player => {
|
||||
return shouldPause ? player.pause() : player.play();
|
||||
}));
|
||||
},
|
||||
}, {
|
||||
request: {
|
||||
players: Arg(0, "array:animationplayer"),
|
||||
shouldPause: Arg(1, "boolean")
|
||||
},
|
||||
response: {}
|
||||
}),
|
||||
|
||||
/**
|
||||
* Set the current time of several animations at the same time.
|
||||
@ -691,21 +744,45 @@ var AnimationsActor = exports.AnimationsActor = protocol.ActorClassWithSpec(anim
|
||||
* @param {Number} time The new currentTime.
|
||||
* @param {Boolean} shouldPause Should the players be paused too.
|
||||
*/
|
||||
setCurrentTimes: function (players, time, shouldPause) {
|
||||
setCurrentTimes: method(function (players, time, shouldPause) {
|
||||
return promise.all(players.map(player => {
|
||||
let pause = shouldPause ? player.pause() : promise.resolve();
|
||||
return pause.then(() => player.setCurrentTime(time));
|
||||
}));
|
||||
},
|
||||
}, {
|
||||
request: {
|
||||
players: Arg(0, "array:animationplayer"),
|
||||
time: Arg(1, "number"),
|
||||
shouldPause: Arg(2, "boolean")
|
||||
},
|
||||
response: {}
|
||||
}),
|
||||
|
||||
/**
|
||||
* Set the playback rate of several animations at the same time.
|
||||
* @param {Array} players A list of AnimationPlayerActor.
|
||||
* @param {Number} rate The new rate.
|
||||
*/
|
||||
setPlaybackRates: function (players, rate) {
|
||||
setPlaybackRates: method(function (players, rate) {
|
||||
for (let player of players) {
|
||||
player.setPlaybackRate(rate);
|
||||
}
|
||||
}, {
|
||||
request: {
|
||||
players: Arg(0, "array:animationplayer"),
|
||||
rate: Arg(1, "number")
|
||||
},
|
||||
response: {}
|
||||
})
|
||||
});
|
||||
|
||||
var AnimationsFront = exports.AnimationsFront = FrontClass(AnimationsActor, {
|
||||
initialize: function (client, {animationsActor}) {
|
||||
Front.prototype.initialize.call(this, client, {actor: animationsActor});
|
||||
this.manage(this);
|
||||
},
|
||||
|
||||
destroy: function () {
|
||||
Front.prototype.destroy.call(this);
|
||||
}
|
||||
});
|
||||
|
@ -9,10 +9,7 @@ const {
|
||||
custom,
|
||||
preEvent
|
||||
} = require("devtools/shared/protocol");
|
||||
const {
|
||||
animationPlayerSpec,
|
||||
animationsSpec
|
||||
} = require("devtools/shared/specs/animation");
|
||||
const { animationPlayerSpec } = require("devtools/shared/specs/animation");
|
||||
const { Task } = require("devtools/shared/task");
|
||||
|
||||
const AnimationPlayerFront = FrontClassWithSpec(animationPlayerSpec, {
|
||||
@ -122,16 +119,3 @@ const AnimationPlayerFront = FrontClassWithSpec(animationPlayerSpec, {
|
||||
});
|
||||
|
||||
exports.AnimationPlayerFront = AnimationPlayerFront;
|
||||
|
||||
const AnimationsFront = FrontClassWithSpec(animationsSpec, {
|
||||
initialize: function (client, {animationsActor}) {
|
||||
Front.prototype.initialize.call(this, client, {actor: animationsActor});
|
||||
this.manage(this);
|
||||
},
|
||||
|
||||
destroy: function () {
|
||||
Front.prototype.destroy.call(this);
|
||||
}
|
||||
});
|
||||
|
||||
exports.AnimationsFront = AnimationsFront;
|
||||
|
@ -3,24 +3,7 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
Arg,
|
||||
RetVal,
|
||||
generateActorSpec,
|
||||
types
|
||||
} = require("devtools/shared/protocol");
|
||||
require("devtools/shared/specs/inspector");
|
||||
|
||||
/**
|
||||
* Sent with the 'mutations' event as part of an array of changes, used to
|
||||
* inform fronts of the type of change that occured.
|
||||
*/
|
||||
types.addDictType("animationMutationChange", {
|
||||
// The type of change ("added" or "removed").
|
||||
type: "string",
|
||||
// The changed AnimationPlayerActor.
|
||||
player: "animationplayer"
|
||||
});
|
||||
const { Arg, RetVal, generateActorSpec } = require("devtools/shared/protocol");
|
||||
|
||||
const animationPlayerSpec = generateActorSpec({
|
||||
typeName: "animationplayer",
|
||||
@ -80,72 +63,3 @@ const animationPlayerSpec = generateActorSpec({
|
||||
});
|
||||
|
||||
exports.animationPlayerSpec = animationPlayerSpec;
|
||||
|
||||
const animationsSpec = generateActorSpec({
|
||||
typeName: "animations",
|
||||
|
||||
events: {
|
||||
"mutations": {
|
||||
type: "mutations",
|
||||
changes: Arg(0, "array:animationMutationChange")
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
setWalkerActor: {
|
||||
request: {
|
||||
walker: Arg(0, "domwalker")
|
||||
},
|
||||
response: {}
|
||||
},
|
||||
getAnimationPlayersForNode: {
|
||||
request: {
|
||||
actorID: Arg(0, "domnode")
|
||||
},
|
||||
response: {
|
||||
players: RetVal("array:animationplayer")
|
||||
}
|
||||
},
|
||||
stopAnimationPlayerUpdates: {
|
||||
request: {},
|
||||
response: {}
|
||||
},
|
||||
pauseAll: {
|
||||
request: {},
|
||||
response: {}
|
||||
},
|
||||
playAll: {
|
||||
request: {},
|
||||
response: {}
|
||||
},
|
||||
toggleAll: {
|
||||
request: {},
|
||||
response: {}
|
||||
},
|
||||
toggleSeveral: {
|
||||
request: {
|
||||
players: Arg(0, "array:animationplayer"),
|
||||
shouldPause: Arg(1, "boolean")
|
||||
},
|
||||
response: {}
|
||||
},
|
||||
setCurrentTimes: {
|
||||
request: {
|
||||
players: Arg(0, "array:animationplayer"),
|
||||
time: Arg(1, "number"),
|
||||
shouldPause: Arg(2, "boolean")
|
||||
},
|
||||
response: {}
|
||||
},
|
||||
setPlaybackRates: {
|
||||
request: {
|
||||
players: Arg(0, "array:animationplayer"),
|
||||
rate: Arg(1, "number")
|
||||
},
|
||||
response: {}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
exports.animationsSpec = animationsSpec;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user