Bug 3725 - REGRESSION in bidi.cpp r1.127: embedding levels of R EN in L context
Summary: REGRESSION in bidi.cpp r1.127: embedding levels of R EN in L context
Status: CLOSED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 412
Hardware: Mac OS X 10.4
: P1 Normal
Assignee: Dave Hyatt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-06-26 08:54 PDT by mitz
Modified: 2005-11-04 00:32 PST (History)
0 users

See Also:


Attachments
Testcase (523 bytes, text/html)
2005-06-26 08:55 PDT, mitz
no flags Details
A patch (3.53 KB, patch)
2005-06-26 12:29 PDT, mitz
no flags Details | Formatted Diff | Diff
A better patch (4.46 KB, patch)
2005-06-26 15:45 PDT, mitz
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mitz 2005-06-26 08:54:03 PDT
In a R EN L sequence of runs, the EN should have the highest embedding level. As of bidi.cpp r1.127, if the 
L is not explicit but only implicit from context, the EN ends up with the lower embedding level, and the 
layout order is wrong.

Expected layout for the testcase is the digit 1 followed by Hebrew letter Aleph in all 3 cases (followed by 
nothing, a full stop or the letter Z). Firefox renders as expected.

Actual layout with TOT is Hebrew letter Aleph followed by 1 (followed by nothing or a full stop) in the first 
two cases, and as expected in the last case.
Comment 1 mitz 2005-06-26 08:55:50 PDT
Created attachment 2654 [details]
Testcase
Comment 2 mitz 2005-06-26 12:29:29 PDT
Created attachment 2657 [details]
A patch

This fixes the regression. The patch makes 14 of the layout tests fail, because
it splits a few runs, but they render the same with it. Still, it may be
possible to avoid this. There's also room for improvement in moving out stuff
that is repeated in both "if" and "else" cases (left that way for the sake of
explicitness while I'm working on it), so I'm not even submitting it for review
at this stage.
Comment 3 Joost de Valk (AlthA) 2005-06-26 12:40:18 PDT
confirmed regression, moving to p1.
Comment 4 mitz 2005-06-26 13:00:40 PDT
(In reply to comment #3)
> confirmed regression, moving to p1.

Hm... I don't know how this priority thing works (or how anything works for that matter), so I'll just state 
that

1. If the choice is between r1.127 and r1.126, then despite the regression, r1.127 is "less buggy", i.e. the 
regression is far less likely to occur in everyday use than the problem r1.127 fixes.
2. I don't think that those 14 layout tests failing is significant.
3. There are a few other bidi layout issues in TOT (which are not regressions). I'm working on identifying 
and fixing them. I'll submit a bug about them when I give up on fixing them all or think that I've done it.
Comment 5 mitz 2005-06-26 14:18:33 PDT
attachment 2657 [details] also breaks this:
<p dir="rtl">
for 123 abc
</p>

Don't bother looking at it.
Comment 6 mitz 2005-06-26 15:45:11 PDT
Created attachment 2659 [details]
A better patch

This patch corrects the problem mentioned in comment #5.
It also fixes the layout of <p dir="rtl">&#x05d0;1.</p> and of the following,
which were broken even before r1.127:
<p dir="rtl">123a &#x05d0;&#x05d1;&#x05d2;</p>
<p dir="rtl">123a+ &#x05d0;&#x05d1;&#x05d2;</p>
<p dir="rtl">&#x05d0;&#x05d1;&#x05d2; 1+5.2x, &#x05d3;&#x05d4;&#x05d5;</p>

This patch changes the layout of <p dir="rtl">def &#x0661;&#x0662;&#x0663;
abc</p>, which was broken anyway. I don't know if it's more severely broken
now. Other cases involving Arabic numbers are broken just the same with or
without this patch.

Finally, this patch fails 137(!) layout tests, because now instead of splitting
a few runs, it merges many runs. I haven't gone through all 137 of them yet,
but so far it seems that the failures are only a result of run merges (and
still a few run splits). These do not affect the layout but sometimes slightly
affect rendering (due to rounding and such, I presume). In general, I suppose
long runs are better, but it's just a daunting task to verify that all 137
failures are benign. Otherwise, the part that's responsible for them can be
left out (it's the different handling of the L after EN case), and then there
are far fewer failures, all of which are splits.
Comment 7 mitz 2005-06-27 05:26:44 PDT
Attachment 2668 [details] to bug 3733 addresses this bug.
Comment 8 mitz 2005-07-06 06:10:07 PDT
Fixed along with bug 3733.