Bug 4862 - Incorrect layout of bidi overrides
Summary: Incorrect layout of bidi overrides
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 420+
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Dave Hyatt
Depends on:
Blocks: 4898
  Show dependency treegraph
Reported: 2005-09-06 00:01 PDT by mitz
Modified: 2005-09-24 10:52 PDT (History)
0 users

See Also:

testcase (1.53 KB, text/html)
2005-09-06 00:02 PDT, mitz
no flags Details
testcase (3.52 KB, text/html)
2005-09-06 06:41 PDT, mitz
no flags Details
patch for CG-rendered runs only (1.41 KB, patch)
2005-09-06 09:02 PDT, mitz
no flags Details | Formatted Diff | Diff
suggested patch (18.36 KB, patch)
2005-09-06 23:29 PDT, mitz
hyatt: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description mitz 2005-09-06 00:01:21 PDT
Summary: directional overrides, both in the form of unicode-bidi:bidi-override and in the form of Unicode 
directional overrides (LRO and RLO) are not handled properly, resulting in incorrect layout order.

To reproduce: open the testcase in Safari

Expected: all lines to be the same as the reference line. Firefox renders as expected.

Actual: in the CSS lines, "fed" and "ihg" appear instead of "def" and "ghi", and in the Unicode line, "fed" 
appears instead of "def". Similar problems on the Hebrew side.
Comment 1 mitz 2005-09-06 00:02:05 PDT
Created attachment 3778 [details]
Comment 2 mitz 2005-09-06 06:41:05 PDT
Created attachment 3784 [details]

Extended tescase
Comment 3 mitz 2005-09-06 09:02:06 PDT
Created attachment 3785 [details]
patch for CG-rendered runs only

This patches the run-levels side of things, which resolves the issue for all
text that subsequently gets rendered by the CG codepath. (This makes the
testcase render as expected only if you apply the patch for bug 4844 along with
this patch).

The problem with ATSUI is that it applies its own bidi algorithm and there is
no API to disable it, so I think the best option is to do something similar to
what is already done with visually-ordered text, which is to embed the run in a
LRO/RLO - PDF pair. I think this will also require adding to RenderText objects
knowledge of their override state.
Comment 4 mitz 2005-09-06 23:29:16 PDT
Created attachment 3792 [details]
suggested patch

Went ahead and added bidi override state to BidiRun and InlineTextBox for the
sole purpose of letting WebTextRenderer know that it has to force ATSUI to
render in visual or reverse-visual order.
Comment 5 Dave Hyatt 2005-09-07 02:32:57 PDT
Comment on attachment 3792 [details]
suggested patch

Looks good. r=me.