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/autofill/autofill_popup_controller_impl.h" | 5 #include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 142 |
143 // The line can have no strings if it represents a UI element, such as | 143 // The line can have no strings if it represents a UI element, such as |
144 // a separator line. | 144 // a separator line. |
145 if (total_text_length == 0) | 145 if (total_text_length == 0) |
146 continue; | 146 continue; |
147 | 147 |
148 int available_width = popup_width - RowWidthWithoutText(i); | 148 int available_width = popup_width - RowWidthWithoutText(i); |
149 | 149 |
150 // Each field receives space in proportion to its length. | 150 // Each field receives space in proportion to its length. |
151 int name_size = available_width * name_width / total_text_length; | 151 int name_size = available_width * name_width / total_text_length; |
152 names_[i] = gfx::ElideText(names_[i], | 152 names_[i] = gfx::ElideText(names_[i], GetNameFontListForRow(i), |
153 GetNameFontListForRow(i), | 153 name_size, gfx::ELIDE_TAIL); |
154 name_size, | |
155 gfx::ELIDE_AT_END); | |
156 | 154 |
157 int subtext_size = available_width * subtext_width / total_text_length; | 155 int subtext_size = available_width * subtext_width / total_text_length; |
158 subtexts_[i] = gfx::ElideText(subtexts_[i], | 156 subtexts_[i] = gfx::ElideText(subtexts_[i], subtext_font_list(), |
159 subtext_font_list(), | 157 subtext_size, gfx::ELIDE_TAIL); |
160 subtext_size, | |
161 gfx::ELIDE_AT_END); | |
162 } | 158 } |
163 #endif | 159 #endif |
164 | 160 |
165 if (!view_) { | 161 if (!view_) { |
166 view_ = AutofillPopupView::Create(this); | 162 view_ = AutofillPopupView::Create(this); |
167 | 163 |
168 // It is possible to fail to create the popup, in this case | 164 // It is possible to fail to create the popup, in this case |
169 // treat the popup as hiding right away. | 165 // treat the popup as hiding right away. |
170 if (!view_) { | 166 if (!view_) { |
171 Hide(); | 167 Hide(); |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 names_.clear(); | 622 names_.clear(); |
627 subtexts_.clear(); | 623 subtexts_.clear(); |
628 icons_.clear(); | 624 icons_.clear(); |
629 identifiers_.clear(); | 625 identifiers_.clear(); |
630 full_names_.clear(); | 626 full_names_.clear(); |
631 | 627 |
632 selected_line_ = kNoSelection; | 628 selected_line_ = kNoSelection; |
633 } | 629 } |
634 | 630 |
635 } // namespace autofill | 631 } // namespace autofill |
OLD | NEW |