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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_view_views.cc

Issue 2817403002: [Omnibox] Elide omnibox text (Closed)
Patch Set: [Omnibox] Elide omnibox text Created 3 years, 8 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: chrome/browser/ui/views/omnibox/omnibox_view_views.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
index 6fc3b895ef0ba5c89f7e333c373d373a25bd902d..601f0a2c62abd65cb4d7e6006afae2ce91416b6b 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views.cc
@@ -139,6 +139,8 @@ void OmniboxViewViews::Init() {
set_controller(this);
SetTextInputType(ui::TEXT_INPUT_TYPE_URL);
Peter Kasting 2017/04/17 19:03:52 Nit: Blank line here unnecessary
simonhong 2017/04/17 19:51:01 Done.
+ GetRenderText()->SetElideBehavior(gfx::ELIDE_TAIL);
+
if (popup_window_mode_)
SetReadOnly(true);
@@ -749,6 +751,8 @@ bool OmniboxViewViews::HandleAccessibleAction(
}
void OmniboxViewViews::OnFocus() {
+ GetRenderText()->SetElideBehavior(gfx::NO_ELIDE);
Peter Kasting 2017/04/17 19:03:52 Nit: Both here and in OnBlur() I'd attempt to call
simonhong 2017/04/17 19:51:01 Done.
+
views::Textfield::OnFocus();
// TODO(oshima): Get control key state.
model()->OnSetFocus(false);
@@ -766,6 +770,8 @@ void OmniboxViewViews::OnFocus() {
}
Peter Kasting 2017/04/17 19:03:53 Do we need to schedule a paint here or is changing
simonhong 2017/04/17 19:51:01 It's guaranteed. When getting text or properties f
void OmniboxViewViews::OnBlur() {
+ GetRenderText()->SetElideBehavior(gfx::ELIDE_TAIL);
+
// Save the user's existing selection to restore it later.
saved_selection_for_focus_change_ = GetSelectedRange();

Powered by Google App Engine
This is Rietveld 408576698