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

Unified Diff: ui/views/controls/glow_hover_controller.cc

Issue 1710253003: Misc. Tab-related cleanup. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Better structure for #ifdefs Created 4 years, 10 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 | « ui/gfx/animation/multi_animation_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/glow_hover_controller.cc
diff --git a/ui/views/controls/glow_hover_controller.cc b/ui/views/controls/glow_hover_controller.cc
index 9a5fa0bc4ced050067e9d4104ef28b37238fb4db..806cbb1b48d254f7081d942ceacf5799f771e892 100644
--- a/ui/views/controls/glow_hover_controller.cc
+++ b/ui/views/controls/glow_hover_controller.cc
@@ -9,8 +9,8 @@
namespace views {
// Amount to scale the opacity.
-static const double kTrackOpacityScale = 0.25;
-static const double kHighlightOpacityScale = 1.0;
+static const double kSubtleOpacityScale = 0.25;
+static const double kPronouncedOpacityScale = 1.0;
// How long the hover state takes.
static const int kTrackHoverDurationMs = 400;
@@ -18,7 +18,7 @@ static const int kTrackHoverDurationMs = 400;
GlowHoverController::GlowHoverController(views::View* view)
: view_(view),
animation_(this),
- opacity_scale_(kTrackOpacityScale) {
+ opacity_scale_(kSubtleOpacityScale) {
animation_.set_delegate(this);
}
@@ -39,13 +39,13 @@ void GlowHoverController::SetLocation(const gfx::Point& location) {
void GlowHoverController::Show(Style style) {
switch (style) {
case SUBTLE:
- opacity_scale_ = kTrackOpacityScale;
+ opacity_scale_ = kSubtleOpacityScale;
animation_.SetSlideDuration(kTrackHoverDurationMs);
animation_.SetTweenType(gfx::Tween::EASE_OUT);
animation_.Show();
break;
case PRONOUNCED:
- opacity_scale_ = kHighlightOpacityScale;
+ opacity_scale_ = kPronouncedOpacityScale;
// Force the end state to show immediately.
animation_.Show();
animation_.End();
@@ -69,8 +69,8 @@ double GlowHoverController::GetAnimationValue() const {
}
SkAlpha GlowHoverController::GetAlpha() const {
- return static_cast<SkAlpha>(gfx::ToFlooredInt(
- 0.5 + animation_.CurrentValueBetween(0., 255 * opacity_scale_)));
+ return static_cast<SkAlpha>(animation_.CurrentValueBetween(
+ 0, gfx::ToRoundedInt(255 * opacity_scale_)));
}
bool GlowHoverController::ShouldDraw() const {
« no previous file with comments | « ui/gfx/animation/multi_animation_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698