diff options
author | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-03 18:22:54 +0000 |
---|---|---|
committer | pkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-06-03 18:22:54 +0000 |
commit | 137b0455860164ef02fc408adb46cf5bfbfb6b75 (patch) | |
tree | bc96ab49aa2d233a6f33aae3211e2c9249164ed7 | |
parent | 408dc7aa687434795202c079c1a60749cac0d772 (diff) | |
download | chromium_src-137b0455860164ef02fc408adb46cf5bfbfb6b75.zip chromium_src-137b0455860164ef02fc408adb46cf5bfbfb6b75.tar.gz chromium_src-137b0455860164ef02fc408adb46cf5bfbfb6b75.tar.bz2 |
Correct vertical positioning for the IME autocompletion.
The location bar no longer just vertically-centers contained labels.
BUG=159105
TEST=none
R=yukishiino@chromium.org
Review URL: https://codereview.chromium.org/15779010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203738 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/ui/views/location_bar/location_bar_view.cc | 19 |
1 files changed, 8 insertions, 11 deletions
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 bb21f4e..7e2b675 100644 --- a/chrome/browser/ui/views/location_bar/location_bar_view.cc +++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc @@ -281,7 +281,9 @@ 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(); + ime_inline_autocomplete_view_ = new views::Label(string16(), font); + ime_inline_autocomplete_view_->set_border( + views::Border::CreateEmptyBorder(font_y_offset, 0, 0, 0)); ime_inline_autocomplete_view_->SetHorizontalAlignment(gfx::ALIGN_LEFT); ime_inline_autocomplete_view_->SetAutoColorReadabilityEnabled(false); ime_inline_autocomplete_view_->set_background( @@ -290,7 +292,6 @@ void LocationBarView::Init() { ime_inline_autocomplete_view_->SetEnabledColor( GetNativeTheme()->GetSystemColor( ui::NativeTheme::kColorId_TextfieldSelectionColor)); - ime_inline_autocomplete_view_->SetFont(font); ime_inline_autocomplete_view_->SetVisible(false); AddChildView(ime_inline_autocomplete_view_); @@ -922,20 +923,16 @@ void LocationBarView::Layout() { ime_inline_autocomplete_view_->GetInsets().width(); // All the target languages (IMEs) are LTR, and we do not need to support // RTL so far. In other words, no testable RTL environment so far. - int x; - if (width > entry_width) { + int x = location_needed_width; + if (width > entry_width) x = 0; - } else if (location_needed_width + width > entry_width) { + else if (location_needed_width + width > entry_width) x = entry_width - width; - } else { - x = location_needed_width; - } location_bounds.set_width(x); ime_inline_autocomplete_view_->SetBounds( - location_bounds.right(), - location_bounds.y(), + location_bounds.right(), location_bounds.y(), std::min(width, entry_width), - location_bounds.height()); + ime_inline_autocomplete_view_->GetPreferredSize().height()); } location_entry_view_->SetBoundsRect(location_bounds); |