On 2012/05/15 15:47:01, Alexei Svitkine wrote:
> I've updated the CL to have the logic you suggested.
> I'm still not sure I'm entirely convinced that this makes sense.
> With the updated logic, I have the following questions:
> 1. Clearly, the "force RTL" case needs to work even if the UI language is
> not
> RTL, else it wouldn't fix the issue in question (with bidi alerts). But
wouldn't
> this result in boxes being rendered on systems without RTL language
> support?
Yes. It will render boxes on system without RTL support.
> Or do we assume that's okay because: a) all callers who set this do it
> based
on
> the content of the string and b) if the content of the string is such
> that we
> want to force RTL, then if the system doesn't have RTL language support,
> it
> would already have boxes, so extra boxes wouldn't be any worse? Is that
> the
> correct reasoning here?
Yes, we assume system has RTL support if users want to display RTL
characters.
Currently, FORCE_RTL_DIRECTIONALITY is only set when a JS message starts
with
strong RTL characters, in which case, we assume the system has RTL support.
I do not quite understand your a), but I think b) is what we assume.
> 2. For the final case in the updated function, right now I simply return
> false
> and don't wrap the text at all. But that case is only reached if the
> string
> contains strong directionality characters and the UI is not RTL. I'm not
> convinced that case makes sense.
In our Windows system, we want the UI strings to be displayed as
left-to-right
directionality when UI itself is LTR, vice versa.
So, for English Chrome, even if the string is "abc DEF" (assume DEF is
Hebrew),
which contains strong RTL characters, we still want it to be displayed as
LTR as
"abcFED".
Same string in Hebrew Chrome, we want the string display as RTL as "FEDabc".
So, the last case is correct.
Currently, the FORCE directionality cases are only used for JS message
display.
The other cases are for Chrome's UI strings.
(that is the reason I feel the old 'if'/'else' structure is more symmetric
and
readable.)
> Do we really need to check IsRTL() before wrapping the string for RTL if
> we
> already know the string contains strong directionality characters?
Yes, we do as what explained above.
> I am thinking
> that the same logic as 1. could be applied here: i.e. either a) the
> system has
> RTL support and wrapping won't do any harm or b) the system doesn't have
> RTL
> support, so it will already render boxes since the string already has
> strong
> directionality characters (that we checked for).
> So I'm thinking the last if statement could be removed in the function and
have
> it always end with wrapping and returning true. What do you think?
that would yield wrong result for UI string in LTR locale.
http://codereview.chromium.org/10384168/