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

Unified Diff: ui/views/animation/ink_drop_hover.cc

Issue 1724963002: Color the ink drop ripple and hover effects based on theming. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: sky review 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/views/animation/ink_drop_hover.h ('k') | ui/views/animation/ink_drop_hover_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/animation/ink_drop_hover.cc
diff --git a/ui/views/animation/ink_drop_hover.cc b/ui/views/animation/ink_drop_hover.cc
index 311ddaf4cf8a6d23cbff6dcdbd1f92842956db27..be440c95b9d4b701e1180204a265b6059c4b1b1c 100644
--- a/ui/views/animation/ink_drop_hover.cc
+++ b/ui/views/animation/ink_drop_hover.cc
@@ -16,20 +16,20 @@ namespace views {
namespace {
// The opacity of the hover when it is visible.
-const float kHoverVisibleOpacity = 0.08f;
+const float kHoverVisibleOpacity = 0.128f;
// The opacity of the hover when it is not visible.
const float kHiddenOpacity = 0.0f;
-// The hover color.
-const SkColor kHoverColor = SK_ColorBLACK;
-
} // namespace
-InkDropHover::InkDropHover(const gfx::Size& size, int corner_radius)
+InkDropHover::InkDropHover(const gfx::Size& size,
+ int corner_radius,
+ const gfx::Point& center_point,
+ SkColor color)
: last_animation_initiated_was_fade_in_(false),
layer_delegate_(
- new RoundedRectangleLayerDelegate(kHoverColor, size, corner_radius)),
+ new RoundedRectangleLayerDelegate(color, size, corner_radius)),
layer_(new ui::Layer()) {
layer_->SetBounds(gfx::Rect(size));
layer_->SetFillsBoundsOpaquely(false);
@@ -38,7 +38,11 @@ InkDropHover::InkDropHover(const gfx::Size& size, int corner_radius)
layer_->SetOpacity(kHoverVisibleOpacity);
layer_->SetMasksToBounds(false);
layer_->set_name("InkDropHover:layer");
- SetCenterPoint(gfx::Rect(size).CenterPoint());
+
+ gfx::Transform transform;
+ transform.Translate(center_point.x() - layer_->bounds().CenterPoint().x(),
+ center_point.y() - layer_->bounds().CenterPoint().y());
+ layer_->SetTransform(transform);
}
InkDropHover::~InkDropHover() {}
@@ -86,13 +90,6 @@ void InkDropHover::AnimateFade(HoverAnimationType animation_type,
animation_observer->SetActive();
}
-void InkDropHover::SetCenterPoint(const gfx::Point& center_point) {
- gfx::Transform transform;
- transform.Translate(center_point.x() - layer_->bounds().CenterPoint().x(),
- center_point.y() - layer_->bounds().CenterPoint().y());
- layer_->SetTransform(transform);
-}
-
bool InkDropHover::AnimationEndedCallback(
HoverAnimationType animation_type,
const ui::CallbackLayerAnimationObserver& observer) {
« no previous file with comments | « ui/views/animation/ink_drop_hover.h ('k') | ui/views/animation/ink_drop_hover_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698