| Index: ui/views/controls/textfield/textfield.cc
|
| diff --git a/ui/views/controls/textfield/textfield.cc b/ui/views/controls/textfield/textfield.cc
|
| index d15a3e3d915441064cae5a4ae29dadb8afbbdca2..3a417b19029a1274367a2506e6d39bf139e9d010 100644
|
| --- a/ui/views/controls/textfield/textfield.cc
|
| +++ b/ui/views/controls/textfield/textfield.cc
|
| @@ -575,19 +575,23 @@ gfx::NativeCursor Textfield::GetCursor(const ui::MouseEvent& event) {
|
| }
|
|
|
| bool Textfield::OnMousePressed(const ui::MouseEvent& event) {
|
| + const bool had_focus = HasFocus();
|
| bool handled = controller_ && controller_->HandleMouseEvent(this, event);
|
| if (!handled &&
|
| (event.IsOnlyLeftMouseButton() || event.IsOnlyRightMouseButton())) {
|
| - RequestFocus();
|
| + if (!had_focus)
|
| + RequestFocus();
|
| ShowImeIfNeeded();
|
| }
|
|
|
| #if defined(OS_LINUX) && !defined(OS_CHROMEOS)
|
| - if (!handled && !HasFocus() && event.IsOnlyMiddleMouseButton())
|
| + if (!handled && !had_focus && event.IsOnlyMiddleMouseButton())
|
| RequestFocus();
|
| #endif
|
|
|
| - return selection_controller_.OnMousePressed(event, handled);
|
| + return selection_controller_.OnMousePressed(
|
| + event, handled, had_focus ? SelectionController::FOCUSED
|
| + : SelectionController::UNFOCUSED);
|
| }
|
|
|
| bool Textfield::OnMouseDragged(const ui::MouseEvent& event) {
|
|
|