| Index: ui/views/controls/message_box_view.cc
|
| diff --git a/ui/views/controls/message_box_view.cc b/ui/views/controls/message_box_view.cc
|
| index 671ca6194ec432baa908efb7eabbc6a81f50f297..20caaa89a025badcdf3b0d1bd513f25d9c310dd4 100644
|
| --- a/ui/views/controls/message_box_view.cc
|
| +++ b/ui/views/controls/message_box_view.cc
|
| @@ -177,13 +177,21 @@
|
| if (params.options & DETECT_DIRECTIONALITY) {
|
| std::vector<base::string16> texts;
|
| SplitStringIntoParagraphs(params.message, &texts);
|
| + // If the text originates from a web page, its alignment is based on its
|
| + // first character with strong directionality.
|
| + base::i18n::TextDirection message_direction =
|
| + base::i18n::GetFirstStrongCharacterDirection(params.message);
|
| + gfx::HorizontalAlignment alignment =
|
| + (message_direction == base::i18n::RIGHT_TO_LEFT) ?
|
| + gfx::ALIGN_RIGHT : gfx::ALIGN_LEFT;
|
| for (size_t i = 0; i < texts.size(); ++i) {
|
| Label* message_label = new Label(texts[i]);
|
| - // Avoid empty multi-line labels, which have a height of 0.
|
| + // Don't set multi-line to true if the text is empty, else the label will
|
| + // have a height of 0.
|
| message_label->SetMultiLine(!texts[i].empty());
|
| message_label->SetAllowCharacterBreak(true);
|
| - message_label->set_directionality_mode(gfx::DIRECTIONALITY_FROM_TEXT);
|
| - message_label->SetHorizontalAlignment(gfx::ALIGN_TO_HEAD);
|
| + message_label->set_directionality_mode(Label::AUTO_DETECT_DIRECTIONALITY);
|
| + message_label->SetHorizontalAlignment(alignment);
|
| message_labels_.push_back(message_label);
|
| }
|
| } else {
|
|
|