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

Issue 18863: Review request: fix issue 6099 -- bad display of multi-line English message in pop ups (Closed)

Created:
11 years, 11 months ago by xji
Modified:
9 years, 6 months ago
Reviewers:
brettw, idana
CC:
chromium-reviews_googlegroups.com, Ben Goodger (Google)
Visibility:
Public.

Description

This CL fixes issue 6099 -- bad display of multi-line English message in pop ups. (http://crbug.com/6099) Currently, in RTL locales, a pure *multi-line* English message is displayed as right aligned and has RTL directionality (such as the ending punctuation appears at the very left). Single-line message works fine. I do not know why, but simply putting LRE-PDF around a multi-line English text which has the following flags DT_WORDBREAK | DT_RTLREADING wont render the English message as LTR. We have to remove the DT_RTLREADING to render multi-line English message correctly in LTR direction. The fix is that in RTL locales, for JavaScript message, if the message is pure English, the alignment is set to be left-aligned, and the directionality is set to be left-to-right. If the message is mixed BiDi text, the alignment and the directionality is determined by the directionality of the first character with strong directionality in the text. JavaScript message is a MessageBoxView, and the message is a view::Label. Both MessageBoxView and Label are used by Chrome's UI as well. If the message is one of Chrome UI's, the alignment and directionality of the message should be taken from that of the UI's. In order to distinguish where the message comes from, a new flag kFlagWebMessage is introduced in MessageBoxView, and a new argument is introduced in Label::SetHorizontalAlignment() to control whether the alignment need to be flipped or not for RTL locales. Consequently, quite a few files which calls Label::SetHorizontalAlignment() are changed. The main changes are in 5 areas. Other files are changed due to the signature change of Label::SetHorizontalAlignment(). 1. jsmessage_box_handler.cc: pass in extra flag kFlagWebPage when creating MessageBoxView to indicate the message box is one from a web page, not from Chrome UI. 2. l10n_util.h/.cc added function GetFirstStrongDirection() 3. label.h/.cc a new argument is introduced in Label::SetHorizontalAlignment() to control whether the alignment need to be flipped or not for RTL locales. 4. message_box_view.cc when init message box view, if the flag is kFlagWebPage, get the text directionality from the text itself (not Chrome UI's) and calls Label::SetHorizontalAlignment() to not resetting the flag for RTL locales. 5. chrome_canvas_win.cc 5.1 ComputeFormatFlags() only set flag DT_RTLREADING for RTL locales if the text contains strong RTL characters and the alignment is RIGHT aligned. All labels of Chrome's UI and other Chrome UI components in RTL locales have been set as (or flipped to) RIGHT aligned. 5.2 DoDrawText() Only adjust string for locale is the reading direction is DT_RTLREADING. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=10178

Patch Set 1 #

Patch Set 2 : '' #

Total comments: 15

Patch Set 3 : '' #

Patch Set 4 : '' #

Total comments: 8

Patch Set 5 : '' #

Total comments: 4

Patch Set 6 : '' #

Total comments: 26

Patch Set 7 : '' #

Patch Set 8 : '' #

Patch Set 9 : '' #

Patch Set 10 : '' #

Patch Set 11 : '' #

Total comments: 2

Patch Set 12 : '' #

Total comments: 13

Patch Set 13 : '' #

Total comments: 1

Patch Set 14 : '' #

Total comments: 1

Patch Set 15 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+289 lines, -23 lines) Patch
M chrome/browser/jsmessage_box_handler_win.cc View 12 13 1 chunk +3 lines, -2 lines 0 comments Download
M chrome/common/gfx/chrome_canvas_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 5 chunks +35 lines, -9 lines 0 comments Download
M chrome/common/l10n_util.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +8 lines, -0 lines 0 comments Download
M chrome/common/l10n_util.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +34 lines, -0 lines 0 comments Download
M chrome/common/l10n_util_unittest.cc View 3 4 5 6 7 8 9 10 11 12 13 1 chunk +96 lines, -0 lines 0 comments Download
M chrome/views/label.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 3 chunks +40 lines, -1 line 0 comments Download
M chrome/views/label.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 3 chunks +18 lines, -10 lines 0 comments Download
M chrome/views/label_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +21 lines, -0 lines 0 comments Download
M chrome/views/message_box_view.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +16 lines, -0 lines 0 comments Download
M chrome/views/message_box_view.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +18 lines, -1 line 0 comments Download

Messages

