Summary: The layout is wrong in many cases of explicit Unicode embedding (either by a <span> with
direction property or by Unicode embedding characters) occurs.
To Reproduce: See testcase.
Expected/Actual: Testcase includes a description of expected rendering. Firefox renders as expected.
Note that mirroring behavior is also affected by a separate ATSUI issue with certain fonts. Use Lucida
Grande for testing.
Analysis: The testcase actually expose three issues in bidi.cpp:
1. bidiReorderLine() not closing the "dangling" run when it sees an explicit embedding character (or
2. embed() not setting up the new run correctly following an embed/pop.
3. bidiReorderLine ()'s implementation of rule L2 of the Unicode bidi algorithm is broken for lines where
the embedding levels aren't unimodal (the index variable is advancing too fast).
The proposed patch addresses these issues and fixes all the lines in the testcase. Testcase can be used
as a new layout test.
Created attachment 2453 [details]
Created attachment 2454 [details]
Comment on attachment 2454 [details]
Pulling the patch since it causes Safari to hang under some hard-to-reproduce
I've split the 3rd issue (implementation of rule L2) off into bug 3633 .
Created attachment 2551 [details]
If the test case requires using Lucida Grande, then we should add CSS to make it do that, instead of
relying on the default font.
Comment on attachment 2551 [details]
I'm not really qualified to say whether this code is better or not, since I
don't understand the bidi algorithm nor the details of our implementation of
it. But as long as this fixes this test case and doesn't break any existing
cases, I say r=me.
Created attachment 2582 [details]
Specified the use of Lucida Grande and added an item.
Created attachment 2632 [details]
Modified testcase so that the textual description of the expected layout
(digits in increasing orders) would be correct.