Chromium Code Reviews| 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..aaf65ffd93fe79dd3c7f2ede9164377010322a1d 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; |
|
Peter Kasting
2015/10/05 21:01:54
Is there some way to calculate these sizes based o
bruthig
2015/10/06 15:31:38
The sizes were given by the designers. I don't th
|
| + |
| 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,10 @@ 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); |
| + return; |
|
Peter Kasting
2015/10/05 21:01:54
Why this return statement?
bruthig
2015/10/06 15:31:38
Removed.
|
| + } |
| } |
| void ToolbarButton::OnMouseCaptureLost() { |