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

Unified Diff: ui/views/animation/square_ink_drop_animation.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
Index: ui/views/animation/square_ink_drop_animation.cc
diff --git a/ui/views/animation/square_ink_drop_animation.cc b/ui/views/animation/square_ink_drop_animation.cc
index 3b1a41e03f145dd27492d5ac4fb6cf06abbcfeae..ea603a105d21f123c108db4e07bdc98d8b8777a2 100644
--- a/ui/views/animation/square_ink_drop_animation.cc
+++ b/ui/views/animation/square_ink_drop_animation.cc
@@ -32,9 +32,6 @@ const float kMinimumRectScale = 0.0001f;
// were causing visual anomalies.
const float kMinimumCircleScale = 0.001f;
-// The ink drop color.
-const SkColor kInkDropColor = SK_ColorBLACK;
-
// All the sub animations that are used to animate each of the InkDropStates.
// These are used to get time durations with
// GetAnimationDuration(InkDropSubAnimations). Note that in general a sub
@@ -180,16 +177,17 @@ namespace views {
SquareInkDropAnimation::SquareInkDropAnimation(const gfx::Size& large_size,
int large_corner_radius,
const gfx::Size& small_size,
- int small_corner_radius)
+ int small_corner_radius,
+ const gfx::Point& center_point,
+ SkColor color)
: large_size_(large_size),
large_corner_radius_(large_corner_radius),
small_size_(small_size),
small_corner_radius_(small_corner_radius),
circle_layer_delegate_(new CircleLayerDelegate(
- kInkDropColor,
+ color,
std::min(large_size_.width(), large_size_.height()) / 2)),
- rect_layer_delegate_(
- new RectangleLayerDelegate(kInkDropColor, large_size_)),
+ rect_layer_delegate_(new RectangleLayerDelegate(color, large_size_)),
root_layer_(ui::LAYER_NOT_DRAWN),
ink_drop_state_(InkDropState::HIDDEN) {
root_layer_.set_name("SquareInkDropAnimation:ROOT_LAYER");
@@ -200,6 +198,10 @@ SquareInkDropAnimation::SquareInkDropAnimation(const gfx::Size& large_size,
root_layer_.SetMasksToBounds(false);
root_layer_.SetBounds(gfx::Rect(large_size_));
+ gfx::Transform transform;
+ transform.Translate(center_point.x(), center_point.y());
+ root_layer_.SetTransform(transform);
+
SetStateToHidden();
}
@@ -257,12 +259,8 @@ void SquareInkDropAnimation::AnimateToState(InkDropState ink_drop_state) {
AnimateStateChange(old_ink_drop_state, ink_drop_state_, animation_observer);
animation_observer->SetActive();
-}
-
-void SquareInkDropAnimation::SetCenterPoint(const gfx::Point& center_point) {
- gfx::Transform transform;
- transform.Translate(center_point.x(), center_point.y());
- root_layer_.SetTransform(transform);
+ // |this| may be deleted! |animation_observer| might synchronously call
+ // AnimationEndedCallback which can delete |this|.
}
void SquareInkDropAnimation::HideImmediately() {
« no previous file with comments | « ui/views/animation/square_ink_drop_animation.h ('k') | ui/views/animation/square_ink_drop_animation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698