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

Unified Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 22563006: Fixes vertical misalignment of IME autocompletion. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixes style and comments, reverts native_textfield_views.cc Created 7 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/location_bar/location_bar_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 64bdc85f3a28ec6465dcd20d312f6658142112ee..77ef2e7e341978e5a48952855fe907e6ef40601e 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -288,8 +288,21 @@ void LocationBarView::Init() {
// Initialize the inline autocomplete view which is visible only when IME is
// turned on. Use the same font with the omnibox and highlighted background.
ime_inline_autocomplete_view_ = new views::Label(string16(), font);
- ime_inline_autocomplete_view_->set_border(
- views::Border::CreateEmptyBorder(font_y_offset, 0, 0, 0));
+ {
+ // views::Label (|ime_inline_autocomplete_view_|) supports only gfx::Font
+ // and ignores the rest of fonts but the first in |font_list| while
+ // views::Textfield (|location_entry_view_|) supports gfx::FontList and
+ // layouts text based on all fonts in the list. Thus the font height and
+ // baseline can be different between them. We add padding to align them
+ // on the same baseline.
+ // TODO(yukishiino): Remove this hack once views::Label supports
+ // gfx::FontList.
+ const int baseline_diff = location_entry_view_->GetBaseline() -
+ ime_inline_autocomplete_view_->GetBaseline();
+ ime_inline_autocomplete_view_->set_border(
+ views::Border::CreateEmptyBorder(
+ font_y_offset + baseline_diff, 0, 0, 0));
+ }
ime_inline_autocomplete_view_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
ime_inline_autocomplete_view_->SetAutoColorReadabilityEnabled(false);
ime_inline_autocomplete_view_->set_background(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698