Chromium Code Reviews| Index: ui/views/controls/slider.cc |
| diff --git a/ui/views/controls/slider.cc b/ui/views/controls/slider.cc |
| index dd1148ff1a59123e6f2c960404aee5ffe732267c..d390792c52db17ec139b19d053af5d20049e8fea 100644 |
| --- a/ui/views/controls/slider.cc |
| +++ b/ui/views/controls/slider.cc |
| @@ -179,6 +179,7 @@ float Slider::GetAnimatingValue() const{ |
| bool Slider::OnMousePressed(const ui::MouseEvent& event) { |
| if (!event.IsOnlyLeftMouseButton()) |
| return false; |
| + SetFocus(true); |
|
bruthig
2016/09/21 00:27:46
Instead of calling SetFocus() from OnMousePressed(
yiyix
2016/09/21 15:20:52
good call!!
|
| OnSliderDragStarted(); |
| PrepareForMove(event.location().x()); |
| MoveButtonTo(event.location()); |
| @@ -191,6 +192,7 @@ bool Slider::OnMouseDragged(const ui::MouseEvent& event) { |
| } |
| void Slider::OnMouseReleased(const ui::MouseEvent& event) { |
| + SetFocus(false); |
| OnSliderDragEnded(); |
| } |
| @@ -208,11 +210,13 @@ bool Slider::OnKeyPressed(const ui::KeyEvent& event) { |
| void Slider::OnFocus() { |
| View::OnFocus(); |
| + SetFocus(true); |
| SchedulePaint(); |
| } |
| void Slider::OnBlur() { |
| View::OnBlur(); |
| + SetFocus(false); |
| SchedulePaint(); |
| } |
| @@ -226,10 +230,12 @@ void Slider::OnGestureEvent(ui::GestureEvent* event) { |
| // Intentional fall through to next case. |
| case ui::ET_GESTURE_SCROLL_BEGIN: |
| case ui::ET_GESTURE_SCROLL_UPDATE: |
| + SetFocus(true); |
| MoveButtonTo(event->location()); |
| event->SetHandled(); |
| break; |
| case ui::ET_GESTURE_END: |
| + SetFocus(false); |
| MoveButtonTo(event->location()); |
| event->SetHandled(); |
| if (event->details().touch_points() <= 1) |