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

Side by Side Diff: ui/views/controls/message_box_view.cc

Issue 23228004: Prepare to use gfx::RenderText in views::Label. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Revert Label implementation changes. Created 6 years, 5 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
« no previous file with comments | « ui/views/controls/label_unittest.cc ('k') | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/views/controls/message_box_view.h" 5 #include "ui/views/controls/message_box_view.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 167
168 void MessageBoxView::Init(const InitParams& params) { 168 void MessageBoxView::Init(const InitParams& params) {
169 if (params.options & DETECT_DIRECTIONALITY) { 169 if (params.options & DETECT_DIRECTIONALITY) {
170 std::vector<base::string16> texts; 170 std::vector<base::string16> texts;
171 SplitStringIntoParagraphs(params.message, &texts); 171 SplitStringIntoParagraphs(params.message, &texts);
172 for (size_t i = 0; i < texts.size(); ++i) { 172 for (size_t i = 0; i < texts.size(); ++i) {
173 Label* message_label = new Label(texts[i]); 173 Label* message_label = new Label(texts[i]);
174 // Avoid empty multi-line labels, which have a height of 0. 174 // Avoid empty multi-line labels, which have a height of 0.
175 message_label->SetMultiLine(!texts[i].empty()); 175 message_label->SetMultiLine(!texts[i].empty());
176 message_label->SetAllowCharacterBreak(true); 176 message_label->SetAllowCharacterBreak(true);
177 message_label->set_directionality_mode(gfx::DIRECTIONALITY_FROM_TEXT);
178 message_label->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD); 177 message_label->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD);
179 message_labels_.push_back(message_label); 178 message_labels_.push_back(message_label);
180 } 179 }
181 } else { 180 } else {
182 Label* message_label = new Label(params.message); 181 Label* message_label = new Label(params.message);
183 message_label->SetMultiLine(true); 182 message_label->SetMultiLine(true);
184 message_label->SetAllowCharacterBreak(true); 183 message_label->SetAllowCharacterBreak(true);
185 message_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); 184 message_label->SetHorizontalAlignment(gfx::ALIGN_LEFT);
186 message_labels_.push_back(message_label); 185 message_labels_.push_back(message_label);
187 } 186 }
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 } 239 }
241 240
242 if (link_) { 241 if (link_) {
243 layout->AddPaddingRow(0, inter_row_vertical_spacing_); 242 layout->AddPaddingRow(0, inter_row_vertical_spacing_);
244 layout->StartRow(0, extra_column_view_set_id); 243 layout->StartRow(0, extra_column_view_set_id);
245 layout->AddView(link_); 244 layout->AddView(link_);
246 } 245 }
247 } 246 }
248 247
249 } // namespace views 248 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/label_unittest.cc ('k') | ui/views/controls/textfield/textfield.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698