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

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

Issue 2665073002: Allow ripple hover/press effects to be more easily sized by subclasses. (Closed)
Patch Set: Review comment, compile fix Created 3 years, 11 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_host_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/animation/ink_drop_host_view.cc
diff --git a/ui/views/animation/ink_drop_host_view.cc b/ui/views/animation/ink_drop_host_view.cc
index 22dd4f1fe7157e62a8736f725dc106e353564d93..4d56b362811719b2946030e148d45c7edd21af21 100644
--- a/ui/views/animation/ink_drop_host_view.cc
+++ b/ui/views/animation/ink_drop_host_view.cc
@@ -19,9 +19,6 @@
namespace views {
namespace {
-// Size used for the default SquareInkDropRipple.
-const int kInkDropSize = 24;
-
// The scale factor to compute the large size of the default
// SquareInkDropRipple.
const float kLargeInkDropScale = 1.333f;
@@ -32,8 +29,8 @@ const float kInkDropVisibleOpacity = 0.175f;
} // namespace
// static
-const int InkDropHostView::kInkDropSmallCornerRadius = 2;
-const int InkDropHostView::kInkDropLargeCornerRadius = 4;
+constexpr int InkDropHostView::kInkDropSmallCornerRadius;
+constexpr int InkDropHostView::kInkDropLargeCornerRadius;
// An EventHandler that is guaranteed to be invoked and is not prone to
// InkDropHostView descendents who do not call
@@ -167,23 +164,21 @@ std::unique_ptr<InkDropHighlight> InkDropHostView::CreateInkDropHighlight()
}
std::unique_ptr<InkDropRipple> InkDropHostView::CreateDefaultInkDropRipple(
- const gfx::Point& center_point) const {
- const gfx::Size small_size(kInkDropSize, kInkDropSize);
+ const gfx::Point& center_point,
+ const gfx::Size& size) const {
std::unique_ptr<InkDropRipple> ripple(new SquareInkDropRipple(
- CalculateLargeInkDropSize(small_size), kInkDropLargeCornerRadius,
- small_size, kInkDropSmallCornerRadius, center_point,
- GetInkDropBaseColor(), ink_drop_visible_opacity()));
+ CalculateLargeInkDropSize(size), kInkDropLargeCornerRadius, size,
+ kInkDropSmallCornerRadius, center_point, GetInkDropBaseColor(),
+ ink_drop_visible_opacity()));
return ripple;
}
std::unique_ptr<InkDropHighlight>
-InkDropHostView::CreateDefaultInkDropHighlight(
- const gfx::PointF& center_point) const {
- const gfx::Size small_size(kInkDropSize, kInkDropSize);
- std::unique_ptr<InkDropHighlight> highlight(
- new InkDropHighlight(small_size, kInkDropSmallCornerRadius, center_point,
- GetInkDropBaseColor()));
- highlight->set_explode_size(CalculateLargeInkDropSize(small_size));
+InkDropHostView::CreateDefaultInkDropHighlight(const gfx::PointF& center_point,
+ const gfx::Size& size) const {
+ std::unique_ptr<InkDropHighlight> highlight(new InkDropHighlight(
+ size, kInkDropSmallCornerRadius, center_point, GetInkDropBaseColor()));
+ highlight->set_explode_size(CalculateLargeInkDropSize(size));
return highlight;
}
« no previous file with comments | « ui/views/animation/ink_drop_host_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698