summaryrefslogtreecommitdiffstats
path: root/ui/gfx
diff options
context:
space:
mode:
authorpkasting <pkasting@chromium.org>2016-02-24 05:39:14 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-24 13:40:11 +0000
commit158f43592244183d9f8e2666b27e3637fa1dfc21 (patch)
treec50f65ae64a73cb0f131a2186cd03dd141930367 /ui/gfx
parent0dbdea3721f4035a7945b59ca949acaaa1b48466 (diff)
downloadchromium_src-158f43592244183d9f8e2666b27e3637fa1dfc21.zip
chromium_src-158f43592244183d9f8e2666b27e3637fa1dfc21.tar.gz
chromium_src-158f43592244183d9f8e2666b27e3637fa1dfc21.tar.bz2
Misc. Tab-related cleanup.
* Pass in the AnimationContainer directly instead of having a setter, since the only place that ever sets this does it immediately on creation. This allows Tab to not have to worry about if the animation container changes or disappears over time. * Comment fix * Create animations unconditionally in constructor instead of dynamically as needed. Animations aren't that big or expensive to create, and doing this avoids the need to remember to null-check everywhere in the code. * Inline some constants right above the sole block where they're used * Add 4-arg constructor for MultiAnimation::Parts and use constructor delegation to minimize the duplicated code footprint * Reorder a conditional to remove nesting * When converting from double to int, round instead of truncating; use ToRoundedInt() as much as possible * Make boolean expression somewhat less confusing * Rename some constants to more closely match their use * Better structure for #ifdefs in TabStrip::GetInactiveAlpha() BUG=none TEST=none Review URL: https://codereview.chromium.org/1710253003 Cr-Commit-Position: refs/heads/master@{#377281}
Diffstat (limited to 'ui/gfx')
-rw-r--r--ui/gfx/animation/multi_animation.h9
-rw-r--r--ui/gfx/animation/multi_animation_unittest.cc4
2 files changed, 6 insertions, 7 deletions
diff --git a/ui/gfx/animation/multi_animation.h b/ui/gfx/animation/multi_animation.h
index fd28e38..a746569 100644
--- a/ui/gfx/animation/multi_animation.h
+++ b/ui/gfx/animation/multi_animation.h
@@ -33,11 +33,12 @@ class GFX_EXPORT MultiAnimation : public Animation {
// for 200ms with a % between .25 and .75 use the following three values: 200,
// 100, 400.
struct Part {
- Part() : time_ms(0), start_time_ms(0), end_time_ms(0), type(Tween::ZERO) {}
- Part(int time_ms, Tween::Type type)
+ Part() : Part(0, Tween::ZERO) {}
+ Part(int time_ms, Tween::Type type) : Part(time_ms, 0, time_ms, type) {}
+ Part(int time_ms, int start_time_ms, int end_time_ms, Tween::Type type)
: time_ms(time_ms),
- start_time_ms(0),
- end_time_ms(time_ms),
+ start_time_ms(start_time_ms),
+ end_time_ms(end_time_ms),
type(type) {}
int time_ms;
diff --git a/ui/gfx/animation/multi_animation_unittest.cc b/ui/gfx/animation/multi_animation_unittest.cc
index b8a11fd..f8bff9a 100644
--- a/ui/gfx/animation/multi_animation_unittest.cc
+++ b/ui/gfx/animation/multi_animation_unittest.cc
@@ -40,9 +40,7 @@ TEST(MultiAnimationTest, Basic) {
TEST(MultiAnimationTest, DifferingStartAndEnd) {
// Create a MultiAnimation with two parts.
MultiAnimation::Parts parts;
- parts.push_back(MultiAnimation::Part(200, Tween::LINEAR));
- parts[0].start_time_ms = 100;
- parts[0].end_time_ms = 400;
+ parts.push_back(MultiAnimation::Part(200, 100, 400, Tween::LINEAR));
MultiAnimation animation(parts, MultiAnimation::GetDefaultTimerInterval());
AnimationContainerElement* as_element =