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

Unified Diff: ui/views/controls/textfield/textfield.cc

Issue 2650963002: MacViews: Select all text on right clicking an unfocused text view. (Closed)
Patch Set: Fix tests Created 3 years, 11 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
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) {

Powered by Google App Engine
This is Rietveld 408576698