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

Unified Diff: chrome/browser/ui/views/toolbar/toolbar_button.cc

Issue 1373983002: Enhanced the InkDropRippleImpl to create/destroy InkDropAnimations as needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Based diff delta on dependant branch. Created 5 years, 2 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 | « no previous file | ui/views/animation/ink_drop_animation.h » ('j') | ui/views/animation/ink_drop_animation.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/toolbar/toolbar_button.cc
diff --git a/chrome/browser/ui/views/toolbar/toolbar_button.cc b/chrome/browser/ui/views/toolbar/toolbar_button.cc
index 4a2e41a626aa82ea2a7cadb3326536c1d9c40d9e..8b89616bbec088967006241dd4d700a4653a64c1 100644
--- a/chrome/browser/ui/views/toolbar/toolbar_button.cc
+++ b/chrome/browser/ui/views/toolbar/toolbar_button.cc
@@ -33,8 +33,19 @@ ToolbarButton::ToolbarButton(views::ButtonListener* listener,
menu_showing_(false),
y_position_on_lbuttondown_(0),
show_menu_factory_(this) {
+ // Sizes for the the ink drop.
+ const int kInkDropLargeSize = 32;
+ const int kInkDropLargeCornerRadius = 5;
+ const int kInkDropSmallSize = 24;
+ const int kInkDropSmallCornerRadius = 2;
+
ink_drop_animation_controller_ = views::InkDropAnimationControllerFactory::
CreateInkDropAnimationController(this);
+ ink_drop_animation_controller_->SetInkDropSize(
+ gfx::Size(kInkDropLargeSize, kInkDropLargeSize),
+ kInkDropLargeCornerRadius,
+ gfx::Size(kInkDropSmallSize, kInkDropSmallSize),
+ kInkDropSmallCornerRadius);
set_context_menu_controller(this);
}
@@ -78,18 +89,6 @@ gfx::Size ToolbarButton::GetPreferredSize() const {
void ToolbarButton::Layout() {
LabelButton::Layout();
-
- // Sizes for the the ink drop.
- const int kInkDropLargeSize = 32;
- const int kInkDropLargeCornerRadius = 5;
- const int kInkDropSmallSize = 24;
- const int kInkDropSmallCornerRadius = 2;
-
- ink_drop_animation_controller_->SetInkDropSize(
- gfx::Size(kInkDropLargeSize, kInkDropLargeSize),
- kInkDropLargeCornerRadius,
- gfx::Size(kInkDropSmallSize, kInkDropSmallSize),
- kInkDropSmallCornerRadius);
ink_drop_animation_controller_->SetInkDropCenter(CalculateInkDropCenter());
}
@@ -144,7 +143,8 @@ void ToolbarButton::OnMouseReleased(const ui::MouseEvent& event) {
if (IsTriggerableEvent(event))
show_menu_factory_.InvalidateWeakPtrs();
- ink_drop_animation_controller_->AnimateToState(views::InkDropState::HIDDEN);
+ if (!HitTestPoint(event.location()))
+ ink_drop_animation_controller_->AnimateToState(views::InkDropState::HIDDEN);
}
void ToolbarButton::OnMouseCaptureLost() {
« no previous file with comments | « no previous file | ui/views/animation/ink_drop_animation.h » ('j') | ui/views/animation/ink_drop_animation.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698