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

Unified Diff: chrome/views/message_box_view.cc

Issue 18863: Review request: fix issue 6099 -- bad display of multi-line English message in pop ups (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/views/message_box_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/views/message_box_view.cc
===================================================================
--- chrome/views/message_box_view.cc (revision 10107)
+++ chrome/views/message_box_view.cc (working copy)
@@ -95,7 +95,24 @@
void MessageBoxView::Init(int dialog_flags,
const std::wstring& default_prompt) {
message_label_->SetMultiLine(true);
- message_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
+ if (dialog_flags & kAutoDetectAlignment) {
+ // Determine the alignment and directionality based on the first character
+ // with strong directionality.
+ l10n_util::TextDirection direction =
+ l10n_util::GetFirstStrongCharacterDirection(message_label_->GetText());
+ views::Label::Alignment alignment;
+ if (direction == l10n_util::RIGHT_TO_LEFT)
+ alignment = views::Label::ALIGN_RIGHT;
+ else
+ alignment = views::Label::ALIGN_LEFT;
+ // In addition, we should set the RTL alignment mode as
+ // AUTO_DETECT_ALIGNMENT so that the alignment will not be flipped around
+ // in RTL locales.
+ message_label_->SetRTLAlignmentMode(views::Label::AUTO_DETECT_ALIGNMENT);
+ message_label_->SetHorizontalAlignment(alignment);
+ } else {
+ message_label_->SetHorizontalAlignment(views::Label::ALIGN_LEFT);
+ }
if (dialog_flags & kFlagHasPromptField) {
prompt_field_ = new views::TextField;
« no previous file with comments | « chrome/views/message_box_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698