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

Unified Diff: ui/views/controls/button/custom_button.cc

Issue 1772183002: Resets hover state when ToolbarActionView is dragged (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 years, 9 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/controls/button/custom_button_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/button/custom_button.cc
diff --git a/ui/views/controls/button/custom_button.cc b/ui/views/controls/button/custom_button.cc
index c18a936c5f26ffe971b6635d482c31e40d126fae..cb36cb77c0f55e96f8a4929f8c8f90d6f9ec2c9e 100644
--- a/ui/views/controls/button/custom_button.cc
+++ b/ui/views/controls/button/custom_button.cc
@@ -5,6 +5,7 @@
#include "ui/views/controls/button/custom_button.h"
#include "ui/accessibility/ax_view_state.h"
+#include "ui/base/material_design/material_design_controller.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
#include "ui/events/keycodes/keyboard_codes.h"
@@ -185,8 +186,12 @@ void CustomButton::OnMouseReleased(const ui::MouseEvent& event) {
}
void CustomButton::OnMouseCaptureLost() {
- // Starting a drag results in a MouseCaptureLost, we need to ignore it.
- if (state_ != STATE_DISABLED && !InDrag())
+ // Starting a drag results in a MouseCaptureLost. Reset button state.
+ // TODO(varkha) While in drag only reset the state with Material Design.
+ // The same logic may applies everywhere so gather any feedback and update.
+ bool reset_button_state =
+ !InDrag() || ui::MaterialDesignController::IsModeMaterial();
+ if (state_ != STATE_DISABLED && reset_button_state)
SetState(STATE_NORMAL);
if (ink_drop_delegate_)
ink_drop_delegate_->OnAction(views::InkDropState::HIDDEN);
« no previous file with comments | « no previous file | ui/views/controls/button/custom_button_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698