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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 120503005: Merge NativeTextfieldViews into views::Textfield. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Simplify Textfield border code. Created 6 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 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 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 base::i18n::LEFT_TO_RIGHT : base::i18n::RIGHT_TO_LEFT)) { 895 base::i18n::LEFT_TO_RIGHT : base::i18n::RIGHT_TO_LEFT)) {
896 // TODO(sky): Figure out why we need the +1. 896 // TODO(sky): Figure out why we need the +1.
897 suggested_text_bounds.set_x(location_bounds.x() + 1); 897 suggested_text_bounds.set_x(location_bounds.x() + 1);
898 // Use a margin to prevent omnibox text from overlapping suggest text. 898 // Use a margin to prevent omnibox text from overlapping suggest text.
899 omnibox_view_margin = suggested_text_bounds.width(); 899 omnibox_view_margin = suggested_text_bounds.width();
900 } 900 }
901 suggested_text_view_->SetBoundsRect(suggested_text_bounds); 901 suggested_text_view_->SetBoundsRect(suggested_text_bounds);
902 } 902 }
903 } 903 }
904 904
905 omnibox_view_->SetHorizontalMargins(0, omnibox_view_margin); 905 const gfx::Insets insets = omnibox_view_->GetInsets();
906 omnibox_view_->set_border(views::Border::CreateEmptyBorder(
907 insets.top(), insets.left(), insets.bottom(), omnibox_view_margin));
906 908
907 // Layout |ime_inline_autocomplete_view_| next to the user input. 909 // Layout |ime_inline_autocomplete_view_| next to the user input.
908 if (ime_inline_autocomplete_view_->visible()) { 910 if (ime_inline_autocomplete_view_->visible()) {
909 int width = 911 int width =
910 gfx::GetStringWidth(ime_inline_autocomplete_view_->text(), 912 gfx::GetStringWidth(ime_inline_autocomplete_view_->text(),
911 ime_inline_autocomplete_view_->font_list()) + 913 ime_inline_autocomplete_view_->font_list()) +
912 ime_inline_autocomplete_view_->GetInsets().width(); 914 ime_inline_autocomplete_view_->GetInsets().width();
913 // All the target languages (IMEs) are LTR, and we do not need to support 915 // All the target languages (IMEs) are LTR, and we do not need to support
914 // RTL so far. In other words, no testable RTL environment so far. 916 // RTL so far. In other words, no testable RTL environment so far.
915 int x = location_needed_width; 917 int x = location_needed_width;
(...skipping 666 matching lines...) Expand 10 before | Expand all | Expand 10 after
1582 bounds.Inset(-(horizontal_padding + 1) / 2, 0); 1584 bounds.Inset(-(horizontal_padding + 1) / 2, 0);
1583 location_bar_util::PaintExtensionActionBackground( 1585 location_bar_util::PaintExtensionActionBackground(
1584 *(*page_action_view)->image_view()->page_action(), 1586 *(*page_action_view)->image_view()->page_action(),
1585 tab_id, canvas, bounds, text_color, background_color); 1587 tab_id, canvas, bounds, text_color, background_color);
1586 } 1588 }
1587 } 1589 }
1588 1590
1589 void LocationBarView::AccessibilitySetValue(const base::string16& new_value) { 1591 void LocationBarView::AccessibilitySetValue(const base::string16& new_value) {
1590 omnibox_view_->SetUserText(new_value, new_value, true); 1592 omnibox_view_->SetUserText(new_value, new_value, true);
1591 } 1593 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | chrome/browser/ui/views/omnibox/omnibox_view_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698