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

Side by Side 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: Updated based on review comments. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 272
273 // Initialize the Omnibox view. 273 // Initialize the Omnibox view.
274 location_entry_.reset(CreateOmniboxView(this, model_, profile_, 274 location_entry_.reset(CreateOmniboxView(this, model_, profile_,
275 command_updater_, is_popup_mode_, this, font_list, font_y_offset)); 275 command_updater_, is_popup_mode_, this, font_list, font_y_offset));
276 SetLocationEntryFocusable(true); 276 SetLocationEntryFocusable(true);
277 location_entry_view_ = location_entry_->AddToView(this); 277 location_entry_view_ = location_entry_->AddToView(this);
278 278
279 // Initialize the inline autocomplete view which is visible only when IME is 279 // Initialize the inline autocomplete view which is visible only when IME is
280 // turned on. Use the same font with the omnibox and highlighted background. 280 // turned on. Use the same font with the omnibox and highlighted background.
281 ime_inline_autocomplete_view_ = new views::Label(string16(), font); 281 ime_inline_autocomplete_view_ = new views::Label(string16(), font);
282 ime_inline_autocomplete_view_->set_border( 282 {
283 views::Border::CreateEmptyBorder(font_y_offset, 0, 0, 0)); 283 const int baseline_diff = location_entry_view_->GetBaseline() -
Peter Kasting 2013/08/12 19:54:39 Nit: Add comment about why this is needed and when
Yuki 2013/08/13 05:51:18 Done.
284 ime_inline_autocomplete_view_->GetBaseline();
Peter Kasting 2013/08/12 19:54:39 Nit: Indent 4, not even
Yuki 2013/08/13 05:51:18 Done.
285 ime_inline_autocomplete_view_->set_border(
286 views::Border::CreateEmptyBorder(
287 font_y_offset + baseline_diff, 0, 0, 0));
288 }
284 ime_inline_autocomplete_view_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 289 ime_inline_autocomplete_view_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
285 ime_inline_autocomplete_view_->SetAutoColorReadabilityEnabled(false); 290 ime_inline_autocomplete_view_->SetAutoColorReadabilityEnabled(false);
286 ime_inline_autocomplete_view_->set_background( 291 ime_inline_autocomplete_view_->set_background(
287 views::Background::CreateSolidBackground(GetNativeTheme()->GetSystemColor( 292 views::Background::CreateSolidBackground(GetNativeTheme()->GetSystemColor(
288 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused))); 293 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused)));
289 ime_inline_autocomplete_view_->SetEnabledColor( 294 ime_inline_autocomplete_view_->SetEnabledColor(
290 GetNativeTheme()->GetSystemColor( 295 GetNativeTheme()->GetSystemColor(
291 ui::NativeTheme::kColorId_TextfieldSelectionColor)); 296 ui::NativeTheme::kColorId_TextfieldSelectionColor));
292 ime_inline_autocomplete_view_->SetVisible(false); 297 ime_inline_autocomplete_view_->SetVisible(false);
293 AddChildView(ime_inline_autocomplete_view_); 298 AddChildView(ime_inline_autocomplete_view_);
(...skipping 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1506 int LocationBarView::GetInternalHeight(bool use_preferred_size) { 1511 int LocationBarView::GetInternalHeight(bool use_preferred_size) {
1507 int total_height = 1512 int total_height =
1508 use_preferred_size ? GetPreferredSize().height() : height(); 1513 use_preferred_size ? GetPreferredSize().height() : height();
1509 return std::max(total_height - (vertical_edge_thickness() * 2), 0); 1514 return std::max(total_height - (vertical_edge_thickness() * 2), 0);
1510 } 1515 }
1511 1516
1512 bool LocationBarView::HasValidSuggestText() const { 1517 bool LocationBarView::HasValidSuggestText() const {
1513 return suggested_text_view_->visible() && 1518 return suggested_text_view_->visible() &&
1514 !suggested_text_view_->size().IsEmpty(); 1519 !suggested_text_view_->size().IsEmpty();
1515 } 1520 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698