OLD | NEW |
---|---|
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 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
873 ime_inline_autocomplete_view_->text()) + | 873 ime_inline_autocomplete_view_->text()) + |
874 ime_inline_autocomplete_view_->GetInsets().width(); | 874 ime_inline_autocomplete_view_->GetInsets().width(); |
875 // All the target languages (IMEs) are LTR, and we do not need to support | 875 // All the target languages (IMEs) are LTR, and we do not need to support |
876 // RTL so far. In other words, no testable RTL environment so far. | 876 // RTL so far. In other words, no testable RTL environment so far. |
877 int x = location_needed_width; | 877 int x = location_needed_width; |
878 if (width > entry_width) | 878 if (width > entry_width) |
879 x = 0; | 879 x = 0; |
880 else if (location_needed_width + width > entry_width) | 880 else if (location_needed_width + width > entry_width) |
881 x = entry_width - width; | 881 x = entry_width - width; |
882 location_bounds.set_width(x); | 882 location_bounds.set_width(x); |
883 const int baseline_diff = location_entry_view_->GetBaseline() - | |
Peter Kasting
2013/08/09 19:00:48
Instead of doing this here, shouldn't we be doing
Yuki
2013/08/12 06:30:14
That's right. I've moved the code to the initiali
| |
884 ime_inline_autocomplete_view_->GetBaseline(); | |
883 ime_inline_autocomplete_view_->SetBounds( | 885 ime_inline_autocomplete_view_->SetBounds( |
884 location_bounds.right(), location_bounds.y(), | 886 location_bounds.right(), |
887 location_bounds.y() + baseline_diff, | |
885 std::min(width, entry_width), | 888 std::min(width, entry_width), |
886 ime_inline_autocomplete_view_->GetPreferredSize().height()); | 889 ime_inline_autocomplete_view_->GetPreferredSize().height()); |
887 } | 890 } |
888 | 891 |
889 location_entry_view_->SetBoundsRect(location_bounds); | 892 location_entry_view_->SetBoundsRect(location_bounds); |
890 } | 893 } |
891 | 894 |
892 void LocationBarView::OnPaint(gfx::Canvas* canvas) { | 895 void LocationBarView::OnPaint(gfx::Canvas* canvas) { |
893 View::OnPaint(canvas); | 896 View::OnPaint(canvas); |
894 | 897 |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1506 int LocationBarView::GetInternalHeight(bool use_preferred_size) { | 1509 int LocationBarView::GetInternalHeight(bool use_preferred_size) { |
1507 int total_height = | 1510 int total_height = |
1508 use_preferred_size ? GetPreferredSize().height() : height(); | 1511 use_preferred_size ? GetPreferredSize().height() : height(); |
1509 return std::max(total_height - (vertical_edge_thickness() * 2), 0); | 1512 return std::max(total_height - (vertical_edge_thickness() * 2), 0); |
1510 } | 1513 } |
1511 | 1514 |
1512 bool LocationBarView::HasValidSuggestText() const { | 1515 bool LocationBarView::HasValidSuggestText() const { |
1513 return suggested_text_view_->visible() && | 1516 return suggested_text_view_->visible() && |
1514 !suggested_text_view_->size().IsEmpty(); | 1517 !suggested_text_view_->size().IsEmpty(); |
1515 } | 1518 } |
OLD | NEW |