Bug 4862

Summary: Incorrect layout of bidi overrides
Product: WebKit Reporter: mitz
Component: Layout and RenderingAssignee: Dave Hyatt <hyatt>
Status: VERIFIED FIXED    
Severity: Normal    
Priority: P2    
Version: 420+   
Hardware: Mac   
OS: OS X 10.4   
Bug Depends on:    
Bug Blocks: 4898    
Attachments:
Description Flags
testcase
none
testcase
none
patch for CG-rendered runs only
none
suggested patch hyatt: review+

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]
testcase
Comment 2 mitz 2005-09-06 06:41:05 PDT
Created attachment 3784 [details]
testcase

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.