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

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

Issue 2017833003: Fixes ink drop being "stuck" on when losing focus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed code intended for another bug fix. Created 4 years, 7 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 | no next file » | 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 7664f615332918ad415186babc7dc628cbfe803c..a4384746569feb17003d0d86c04293a521feeeed 100644
--- a/ui/views/controls/button/custom_button.cc
+++ b/ui/views/controls/button/custom_button.cc
@@ -241,12 +241,12 @@ bool CustomButton::OnKeyPressed(const ui::KeyEvent& event) {
}
bool CustomButton::OnKeyReleased(const ui::KeyEvent& event) {
- if ((state_ == STATE_DISABLED) || (event.key_code() != ui::VKEY_SPACE))
- return false;
-
- SetState(STATE_NORMAL);
- NotifyClick(event);
- return true;
+ if ((state_ == STATE_PRESSED) && (event.key_code() == ui::VKEY_SPACE)) {
+ SetState(STATE_NORMAL);
+ NotifyClick(event);
+ return true;
+ }
+ return false;
}
void CustomButton::OnGestureEvent(ui::GestureEvent* event) {
@@ -371,8 +371,11 @@ void CustomButton::ViewHierarchyChanged(
void CustomButton::OnBlur() {
Button::OnBlur();
- if (IsHotTracked())
+ if (IsHotTracked() || state_ == STATE_PRESSED) {
bruthig 2016/05/31 14:20:40 This opens up the following edge case: 1. Press a
bruthig 2016/05/31 14:23:42 At the very least I do believe this change is an i
SetState(STATE_NORMAL);
+ if (ink_drop_delegate())
+ ink_drop_delegate()->OnAction(views::InkDropState::HIDDEN);
+ }
}
bool CustomButton::ShouldShowInkDropForFocus() const {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698