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

Unified Diff: tracing/tracing/ui/base/animation_controller.html

Issue 2776653002: [ESLint] Fix violations when enabling curly rule in eslint. (Closed)
Patch Set: rebase Created 3 years, 9 months 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 side-by-side diff with in-line comments
Download patch
Index: tracing/tracing/ui/base/animation_controller.html
diff --git a/tracing/tracing/ui/base/animation_controller.html b/tracing/tracing/ui/base/animation_controller.html
index 044a577cf575bfb26443994bda0b1fa7b8a511d2..58ef6610973c67bceb78ced7cabb6c8aaaf9a87a 100644
--- a/tracing/tracing/ui/base/animation_controller.html
+++ b/tracing/tracing/ui/base/animation_controller.html
@@ -39,11 +39,13 @@ tr.exportTo('tr.ui.b', function() {
},
set target(target) {
- if (this.activeAnimation_)
+ if (this.activeAnimation_) {
throw new Error('Cannot change target while animation is running.');
+ }
if (target.cloneAnimationState === undefined ||
- typeof target.cloneAnimationState !== 'function')
+ typeof target.cloneAnimationState !== 'function') {
throw new Error('target must have a cloneAnimationState function');
+ }
this.target_ = target;
},
@@ -57,22 +59,25 @@ tr.exportTo('tr.ui.b', function() {
},
queueAnimation: function(animation, opt_now) {
- if (this.target_ === undefined)
+ if (this.target_ === undefined) {
throw new Error('Cannot queue animations without a target');
+ }
var now;
- if (opt_now !== undefined)
+ if (opt_now !== undefined) {
now = opt_now;
- else
+ } else {
now = window.performance.now();
+ }
if (this.activeAnimation_) {
// Must tick the animation before stopping it case its about to stop,
// and to update the target with its final sets of edits up to this
// point.
var done = this.activeAnimation_.tick(now, this.target_);
- if (done)
+ if (done) {
this.activeAnimation_ = undefined;
+ }
}
if (this.activeAnimation_) {
@@ -86,28 +91,26 @@ tr.exportTo('tr.ui.b', function() {
this.activeAnimation_ = animation;
this.activeAnimation_.start(now, this.target_);
- if (this.tickScheduled_)
- return;
+ if (this.tickScheduled_) return;
this.tickScheduled_ = true;
tr.b.requestAnimationFrame(this.tickActiveAnimation_, this);
},
cancelActiveAnimation: function(opt_now) {
- if (!this.activeAnimation_)
- return;
+ if (!this.activeAnimation_) return;
var now;
- if (opt_now !== undefined)
+ if (opt_now !== undefined) {
now = opt_now;
- else
+ } else {
now = window.performance.now();
+ }
this.activeAnimation_.didStopEarly(now, this.target_, false);
this.activeAnimation_ = undefined;
},
tickActiveAnimation_: function(frameBeginTime) {
this.tickScheduled_ = false;
- if (!this.activeAnimation_)
- return;
+ if (!this.activeAnimation_) return;
if (this.target_ === undefined) {
this.activeAnimation_.didStopEarly(frameBeginTime, this.target_, false);
@@ -117,8 +120,9 @@ tr.exportTo('tr.ui.b', function() {
var oldTargetState = this.target_.cloneAnimationState();
var done = this.activeAnimation_.tick(frameBeginTime, this.target_);
- if (done)
+ if (done) {
this.activeAnimation_ = undefined;
+ }
if (this.activeAnimation_) {
this.tickScheduled_ = true;
« no previous file with comments | « tracing/tracing/ui/annotations/comment_box_annotation_view.html ('k') | tracing/tracing/ui/base/bar_chart_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698