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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/animation/AnimationModel.js

Issue 1422713012: Devtools Animations: Listen to all animation play state changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « third_party/WebKit/Source/core/inspector/InspectorInstrumentation.idl ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 24 matching lines...) Expand all
35 }, 35 },
36 36
37 /** 37 /**
38 * @param {string} id 38 * @param {string} id
39 */ 39 */
40 animationCreated: function(id) 40 animationCreated: function(id)
41 { 41 {
42 this._pendingAnimations.push(id); 42 this._pendingAnimations.push(id);
43 }, 43 },
44 44
45 /**
46 * @param {string} id
47 */
45 _animationCanceled: function(id) 48 _animationCanceled: function(id)
46 { 49 {
47 this._pendingAnimations.remove(id); 50 this._pendingAnimations.remove(id);
48 this._flushPendingAnimationsIfNeeded(); 51 this._flushPendingAnimationsIfNeeded();
49 }, 52 },
50 53
51 /** 54 /**
52 * @param {!AnimationAgent.Animation} payload 55 * @param {!AnimationAgent.Animation} payload
53 */ 56 */
54 animationStarted: function(payload) 57 animationStarted: function(payload)
55 { 58 {
56 var animation = WebInspector.AnimationModel.Animation.parsePayload(this. target(), payload); 59 var animation = WebInspector.AnimationModel.Animation.parsePayload(this. target(), payload);
60
57 // Ignore Web Animations custom effects & groups. 61 // Ignore Web Animations custom effects & groups.
58 if (animation.type() === "WebAnimation" && animation.source().keyframesR ule().keyframes().length === 0) 62 if (animation.type() === "WebAnimation" && animation.source().keyframesR ule().keyframes().length === 0) {
59 this._pendingAnimations.remove(animation.id()); 63 this._pendingAnimations.remove(animation.id());
60 else 64 } else {
61 this._animationsById.set(animation.id(), animation); 65 this._animationsById.set(animation.id(), animation);
66 if (this._pendingAnimations.indexOf(animation.id()) === -1)
67 this._pendingAnimations.push(animation.id());
68 }
69
62 this._flushPendingAnimationsIfNeeded(); 70 this._flushPendingAnimationsIfNeeded();
63 }, 71 },
64 72
65 _flushPendingAnimationsIfNeeded: function() 73 _flushPendingAnimationsIfNeeded: function()
66 { 74 {
67 for (var id of this._pendingAnimations) { 75 for (var id of this._pendingAnimations) {
68 if (!this._animationsById.get(id)) 76 if (!this._animationsById.get(id))
69 return; 77 return;
70 } 78 }
71 79
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 iterationStart: function() 430 iterationStart: function()
423 { 431 {
424 return this._payload.iterationStart; 432 return this._payload.iterationStart;
425 }, 433 },
426 434
427 /** 435 /**
428 * @return {number} 436 * @return {number}
429 */ 437 */
430 iterations: function() 438 iterations: function()
431 { 439 {
440 // Animations with zero duration, zero delays and infinite iterations ca n't be shown.
441 if (!this.delay() && !this.endDelay() && !this.duration())
442 return 0;
432 return this._payload.iterations || Infinity; 443 return this._payload.iterations || Infinity;
433 }, 444 },
434 445
435 /** 446 /**
436 * @return {number} 447 * @return {number}
437 */ 448 */
438 duration: function() 449 duration: function()
439 { 450 {
440 return this._duration; 451 return this._duration;
441 }, 452 },
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 785
775 /** 786 /**
776 * @override 787 * @override
777 * @param {!AnimationAgent.Animation} payload 788 * @param {!AnimationAgent.Animation} payload
778 */ 789 */
779 animationStarted: function(payload) 790 animationStarted: function(payload)
780 { 791 {
781 this._animationModel.animationStarted(payload); 792 this._animationModel.animationStarted(payload);
782 } 793 }
783 } 794 }
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/inspector/InspectorInstrumentation.idl ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698