| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 /** | 6 /** |
| 7 * @constructor | 7 * @constructor |
| 8 * @extends {WebInspector.SDKModel} | 8 * @extends {WebInspector.SDKModel} |
| 9 * @param {!WebInspector.Target} target | 9 * @param {!WebInspector.Target} target |
| 10 */ | 10 */ |
| 11 WebInspector.AnimationModel = function(target) { | 11 WebInspector.AnimationModel = function(target) { |
| 12 WebInspector.SDKModel.call(this, WebInspector.AnimationModel, target); | 12 WebInspector.SDKModel.call(this, WebInspector.AnimationModel, target); |
| 13 | 13 |
| 14 this._agent = target.animationAgent(); | 14 this._agent = target.animationAgent(); |
| 15 } | 15 } |
| 16 | 16 |
| 17 WebInspector.AnimationModel.prototype = { | 17 WebInspector.AnimationModel.prototype = { |
| 18 /** | 18 /** |
| 19 * @param {!DOMAgent.NodeId} nodeId | 19 * @param {!DOMAgent.NodeId} nodeId |
| 20 * @param {boolean} showSubtreeAnimations |
| 20 * @param {function(?Array.<!WebInspector.AnimationModel.AnimationPlayer>)}
callback | 21 * @param {function(?Array.<!WebInspector.AnimationModel.AnimationPlayer>)}
callback |
| 21 */ | 22 */ |
| 22 animationPlayers: function(nodeId, callback) | 23 animationPlayers: function(nodeId, showSubtreeAnimations, callback) |
| 23 { | 24 { |
| 24 /** | 25 /** |
| 25 * @param {?Protocol.Error} error | 26 * @param {?Protocol.Error} error |
| 26 * @param {!Array.<!AnimationAgent.AnimationPlayer>} payloads | 27 * @param {!Array.<!AnimationAgent.AnimationPlayer>} payloads |
| 27 */ | 28 */ |
| 28 function mycallback(error, payloads) | 29 function mycallback(error, payloads) |
| 29 { | 30 { |
| 30 if (error) { | 31 if (error) { |
| 31 callback(null); | 32 callback(null); |
| 32 return; | 33 return; |
| 33 } | 34 } |
| 34 callback(payloads.map(function(payload) { | 35 callback(payloads.map(function(payload) { |
| 35 return new WebInspector.AnimationModel.AnimationPlayer(target, p
ayload); | 36 return new WebInspector.AnimationModel.AnimationPlayer(target, p
ayload); |
| 36 })); | 37 })); |
| 37 } | 38 } |
| 38 | 39 |
| 39 var target = this.target(); | 40 var target = this.target(); |
| 40 this._agent.getAnimationPlayersForNode(nodeId, mycallback); | 41 this._agent.getAnimationPlayersForNode(nodeId, showSubtreeAnimations, my
callback); |
| 41 }, | 42 }, |
| 42 | 43 |
| 43 __proto__: WebInspector.SDKModel.prototype | 44 __proto__: WebInspector.SDKModel.prototype |
| 44 } | 45 } |
| 45 | 46 |
| 46 /** | 47 /** |
| 47 * @constructor | 48 * @constructor |
| 48 * @extends {WebInspector.SDKObject} | 49 * @extends {WebInspector.SDKObject} |
| 49 * @param {!WebInspector.Target} target | 50 * @param {!WebInspector.Target} target |
| 50 * @param {!AnimationAgent.AnimationPlayer} payload | 51 * @param {!AnimationAgent.AnimationPlayer} payload |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 getCurrentState: function(callback) | 156 getCurrentState: function(callback) |
| 156 { | 157 { |
| 157 /** | 158 /** |
| 158 * @param {?Protocol.Error} error | 159 * @param {?Protocol.Error} error |
| 159 * @param {number} currentTime | 160 * @param {number} currentTime |
| 160 * @param {boolean} isRunning | 161 * @param {boolean} isRunning |
| 161 */ | 162 */ |
| 162 function mycallback(error, currentTime, isRunning) | 163 function mycallback(error, currentTime, isRunning) |
| 163 { | 164 { |
| 164 if (error) { | 165 if (error) { |
| 165 console.error(error); | |
| 166 return; | 166 return; |
| 167 } | 167 } |
| 168 callback(currentTime, isRunning); | 168 callback(currentTime, isRunning); |
| 169 } | 169 } |
| 170 this.target().animationModel._agent.getAnimationPlayerState(this.id(), m
ycallback); | 170 this.target().animationModel._agent.getAnimationPlayerState(this.id(), m
ycallback); |
| 171 }, | 171 }, |
| 172 | 172 |
| 173 __proto__: WebInspector.SDKObject.prototype | 173 __proto__: WebInspector.SDKObject.prototype |
| 174 } | 174 } |
| 175 | 175 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 | 254 |
| 255 /** | 255 /** |
| 256 * @return {string} | 256 * @return {string} |
| 257 */ | 257 */ |
| 258 name: function() | 258 name: function() |
| 259 { | 259 { |
| 260 return this._payload.name; | 260 return this._payload.name; |
| 261 }, | 261 }, |
| 262 | 262 |
| 263 /** | 263 /** |
| 264 * @return {?WebInspector.DOMNode} |
| 265 */ |
| 266 node: function() |
| 267 { |
| 268 return this.target().domModel.nodeForId(this._payload.node); |
| 269 }, |
| 270 |
| 271 /** |
| 264 * @return {?WebInspector.AnimationModel.KeyframesRule} | 272 * @return {?WebInspector.AnimationModel.KeyframesRule} |
| 265 */ | 273 */ |
| 266 keyframesRule: function() | 274 keyframesRule: function() |
| 267 { | 275 { |
| 268 return this._keyframesRule; | 276 return this._keyframesRule; |
| 269 }, | 277 }, |
| 270 | 278 |
| 271 __proto__: WebInspector.SDKObject.prototype | 279 __proto__: WebInspector.SDKObject.prototype |
| 272 } | 280 } |
| 273 | 281 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 /** | 349 /** |
| 342 * @return {!WebInspector.CSSStyleDeclaration} | 350 * @return {!WebInspector.CSSStyleDeclaration} |
| 343 */ | 351 */ |
| 344 style: function() | 352 style: function() |
| 345 { | 353 { |
| 346 return this._style; | 354 return this._style; |
| 347 }, | 355 }, |
| 348 | 356 |
| 349 __proto__: WebInspector.SDKObject.prototype | 357 __proto__: WebInspector.SDKObject.prototype |
| 350 } | 358 } |
| OLD | NEW |