Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(935)

Unified Diff: Source/devtools/front_end/sdk/AnimationModel.js

Issue 682423002: Devtools Animations: Show subtree animations for a given node (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Review changes Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/sdk/AnimationModel.js
diff --git a/Source/devtools/front_end/sdk/AnimationModel.js b/Source/devtools/front_end/sdk/AnimationModel.js
index 3f70c93f4e0186e714f1ebf8bf745d6c229b635a..6a1fa08b3887cea21df3bca23d969af5ae3bdc26 100644
--- a/Source/devtools/front_end/sdk/AnimationModel.js
+++ b/Source/devtools/front_end/sdk/AnimationModel.js
@@ -20,9 +20,10 @@ WebInspector.AnimationModel = function(target)
WebInspector.AnimationModel.prototype = {
/**
* @param {!DOMAgent.NodeId} nodeId
+ * @param {boolean} showSubtreeAnimations
* @param {function(?Array.<!WebInspector.AnimationModel.AnimationPlayer>)} userCallback
*/
- getAnimationPlayers: function(nodeId, userCallback)
+ animationPlayers: function(nodeId, showSubtreeAnimations, userCallback)
{
/**
* @param {?Protocol.Error} error
@@ -34,16 +35,14 @@ WebInspector.AnimationModel.prototype = {
var callbacks = this._nodeIdToCallbackData[nodeId];
delete this._nodeIdToCallbackData[nodeId];
if (error) {
- callbacks.forEach(function(callback) {
- callback(null);
- });
+ for (var i = 0; i < callbacks.length; i++)
+ callbacks[i](null);
return;
}
var animationPlayers = payloads.map(WebInspector.AnimationModel.AnimationPlayer.parsePayload.bind(null, target));
- callbacks.forEach(function(callback) {
- callback(animationPlayers);
- });
+ for (var i = 0; i < callbacks.length; i++)
+ callbacks[i](animationPlayers);
}
if (this._nodeIdToCallbackData[nodeId]) {
@@ -53,7 +52,7 @@ WebInspector.AnimationModel.prototype = {
var target = this.target();
this._nodeIdToCallbackData[nodeId] = [userCallback];
- this._agent.getAnimationPlayersForNode(nodeId, resultCallback.bind(this));
+ this._agent.getAnimationPlayersForNode(nodeId, showSubtreeAnimations, resultCallback.bind(this));
},
__proto__: WebInspector.SDKModel.prototype
@@ -196,7 +195,6 @@ WebInspector.AnimationModel.AnimationPlayer.prototype = {
function mycallback(error, currentTime, isRunning)
{
if (error) {
- console.error(error);
vsevik 2014/11/12 09:14:35 Why did you remove this? You should also remove br
samli 2014/11/13 01:12:44 When the selected node changes, the list of animat
return;
}
callback(currentTime, isRunning);
@@ -295,6 +293,28 @@ WebInspector.AnimationModel.AnimationNode.prototype = {
},
/**
+ * @param {function(?WebInspector.DOMNode)} callback
+ */
+ node: function(callback)
vsevik 2014/11/12 09:14:35 We usually use get prefix for asynchronous getters
samli 2014/11/13 01:12:44 Done.
+ {
+ /**
+ * @this {WebInspector.AnimationModel.AnimationNode}
+ * @param {?Array.<number>} nodeIds
+ */
+ function nodePushedCallback(nodeIds)
+ {
+ if (nodeIds)
+ this.nodeId = nodeIds[0];
+ callback(this.target().domModel.nodeForId(this.nodeId));
+ }
+
+ if (this.nodeId)
+ callback(this.target().domModel.nodeForId(this.nodeId));
+ else
+ this._target.domModel.pushNodesByBackendIdsToFrontend([this._payload.backendNodeId], nodePushedCallback.bind(this));
+ },
+
+ /**
* @return {?WebInspector.AnimationModel.KeyframesRule}
*/
keyframesRule: function()

Powered by Google App Engine
This is Rietveld 408576698