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

Side by Side Diff: ui/compositor/layer_animation_element.cc

Issue 12313118: Refactor: Shelf Widget (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: formatting and moved a couple unit tests Created 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "ui/compositor/layer_animation_element.h" 5 #include "ui/compositor/layer_animation_element.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "cc/animation.h" 8 #include "cc/animation.h"
9 #include "cc/animation_id_provider.h" 9 #include "cc/animation_id_provider.h"
10 #include "ui/base/animation/tween.h" 10 #include "ui/base/animation/tween.h"
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 546
547 if (effective_start_time_ == base::TimeTicks()) { 547 if (effective_start_time_ == base::TimeTicks()) {
548 // This hasn't actually started yet. 548 // This hasn't actually started yet.
549 need_draw = false; 549 need_draw = false;
550 last_progressed_fraction_ = 0.0; 550 last_progressed_fraction_ = 0.0;
551 return need_draw; 551 return need_draw;
552 } 552 }
553 553
554 base::TimeDelta elapsed = now - effective_start_time_; 554 base::TimeDelta elapsed = now - effective_start_time_;
555 if ((duration_ > base::TimeDelta()) && (elapsed < duration_)) 555 if ((duration_ > base::TimeDelta()) && (elapsed < duration_))
556 t = elapsed.InMillisecondsF() / duration_.InMillisecondsF(); 556 t = std::max(0.0, elapsed.InMillisecondsF() / duration_.InMillisecondsF());
Harry McCleave 2013/02/27 04:05:38 This is temporary and vollick@ is landing a patch
557 need_draw = OnProgress(Tween::CalculateValue(tween_type_, t), delegate); 557 need_draw = OnProgress(Tween::CalculateValue(tween_type_, t), delegate);
558 first_frame_ = t == 1.0; 558 first_frame_ = t == 1.0;
559 last_progressed_fraction_ = t; 559 last_progressed_fraction_ = t;
560 return need_draw; 560 return need_draw;
561 } 561 }
562 562
563 bool LayerAnimationElement::IsFinished(base::TimeTicks time, 563 bool LayerAnimationElement::IsFinished(base::TimeTicks time,
564 base::TimeDelta* total_duration) { 564 base::TimeDelta* total_duration) {
565 // If an effective start has been requested but the effective start time 565 // If an effective start has been requested but the effective start time
566 // hasn't yet been set, the animation is not finished, regardless of the 566 // hasn't yet been set, the animation is not finished, regardless of the
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
693 } 693 }
694 694
695 // static 695 // static
696 LayerAnimationElement* LayerAnimationElement::CreateColorElement( 696 LayerAnimationElement* LayerAnimationElement::CreateColorElement(
697 SkColor color, 697 SkColor color,
698 base::TimeDelta duration) { 698 base::TimeDelta duration) {
699 return new ColorTransition(color, duration); 699 return new ColorTransition(color, duration);
700 } 700 }
701 701
702 } // namespace ui 702 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698