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

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

Issue 1890243002: Expand the Material Design hover as it fades out when a ripple is triggered. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed ink_drop_hover_unittest.cc compile error. Created 4 years, 8 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/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 1070f031d2156ecc6666a8961209e5c770fdd79d..b02cd98ba9fbed88353393da1cc4363fb0431df9 100644
--- a/ui/views/animation/ink_drop_host_view.cc
+++ b/ui/views/animation/ink_drop_host_view.cc
@@ -5,11 +5,20 @@
#include "ui/views/animation/ink_drop_host_view.h"
#include "ui/gfx/color_palette.h"
+#include "ui/gfx/geometry/size_conversions.h"
#include "ui/views/animation/ink_drop_hover.h"
#include "ui/views/animation/square_ink_drop_animation.h"
namespace views {
+namespace {
+
+gfx::Size CalculateLargeInkDropSize(const gfx::Size small_size) {
+ return gfx::Size(small_size.width() * 4 / 3, small_size.height() * 4 / 3);
varkha 2016/04/21 16:16:49 nit: There's a ScaleToCeiledSize helper that you m
bruthig 2016/04/21 21:14:04 Done.
+}
+
+} // namespace
+
// Default sizes for ink drop effects.
const int kInkDropSize = 24;
const int kInkDropLargeCornerRadius = 4;
@@ -36,12 +45,10 @@ void InkDropHostView::RemoveInkDropLayer(ui::Layer* ink_drop_layer) {
std::unique_ptr<InkDropAnimation> InkDropHostView::CreateInkDropAnimation()
const {
- gfx::Size large_drop(ink_drop_size_.width() * 4 / 3,
- ink_drop_size_.height() * 4 / 3);
-
std::unique_ptr<InkDropAnimation> animation(new SquareInkDropAnimation(
- large_drop, kInkDropLargeCornerRadius, ink_drop_size_,
- kInkDropSmallCornerRadius, GetInkDropCenter(), GetInkDropBaseColor()));
+ CalculateLargeInkDropSize(ink_drop_size_), kInkDropLargeCornerRadius,
+ ink_drop_size_, kInkDropSmallCornerRadius, GetInkDropCenter(),
+ GetInkDropBaseColor()));
return animation;
}
@@ -49,6 +56,8 @@ std::unique_ptr<InkDropHover> InkDropHostView::CreateInkDropHover() const {
std::unique_ptr<InkDropHover> hover(
new InkDropHover(ink_drop_size_, kInkDropSmallCornerRadius,
GetInkDropCenter(), GetInkDropBaseColor()));
+ hover->set_explode_size(
+ gfx::SizeF(CalculateLargeInkDropSize(ink_drop_size_)));
return hover;
}

Powered by Google App Engine
This is Rietveld 408576698