| 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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 * @extends {WebInspector.SDKObject} | 586 * @extends {WebInspector.SDKObject} |
| 587 * @param {!WebInspector.Target} target | 587 * @param {!WebInspector.Target} target |
| 588 * @param {string} id | 588 * @param {string} id |
| 589 * @param {!Array.<!WebInspector.AnimationModel.Animation>} animations | 589 * @param {!Array.<!WebInspector.AnimationModel.Animation>} animations |
| 590 */ | 590 */ |
| 591 WebInspector.AnimationModel.AnimationGroup = function(target, id, animations) | 591 WebInspector.AnimationModel.AnimationGroup = function(target, id, animations) |
| 592 { | 592 { |
| 593 WebInspector.SDKObject.call(this, target); | 593 WebInspector.SDKObject.call(this, target); |
| 594 this._id = id; | 594 this._id = id; |
| 595 this._animations = animations; | 595 this._animations = animations; |
| 596 this._paused = false; |
| 596 } | 597 } |
| 597 | 598 |
| 598 WebInspector.AnimationModel.AnimationGroup.prototype = { | 599 WebInspector.AnimationModel.AnimationGroup.prototype = { |
| 599 /** | 600 /** |
| 600 * @return {string} | 601 * @return {string} |
| 601 */ | 602 */ |
| 602 id: function() | 603 id: function() |
| 603 { | 604 { |
| 604 return this._id; | 605 return this._id; |
| 605 }, | 606 }, |
| 606 | 607 |
| 607 /** | 608 /** |
| 608 * @return {!Array.<!WebInspector.AnimationModel.Animation>} | 609 * @return {!Array.<!WebInspector.AnimationModel.Animation>} |
| 609 */ | 610 */ |
| 610 animations: function() | 611 animations: function() |
| 611 { | 612 { |
| 612 return this._animations; | 613 return this._animations; |
| 613 }, | 614 }, |
| 614 | 615 |
| 615 /** | 616 /** |
| 617 * @return {!Array.<string>} |
| 618 */ |
| 619 _animationIds: function() |
| 620 { |
| 621 /** |
| 622 * @param {!WebInspector.AnimationModel.Animation} animation |
| 623 * @return {string} |
| 624 */ |
| 625 function extractId(animation) |
| 626 { |
| 627 return animation.id(); |
| 628 } |
| 629 |
| 630 return this._animations.map(extractId); |
| 631 }, |
| 632 |
| 633 /** |
| 616 * @return {number} | 634 * @return {number} |
| 617 */ | 635 */ |
| 618 startTime: function() | 636 startTime: function() |
| 619 { | 637 { |
| 620 return this._animations[0].startTime(); | 638 return this._animations[0].startTime(); |
| 621 }, | 639 }, |
| 622 | 640 |
| 623 /** | 641 /** |
| 624 * @param {number} currentTime | 642 * @param {number} currentTime |
| 625 */ | 643 */ |
| 626 seekTo: function(currentTime) | 644 seekTo: function(currentTime) |
| 627 { | 645 { |
| 628 /** | 646 this.target().animationAgent().seekAnimations(this._animationIds(), curr
entTime); |
| 629 * @param {!WebInspector.AnimationModel.Animation} animation | |
| 630 * @return {string} | |
| 631 */ | |
| 632 function extractId(animation) | |
| 633 { | |
| 634 return animation.id(); | |
| 635 } | |
| 636 | |
| 637 this.target().animationAgent().seekAnimations(this._animations.map(extra
ctId), currentTime); | |
| 638 }, | 647 }, |
| 639 | 648 |
| 640 /** | 649 /** |
| 650 * @return {boolean} |
| 651 */ |
| 652 paused: function() |
| 653 { |
| 654 return this._paused; |
| 655 }, |
| 656 |
| 657 /** |
| 658 * @param {boolean} paused |
| 659 */ |
| 660 togglePause: function(paused) |
| 661 { |
| 662 this._paused = paused; |
| 663 this.target().animationAgent().setPaused(this._animationIds(), paused); |
| 664 }, |
| 665 |
| 666 /** |
| 641 * @return {!Promise.<number>} | 667 * @return {!Promise.<number>} |
| 642 */ | 668 */ |
| 643 currentTimePromise: function() | 669 currentTimePromise: function() |
| 644 { | 670 { |
| 645 /** | 671 /** |
| 646 * @param {?Protocol.Error} error | 672 * @param {?Protocol.Error} error |
| 647 * @param {number} currentTime | 673 * @param {number} currentTime |
| 648 * @return {number} | 674 * @return {number} |
| 649 */ | 675 */ |
| 650 function callback(error, currentTime) | 676 function callback(error, currentTime) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 | 740 |
| 715 /** | 741 /** |
| 716 * @override | 742 * @override |
| 717 * @param {!AnimationAgent.Animation} payload | 743 * @param {!AnimationAgent.Animation} payload |
| 718 */ | 744 */ |
| 719 animationStarted: function(payload) | 745 animationStarted: function(payload) |
| 720 { | 746 { |
| 721 this._animationModel.animationStarted(payload); | 747 this._animationModel.animationStarted(payload); |
| 722 } | 748 } |
| 723 } | 749 } |
| OLD | NEW |