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

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

Issue 1417173002: Devtools Animations: Pause button based on groups not global (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
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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 * @extends {WebInspector.SDKObject} 595 * @extends {WebInspector.SDKObject}
596 * @param {!WebInspector.Target} target 596 * @param {!WebInspector.Target} target
597 * @param {string} id 597 * @param {string} id
598 * @param {!Array.<!WebInspector.AnimationModel.Animation>} animations 598 * @param {!Array.<!WebInspector.AnimationModel.Animation>} animations
599 */ 599 */
600 WebInspector.AnimationModel.AnimationGroup = function(target, id, animations) 600 WebInspector.AnimationModel.AnimationGroup = function(target, id, animations)
601 { 601 {
602 WebInspector.SDKObject.call(this, target); 602 WebInspector.SDKObject.call(this, target);
603 this._id = id; 603 this._id = id;
604 this._animations = animations; 604 this._animations = animations;
605 this._paused = false;
605 } 606 }
606 607
607 WebInspector.AnimationModel.AnimationGroup.prototype = { 608 WebInspector.AnimationModel.AnimationGroup.prototype = {
608 /** 609 /**
609 * @return {string} 610 * @return {string}
610 */ 611 */
611 id: function() 612 id: function()
612 { 613 {
613 return this._id; 614 return this._id;
614 }, 615 },
615 616
616 /** 617 /**
617 * @return {!Array.<!WebInspector.AnimationModel.Animation>} 618 * @return {!Array.<!WebInspector.AnimationModel.Animation>}
618 */ 619 */
619 animations: function() 620 animations: function()
620 { 621 {
621 return this._animations; 622 return this._animations;
622 }, 623 },
623 624
624 /** 625 /**
626 * @return {!Array.<string>}
627 */
628 _animationIds: function()
629 {
630 /**
631 * @param {!WebInspector.AnimationModel.Animation} animation
632 * @return {string}
633 */
634 function extractId(animation)
635 {
636 return animation.id();
637 }
638
639 return this._animations.map(extractId);
640 },
641
642 /**
625 * @return {number} 643 * @return {number}
626 */ 644 */
627 startTime: function() 645 startTime: function()
628 { 646 {
629 return this._animations[0].startTime(); 647 return this._animations[0].startTime();
630 }, 648 },
631 649
632 /** 650 /**
633 * @param {number} currentTime 651 * @param {number} currentTime
634 */ 652 */
635 seekTo: function(currentTime) 653 seekTo: function(currentTime)
636 { 654 {
637 /** 655 this.target().animationAgent().seekAnimations(this._animationIds(), curr entTime);
638 * @param {!WebInspector.AnimationModel.Animation} animation
639 * @return {string}
640 */
641 function extractId(animation)
642 {
643 return animation.id();
644 }
645
646 this.target().animationAgent().seekAnimations(this._animations.map(extra ctId), currentTime);
647 }, 656 },
648 657
649 /** 658 /**
659 * @return {boolean}
660 */
661 paused: function()
662 {
663 return this._paused;
664 },
665
666 /**
667 * @param {boolean} paused
668 */
669 togglePause: function(paused)
670 {
671 this._paused = paused;
672 this.target().animationAgent().setPaused(this._animationIds(), paused);
673 },
674
675 /**
650 * @return {!Promise.<number>} 676 * @return {!Promise.<number>}
651 */ 677 */
652 currentTimePromise: function() 678 currentTimePromise: function()
653 { 679 {
654 /** 680 /**
655 * @param {?Protocol.Error} error 681 * @param {?Protocol.Error} error
656 * @param {number} currentTime 682 * @param {number} currentTime
657 * @return {number} 683 * @return {number}
658 */ 684 */
659 function callback(error, currentTime) 685 function callback(error, currentTime)
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 752
727 /** 753 /**
728 * @override 754 * @override
729 * @param {!AnimationAgent.Animation} payload 755 * @param {!AnimationAgent.Animation} payload
730 */ 756 */
731 animationStarted: function(payload) 757 animationStarted: function(payload)
732 { 758 {
733 this._animationModel.animationStarted(payload); 759 this._animationModel.animationStarted(payload);
734 } 760 }
735 } 761 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698