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

Unified Diff: app/multi_animation.cc

Issue 3041006: Tweaks the pinned background tab title change animation per Nicholas's (Closed)
Patch Set: Created 10 years, 5 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
« no previous file with comments | « app/multi_animation.h ('k') | app/multi_animation_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: app/multi_animation.cc
diff --git a/app/multi_animation.cc b/app/multi_animation.cc
index 703ed85d8076c9b5fb1ba9631ef60c130e11c771..14cd7f905585d71ed7ee8739744b396543a5328b 100644
--- a/app/multi_animation.cc
+++ b/app/multi_animation.cc
@@ -9,8 +9,10 @@ static const int kDefaultInterval = 20;
static int TotalTime(const MultiAnimation::Parts& parts) {
int time_ms = 0;
- for (size_t i = 0; i < parts.size(); ++i)
+ for (size_t i = 0; i < parts.size(); ++i) {
+ DCHECK(parts[i].end_time_ms - parts[i].start_time_ms >= parts[i].time_ms);
time_ms += parts[i].time_ms;
+ }
return time_ms;
}
@@ -30,8 +32,9 @@ void MultiAnimation::Step(base::TimeTicks time_now) {
int delta = static_cast<int>((time_now - start_time()).InMilliseconds() %
cycle_time_ms_);
const Part& part = GetPart(&delta, &current_part_index_);
- double percent = static_cast<double>(delta) /
- static_cast<double>(part.time_ms);
+ double percent = static_cast<double>(delta + part.start_time_ms) /
+ static_cast<double>(part.end_time_ms);
+ DCHECK(percent <= 1);
current_value_ = Tween::CalculateValue(part.type, percent);
if ((current_value_ != last_value || current_part_index_ != last_index) &&
« no previous file with comments | « app/multi_animation.h ('k') | app/multi_animation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698