| 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 */ |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 style = style.replace(new RegExp("\\s*(-webkit-)?" + animationProper
ty + "-(delay|duration):[^;]*;?\\s*", "g"), ""); | 257 style = style.replace(new RegExp("\\s*(-webkit-)?" + animationProper
ty + "-(delay|duration):[^;]*;?\\s*", "g"), ""); |
| 258 node.setAttributeValue("style", String.sprintf("%s %s-delay: %sms !i
mportant; %s-duration: %sms !important;", style, animationProperty, Math.round(d
elay), animationProperty, Math.round(duration))); | 258 node.setAttributeValue("style", String.sprintf("%s %s-delay: %sms !i
mportant; %s-duration: %sms !important;", style, animationProperty, Math.round(d
elay), animationProperty, Math.round(duration))); |
| 259 } | 259 } |
| 260 | 260 |
| 261 this.target().animationAgent().setTiming(this.id(), duration, delay); | 261 this.target().animationAgent().setTiming(this.id(), duration, delay); |
| 262 // TODO (samli): Update CSS rules instead. (crbug.com/492937) | 262 // TODO (samli): Update CSS rules instead. (crbug.com/492937) |
| 263 if (this.type() !== "WebAnimation") | 263 if (this.type() !== "WebAnimation") |
| 264 this._source.deferredNode().resolve(nodeResolved.bind(this)); | 264 this._source.deferredNode().resolve(nodeResolved.bind(this)); |
| 265 }, | 265 }, |
| 266 | 266 |
| 267 /** |
| 268 * @param {string} value |
| 269 */ |
| 270 setEasing: function(value) |
| 271 { |
| 272 /** |
| 273 * @param {?WebInspector.DOMNode} node |
| 274 * @this {!WebInspector.AnimationModel.AnimationPlayer} |
| 275 */ |
| 276 function nodeResolved(node) |
| 277 { |
| 278 if (!node) |
| 279 return; |
| 280 var animationProperty = this.type() === "CSSTransition" ? "transitio
n" : "animation"; |
| 281 var style = node.getAttribute("style") || ""; |
| 282 style = style.replace(new RegExp("\\s*(-webkit-)?" + animationProper
ty + "-timing-function:[^;]*;?\\s*", "g"), ""); |
| 283 node.setAttributeValue("style", String.sprintf("%s %s-timing-functio
n: %s !important;", style, animationProperty, value)); |
| 284 } |
| 285 |
| 286 this.target().animationAgent().setEasing(this.id(), value); |
| 287 // TODO (samli): Update CSS rules instead. (crbug.com/492937) |
| 288 if (this.type() !== "WebAnimation") |
| 289 this._source.deferredNode().resolve(nodeResolved.bind(this)); |
| 290 }, |
| 291 |
| 267 __proto__: WebInspector.SDKObject.prototype | 292 __proto__: WebInspector.SDKObject.prototype |
| 268 } | 293 } |
| 269 | 294 |
| 270 /** | 295 /** |
| 271 * @constructor | 296 * @constructor |
| 272 * @extends {WebInspector.SDKObject} | 297 * @extends {WebInspector.SDKObject} |
| 273 * @param {!WebInspector.Target} target | 298 * @param {!WebInspector.Target} target |
| 274 * @param {!AnimationAgent.AnimationNode} payload | 299 * @param {!AnimationAgent.AnimationNode} payload |
| 275 */ | 300 */ |
| 276 WebInspector.AnimationModel.AnimationNode = function(target, payload) | 301 WebInspector.AnimationModel.AnimationNode = function(target, payload) |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 517 /** | 542 /** |
| 518 * @override | 543 * @override |
| 519 * @param {string} playerId | 544 * @param {string} playerId |
| 520 * @param {!AnimationAgent.AnimationNode} payload | 545 * @param {!AnimationAgent.AnimationNode} payload |
| 521 */ | 546 */ |
| 522 animationTimingUpdated: function(playerId, payload) | 547 animationTimingUpdated: function(playerId, payload) |
| 523 { | 548 { |
| 524 this._animationModel.animationTimingUpdated(playerId, payload); | 549 this._animationModel.animationTimingUpdated(playerId, payload); |
| 525 } | 550 } |
| 526 } | 551 } |
| OLD | NEW |