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

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: 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
« no previous file with comments | « Source/devtools/front_end/elements/elementsPanel.css ('k') | Source/devtools/protocol.json » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..8523806cc7cf4314f76d1fa94b29eb0f1481cac6 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)
+ getAnimationPlayers: function(nodeId, showSubtreeAnimations, userCallback)
{
/**
* @param {?Protocol.Error} error
@@ -31,29 +32,14 @@ WebInspector.AnimationModel.prototype = {
*/
function resultCallback(error, payloads)
{
- var callbacks = this._nodeIdToCallbackData[nodeId];
- delete this._nodeIdToCallbackData[nodeId];
if (error) {
- callbacks.forEach(function(callback) {
- callback(null);
- });
+ userCallback(null);
return;
}
- var animationPlayers = payloads.map(WebInspector.AnimationModel.AnimationPlayer.parsePayload.bind(null, target));
-
- callbacks.forEach(function(callback) {
- callback(animationPlayers);
- });
- }
-
- if (this._nodeIdToCallbackData[nodeId]) {
- this._nodeIdToCallbackData[nodeId].push(userCallback);
- return;
+ userCallback(payloads.map(WebInspector.AnimationModel.AnimationPlayer.parsePayload.bind(null, this.target())));
}
- 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
@@ -195,10 +181,8 @@ WebInspector.AnimationModel.AnimationPlayer.prototype = {
*/
function mycallback(error, currentTime, isRunning)
{
- if (error) {
- console.error(error);
+ if (error)
return;
- }
callback(currentTime, isRunning);
}
this.target().animationModel._agent.getAnimationPlayerState(this.id(), mycallback);
@@ -295,6 +279,28 @@ WebInspector.AnimationModel.AnimationNode.prototype = {
},
/**
+ * @param {function(?WebInspector.DOMNode)} callback
+ */
+ getNode: function(callback)
+ {
+ /**
+ * @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()
« no previous file with comments | « Source/devtools/front_end/elements/elementsPanel.css ('k') | Source/devtools/protocol.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698