Chromium Code Reviews| Index: ui/views/controls/textfield/textfield.cc |
| diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc |
| index 217bb57a1247b35ab9fe89594162a04427f8c6ba..b516d0d8244c9ac1440678cd9f342fa4e0e6719b 100644 |
| --- a/ui/views/controls/textfield/textfield.cc |
| +++ b/ui/views/controls/textfield/textfield.cc |
| @@ -575,6 +575,7 @@ gfx::NativeCursor Textfield::GetCursor(const ui::MouseEvent& event) { |
| } |
| bool Textfield::OnMousePressed(const ui::MouseEvent& event) { |
| + const bool has_focus = HasFocus(); |
|
tapted
2017/01/25 09:11:16
had_focus
karandeepb
2017/01/25 10:43:55
Done.
|
| bool handled = controller_ && controller_->HandleMouseEvent(this, event); |
| if (!handled && |
| (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton())) { |
| @@ -583,11 +584,13 @@ bool Textfield::OnMousePressed(const ui::MouseEvent& event) { |
| } |
| #if defined(OS_LINUX) && !defined(OS_CHROMEOS) |
| - if (!handled && !HasFocus() && event.IsOnlyMiddleMouseButton()) |
| + if (!handled && !has_focus && event.IsOnlyMiddleMouseButton()) |
| RequestFocus(); |
| #endif |
| - return selection_controller_.OnMousePressed(event, handled); |
| + return selection_controller_.OnMousePressed( |
| + event, handled, has_focus ? SelectionController::FOCUSED |
| + : SelectionController::UNFOCUSED); |
| } |
| bool Textfield::OnMouseDragged(const ui::MouseEvent& event) { |