Total messages: 28 (0 generated)
xji
11 years, 11 months ago (2009-01-27 22:05:35 UTC) #1
jeremy
Very nice! http://codereview.chromium.org/18863/diff/105/214 File chrome/browser/jsmessage_box_handler.cc (right): http://codereview.chromium.org/18863/diff/105/214#newcode199 Line 199: message_text, default_prompt_text)) { message_text should align ...
11 years, 11 months ago (2009-01-28 20:47:02 UTC) #2
jungshik at Google
Very nice, indeed ! I just looked at label.{h,cc}, msgbox_view.cc and l10util*. After you address ...
11 years, 10 months ago (2009-01-29 19:04:04 UTC) #3
jeremy
http://codereview.chromium.org/18863/diff/652/427 File chrome/browser/views/options/languages_page_view.cc (right): http://codereview.chromium.org/18863/diff/652/427#newcode604 Line 604: ui_language_label_->SetHorizontalAlignmentWithFlipForRTL(views::Label::ALIGN_LEFT); >80 chars http://codereview.chromium.org/18863/diff/652/446 File chrome/common/l10n_util.cc (right): http://codereview.chromium.org/18863/diff/652/446#newcode507 ...
11 years, 10 months ago (2009-01-29 19:34:04 UTC) #4
xji
On 2009/01/29 19:04:04, Jungshik Shin wrote: > Very nice, indeed ! > I just looked ...
11 years, 10 months ago (2009-01-30 00:39:40 UTC) #5
xji
On 2009/01/29 19:34:04, jeremy wrote: > http://codereview.chromium.org/18863/diff/652/427 > File chrome/browser/views/options/languages_page_view.cc (right): > > http://codereview.chromium.org/18863/diff/652/427#newcode604 > ...
11 years, 10 months ago (2009-01-30 00:40:41 UTC) #6
jeremy
lgtm
11 years, 10 months ago (2009-01-30 05:44:04 UTC) #7
jungshik at Google
lgtm with the following addressed. http://codereview.chromium.org/18863/diff/670/698 File chrome/common/l10n_util.cc (right): http://codereview.chromium.org/18863/diff/670/698#newcode507 Line 507: const wchar_t* string ...
11 years, 10 months ago (2009-01-30 20:45:27 UTC) #8
xji
On 2009/01/30 20:45:27, Jungshik Shin wrote: > lgtm with the following addressed. > > http://codereview.chromium.org/18863/diff/670/698 ...
11 years, 10 months ago (2009-01-31 06:17:30 UTC) #9
idana
http://codereview.chromium.org/18863/diff/493/728 File chrome/browser/jsmessage_box_handler.cc (right): http://codereview.chromium.org/18863/diff/493/728#newcode197 Line 197: message_box_view_(new MessageBoxView( Alignment of "message_box_view_(..." is incorrect. http://codereview.chromium.org/18863/diff/493/755 ...
11 years, 10 months ago (2009-02-02 01:41:52 UTC) #10
jungshik at Google
http://codereview.chromium.org/18863/diff/493/754 File chrome/common/l10n_util.cc (right): http://codereview.chromium.org/18863/diff/493/754#newcode514 Line 514: UChar character; argh.. This should remain UChar32 ;-). ...
11 years, 10 months ago (2009-02-02 19:17:57 UTC) #11
xji
On 2009/02/02 01:41:52, idana wrote: > http://codereview.chromium.org/18863/diff/493/728 > File chrome/browser/jsmessage_box_handler.cc (right): > > http://codereview.chromium.org/18863/diff/493/728#newcode197 > ...
11 years, 10 months ago (2009-02-02 23:53:06 UTC) #12
xji
On 2009/02/02 19:17:57, Jungshik Shin wrote: > http://codereview.chromium.org/18863/diff/493/754 > File chrome/common/l10n_util.cc (right): > > http://codereview.chromium.org/18863/diff/493/754#newcode514 ...
11 years, 10 months ago (2009-02-02 23:54:03 UTC) #13
xji
Hi Brett, I made some variable type change in l10n_util::StringContainsStrongRTLChars(). Previously, the "length" and "position" ...
11 years, 10 months ago (2009-02-02 23:59:30 UTC) #14
brettw
Mostly looks good, I have a few naming suggestions. http://codereview.chromium.org/18863/diff/1447/2448 File chrome/views/label.h (right): http://codereview.chromium.org/18863/diff/1447/2448#newcode41 Line ...
11 years, 10 months ago (2009-02-06 19:05:00 UTC) #15
xji
Hi Brett, Thanks for your review! As to the naming convention, those names/flags are introduced ...
11 years, 10 months ago (2009-02-06 22:33:58 UTC) #16
xji
11 years, 10 months ago (2009-02-06 22:35:05 UTC) #17
brettw
On 2009/02/06 22:33:58, xji wrote: > As to the naming convention, those names/flags are introduced ...
11 years, 10 months ago (2009-02-06 23:08:11 UTC) #18
idana
A few more nit comments. http://codereview.chromium.org/18863/diff/2469/2472 File chrome/common/l10n_util.h (right): http://codereview.chromium.org/18863/diff/2469/2472#newcode115 Line 115: // type L, ...
11 years, 10 months ago (2009-02-08 05:40:10 UTC) #19
xji
Hi Brett, Idan discussed those naming with me. He thinks your point about kFlagWebMessage is ...
11 years, 10 months ago (2009-02-11 01:57:22 UTC) #20
xji
All changed per suggestion. Also, changed the kFlagWebMessage to kAutoDetectAlignment, and slightly changed the related ...
11 years, 10 months ago (2009-02-11 02:17:32 UTC) #21
idana
We are almost done, Xiaomei. The only remaining thing to change is what Ben suggested ...
11 years, 10 months ago (2009-02-20 08:05:51 UTC) #22
brettw
On 2009/02/11 01:57:22, xji wrote: > As to the DO_NOT_FLIP_ALIGNMENT_FOR_RTL_LOCALES and > FLIP_ALIGNMENT_FOR_RTL_LOCALES, we think ...
11 years, 10 months ago (2009-02-20 21:36:44 UTC) #23
xji
Done the naming changes. On 2009/02/20 08:05:51, idana wrote: > We are almost done, Xiaomei. ...
11 years, 10 months ago (2009-02-21 00:09:44 UTC) #24
xji
Changed the enum names to: USE_UI_ALIGNMENT and AUTO_DETECT_ALIGNMENT Thanks, Xiaomei On 2009/02/20 21:36:44, brettw wrote: ...
11 years, 10 months ago (2009-02-21 00:10:25 UTC) #25
brettw
I don't have any other high-level comments other than this one formatting fix. I assume ...
11 years, 10 months ago (2009-02-21 02:21:35 UTC) #26
xji
Done On 2009/02/21 02:21:35, brettw wrote: > I don't have any other high-level comments other ...
11 years, 10 months ago (2009-02-21 07:15:59 UTC) #27
idana
11 years, 10 months ago (2009-02-22 07:48:35 UTC) #28
LGTM

Powered by Google App Engine
This is Rietveld 408576698