Changeset 24582 in webkit


Ignore:
Timestamp:
Jul 24, 2007 2:55:33 AM (17 years ago)
Author:
bdash
Message:

2007-07-24 Mitz Pettel <mitz@webkit.org>

Reviewed by Darin.

Test: fast/text/drawBidiText.html

  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • WebCoreSources.bkl:
  • manual-tests/chrome-bidi-text.html: Added.
  • manual-tests/resources/chrome-bidi-text-window.html: Added.
  • platform/BidiReorderCharacters.cpp: Removed.
  • platform/BidiReorderCharacters.h: Removed.
  • platform/BidiResolver.h: (WebCore::BidiCharacterRun::start): Added accessor method. (WebCore::BidiCharacterRun::stop): Ditto. (WebCore::BidiCharacterRun::level): Ditto. (WebCore::BidiCharacterRun::next): Ditto. (WebCore::::appendRun): Added default implementation.
  • platform/TextStyle.h: (WebCore::TextStyle::setDirectionalOverride): Added accessor method.
  • platform/graphics/GraphicsContext.cpp: (WebCore::TextRunIterator::TextRunIterator): Added. A BidiResolver- compliant iterator over the characters in a TextRun. (WebCore::TextRunIterator::offset): (WebCore::TextRunIterator::increment): (WebCore::TextRunIterator::atEnd): (WebCore::TextRunIterator::current): (WebCore::TextRunIterator::direction): (WebCore::TextRunIterator::operator==): (WebCore::TextRunIterator::operator!=): (WebCore::GraphicsContext::drawBidiText): Added. Applies the Unicode Bidi Algorithm to the text and draws the resulting unidirectional runs in the right order and with the right directionality.
  • platform/graphics/GraphicsContext.h:
  • platform/win/PopupMenuWin.cpp: (WebCore::PopupMenu::paint): Replaced the use of a character buffer and BidiReorderCharacters with calling to drawBidiText(). Removed special handling of '-webkit-rtl-ordering:visual' because that CSS property is an implementation detail of WebCore's visual Hebrew support, and the UA stylesheet sets it to 'logical' for this form control. Authors can specify the ordering using the 'direction' and 'unicode-bidi' properties.
  • platform/win/WebCoreTextRenderer.cpp: (WebCore::isOneLeftToRightRun): Added. Checks if the text consists of a single left-to-right run, in which case it requires no bidi processing. (WebCore::doDrawTextAtPoint): Changed to call drawBidiText if the text is not entirely left-to-right.
  • rendering/RenderFileUploadControl.cpp: (WebCore::RenderFileUploadControl::paintObject): Replaced the use of a character buffer in BidiReorderCharacters with calling to drawBidiText(). Removed special handling of '-webkit-rtl-ordering:visual' for the same reason stated above.
  • rendering/RenderListBox.cpp: (WebCore::RenderListBox::paintItemForeground): Ditto. Also changed the run-rounding modes used when drawing to match those used when measuring.

2007-07-24 Mitz Pettel <mitz@webkit.org>

Reviewed by Darin.

  • fast/forms/HTMLOptionElement_label05-expected.checksum:
  • fast/forms/HTMLOptionElement_label05-expected.png:
  • fast/forms/listbox-deselect-scroll-expected.checksum:
  • fast/forms/listbox-deselect-scroll-expected.png:
  • fast/forms/listbox-width-change-expected.checksum:
  • fast/forms/listbox-width-change-expected.png:
  • fast/forms/option-strip-whitespace-expected.checksum:
  • fast/forms/option-strip-whitespace-expected.png:
  • fast/forms/select-change-popup-to-listbox-expected.checksum:
  • fast/forms/select-change-popup-to-listbox-expected.png:
  • fast/forms/select-initial-position-expected.checksum:
  • fast/forms/select-initial-position-expected.png:
  • fast/text/drawBidiText-expected.checksum: Added.
  • fast/text/drawBidiText-expected.png: Added.
  • fast/text/drawBidiText-expected.txt: Added.
  • fast/text/drawBidiText.html: Added.
  • fast/text/international/bidi-listbox-atsui-expected.checksum:
  • fast/text/international/bidi-listbox-atsui-expected.png:
  • fast/text/international/bidi-listbox-atsui-expected.txt:
  • fast/text/international/bidi-listbox-atsui.html: Removed the visual ordering cases.
  • fast/text/international/bidi-listbox-expected.checksum:
  • fast/text/international/bidi-listbox-expected.png:
  • fast/text/international/bidi-listbox-expected.txt:
  • fast/text/international/bidi-listbox.html: Removed the visual ordering cases because the patch removed special handling of visual ordering.
Location:
trunk
Files:
6 added
2 deleted
34 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r24561 r24582  
     12007-07-24  Mitz Pettel  <mitz@webkit.org>
     2
     3        Reviewed by Darin.
     4
     5        - test, updated tests and updated results for
     6          http://bugs.webkit.org/show_bug.cgi?id=14684
     7          Hebrew text in Safari chrome is reversed (LTR instead of RTL)
     8
     9        * fast/forms/HTMLOptionElement_label05-expected.checksum:
     10        * fast/forms/HTMLOptionElement_label05-expected.png:
     11        * fast/forms/listbox-deselect-scroll-expected.checksum:
     12        * fast/forms/listbox-deselect-scroll-expected.png:
     13        * fast/forms/listbox-width-change-expected.checksum:
     14        * fast/forms/listbox-width-change-expected.png:
     15        * fast/forms/option-strip-whitespace-expected.checksum:
     16        * fast/forms/option-strip-whitespace-expected.png:
     17        * fast/forms/select-change-popup-to-listbox-expected.checksum:
     18        * fast/forms/select-change-popup-to-listbox-expected.png:
     19        * fast/forms/select-initial-position-expected.checksum:
     20        * fast/forms/select-initial-position-expected.png:
     21        * fast/text/drawBidiText-expected.checksum: Added.
     22        * fast/text/drawBidiText-expected.png: Added.
     23        * fast/text/drawBidiText-expected.txt: Added.
     24        * fast/text/drawBidiText.html: Added.
     25        * fast/text/international/bidi-listbox-atsui-expected.checksum:
     26        * fast/text/international/bidi-listbox-atsui-expected.png:
     27        * fast/text/international/bidi-listbox-atsui-expected.txt:
     28        * fast/text/international/bidi-listbox-atsui.html: Removed the
     29        visual ordering cases.
     30        * fast/text/international/bidi-listbox-expected.checksum:
     31        * fast/text/international/bidi-listbox-expected.png:
     32        * fast/text/international/bidi-listbox-expected.txt:
     33        * fast/text/international/bidi-listbox.html: Removed the visual ordering
     34        cases because the patch removed special handling of visual ordering.
     35
    1362007-07-23  Justin Garcia  <justin.garcia@apple.com>
    237
  • trunk/LayoutTests/fast/forms/HTMLOptionElement_label05-expected.checksum

    r19001 r24582  
    1 d1d9d9a9a6ffd3798ba2b3e76d96fea9
     1b3b5818c4f83fcf1f2a8bf403f922e1d
  • trunk/LayoutTests/fast/forms/listbox-deselect-scroll-expected.checksum

    r19520 r24582  
    1 d862b7a67fd414a09bf1acc2661db300
     1f1c4493b9e56621a4202423c6f31e709
  • trunk/LayoutTests/fast/forms/listbox-width-change-expected.checksum

    r19001 r24582  
    1 dbbd628b7e1e30ab6834eae5f26d9246
     17fb56f5841a1b75f536d5877ff766db1
  • trunk/LayoutTests/fast/forms/option-strip-whitespace-expected.checksum

    r19001 r24582  
    1 3f629d2f9fe347280e7fb281b1a89549
     122159b81d176cc343e4b70252dad904d
  • trunk/LayoutTests/fast/forms/select-change-popup-to-listbox-expected.checksum

    r19001 r24582  
    1 d9f6db46ccb5fa290329a4ffb1889c7b
     1cb14923e00f31b642c7dc43fd88b68a0
  • trunk/LayoutTests/fast/forms/select-initial-position-expected.checksum

    r19797 r24582  
    1 7099cf6855580900bbcd91ca42a80a0f
     1e6bf209c781a5b2ff9fe16b3a46dbefb
  • trunk/LayoutTests/fast/text/international/bidi-listbox-atsui-expected.checksum

    r19414 r24582  
    1 9d0c98dc78689c102f86a3ef5a40c5a3
     14a503c6c334e3e2176c07e83858385f7
  • trunk/LayoutTests/fast/text/international/bidi-listbox-atsui-expected.txt

    r19414 r24582  
    1 layer at (0,0) size 785x643
    2   RenderView at (0,0) size 785x600
    3 layer at (0,0) size 785x643
    4   RenderBlock {HTML} at (0,0) size 785x643
    5     RenderBody {BODY} at (8,8) size 769x627
    6       RenderBlock {P} at (0,0) size 769x36
     1layer at (0,0) size 800x600
     2  RenderView at (0,0) size 800x600
     3layer at (0,0) size 800x600
     4  RenderBlock {HTML} at (0,0) size 800x600
     5    RenderBody {BODY} at (8,8) size 784x584
     6      RenderBlock {P} at (0,0) size 784x36
    77        RenderText {#text} at (0,0) size 580x18
    88          text run at (0,0) width 580: "This tests that bidirectional text is correctly rendered when using ATSUI in list box controls."
     
    1010        RenderText {#text} at (0,18) size 566x18
    1111          text run at (0,18) width 566: "The order of the text below each list box should match the order of the select's option text."
    12       RenderBlock (anonymous) at (0,52) size 769x79
    13         RenderText {#text} at (0,0) size 270x18
    14           text run at (0,0) width 270: "1) direction: rtl; -webkit-rtl-ordering: visual"
    15         RenderBR {BR} at (270,14) size 0x0
     12      RenderBlock (anonymous) at (0,52) size 784x79
     13        RenderText {#text} at (0,0) size 97x18
     14          text run at (0,0) width 97: "1) direction: rtl;"
     15        RenderBR {BR} at (97,14) size 0x0
    1616        RenderListBox {SELECT} at (2,20) size 77x57 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
    1717        RenderBR {BR} at (81,72) size 0x0
    1818      RenderBlock {DIV} at (0,131) size 100x18
    1919        RenderText {#text} at (18,0) size 82x18
    20           text run at (18,0) width 22 LTR override: "a\x{300}bc"
    21           text run at (40,0) width 60 LTR override: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
    22       RenderBlock (anonymous) at (0,149) size 769x97
     20          text run at (18,0) width 60 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
     21          text run at (78,0) width 22: "a\x{300}bc"
     22      RenderBlock (anonymous) at (0,149) size 784x97
    2323        RenderBR {BR} at (0,0) size 0x18
    24         RenderText {#text} at (0,18) size 275x18
    25           text run at (0,18) width 275: "2) direction: rtl; -webkit-rtl-ordering: logical"
    26         RenderBR {BR} at (275,32) size 0x0
     24        RenderText {#text} at (0,18) size 97x18
     25          text run at (0,18) width 97: "2) direction: ltr;"
     26        RenderBR {BR} at (97,32) size 0x0
    2727        RenderListBox {SELECT} at (2,38) size 77x57 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
    2828        RenderBR {BR} at (81,90) size 0x0
    2929      RenderBlock {DIV} at (0,246) size 100x18
    30         RenderText {#text} at (18,0) size 82x18
    31           text run at (18,0) width 60 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
    32           text run at (78,0) width 22: "a\x{300}bc"
    33       RenderBlock (anonymous) at (0,264) size 769x97
     30        RenderText {#text} at (0,0) size 82x18
     31          text run at (0,0) width 22: "a\x{300}bc"
     32          text run at (22,0) width 60 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
     33      RenderBlock (anonymous) at (0,264) size 784x97
    3434        RenderBR {BR} at (0,0) size 0x18
    35         RenderText {#text} at (0,18) size 270x18
    36           text run at (0,18) width 270: "3) direction: ltr; -webkit-rtl-ordering: visual"
    37         RenderBR {BR} at (270,32) size 0x0
     35        RenderText {#text} at (0,18) size 70x18
     36          text run at (0,18) width 70: "3) No style"
     37        RenderBR {BR} at (70,32) size 0x0
    3838        RenderListBox {SELECT} at (2,38) size 77x57 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
    3939        RenderBR {BR} at (81,90) size 0x0
    4040      RenderBlock {DIV} at (0,361) size 100x18
    4141        RenderText {#text} at (0,0) size 82x18
    42           text run at (0,0) width 22 LTR override: "a\x{300}bc"
    43           text run at (22,0) width 60 LTR override: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
    44       RenderBlock (anonymous) at (0,379) size 769x97
    45         RenderBR {BR} at (0,0) size 0x18
    46         RenderText {#text} at (0,18) size 275x18
    47           text run at (0,18) width 275: "4) direction: ltr; -webkit-rtl-ordering: logical"
    48         RenderBR {BR} at (275,32) size 0x0
    49         RenderListBox {SELECT} at (2,38) size 77x57 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
    50         RenderBR {BR} at (81,90) size 0x0
    51       RenderBlock {DIV} at (0,476) size 100x18
    52         RenderText {#text} at (0,0) size 82x18
    5342          text run at (0,0) width 22: "a\x{300}bc"
    5443          text run at (22,0) width 60 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
    55       RenderBlock (anonymous) at (0,494) size 769x97
     44      RenderBlock (anonymous) at (0,379) size 784x18
    5645        RenderBR {BR} at (0,0) size 0x18
    57         RenderText {#text} at (0,18) size 70x18
    58           text run at (0,18) width 70: "5) No style"
    59         RenderBR {BR} at (70,32) size 0x0
    60         RenderListBox {SELECT} at (2,38) size 77x57 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
    61         RenderBR {BR} at (81,90) size 0x0
    62       RenderBlock {DIV} at (0,591) size 100x18
    63         RenderText {#text} at (0,0) size 82x18
    64           text run at (0,0) width 22: "a\x{300}bc"
    65           text run at (22,0) width 60 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
    66       RenderBlock (anonymous) at (0,609) size 769x18
    67         RenderBR {BR} at (0,0) size 0x18
  • trunk/LayoutTests/fast/text/international/bidi-listbox-atsui.html

    r19414 r24582  
    11<style>
    2 .bidi1 {
    3     direction: rtl;
    4     -webkit-rtl-ordering: visual;
    5     max-width: 100px;
    6 }
    72.bidi2 {
    83    direction: rtl;
    94    -webkit-rtl-ordering: logical;
    10     max-width: 100px;
    11 }
    12 .bidi3 {
    13     direction: ltr;
    14     -webkit-rtl-ordering: visual;
    155    max-width: 100px;
    166}
     
    2919The order of the text below each list box should match the order of the select's option text.
    3020</p>
    31     1) direction: rtl; -webkit-rtl-ordering: visual<br>
    32 <select size="2" class="bidi1"><option>a&#x0300;bc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</option></select><br>
    33 <div class="bidi1">a&#x0300;bc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</div><br>
    34     2) direction: rtl; -webkit-rtl-ordering: logical<br>
     21    1) direction: rtl;<br>
    3522<select size="2" class="bidi2"><option>a&#x0300;bc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</option></select><br>
    3623<div class="bidi2">a&#x0300;bc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</div><br>
    37     3) direction: ltr; -webkit-rtl-ordering: visual<br>
    38 <select size="2" class="bidi3"><option>a&#x0300;bc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</option></select><br>
    39 <div class="bidi3">a&#x0300;bc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</div><br>
    40     4) direction: ltr; -webkit-rtl-ordering: logical<br>
     24    2) direction: ltr;<br>
    4125<select size="2" class="bidi4"><option>a&#x0300;bc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</option></select><br>
    4226<div class="bidi4">a&#x0300;bc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</div><br>
    43     5) No style<br>
     27    3) No style<br>
    4428<select size="2" class="bidi5"><option>a&#x0300;bc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</option></select><br>
    4529<div class="bidi5">a&#x0300;bc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</div><br>
  • trunk/LayoutTests/fast/text/international/bidi-listbox-expected.checksum

    r19414 r24582  
    1 730279a3f2d7c4636181ceb9e56c4c9b
     189922a6c1b914696729536e391047e8b
  • trunk/LayoutTests/fast/text/international/bidi-listbox-expected.txt

    r19414 r24582  
    1 layer at (0,0) size 785x643
    2   RenderView at (0,0) size 785x600
    3 layer at (0,0) size 785x643
    4   RenderBlock {HTML} at (0,0) size 785x643
    5     RenderBody {BODY} at (8,8) size 769x627
    6       RenderBlock {P} at (0,0) size 769x36
     1layer at (0,0) size 800x600
     2  RenderView at (0,0) size 800x600
     3layer at (0,0) size 800x600
     4  RenderBlock {HTML} at (0,0) size 800x600
     5    RenderBody {BODY} at (8,8) size 784x584
     6      RenderBlock {P} at (0,0) size 784x36
    77        RenderText {#text} at (0,0) size 451x18
    88          text run at (0,0) width 451: "This tests that bidirectional text is correctly rendered in list box controls."
     
    1010        RenderText {#text} at (0,18) size 566x18
    1111          text run at (0,18) width 566: "The order of the text below each list box should match the order of the select's option text."
    12       RenderBlock (anonymous) at (0,52) size 769x79
    13         RenderText {#text} at (0,0) size 270x18
    14           text run at (0,0) width 270: "1) direction: rtl; -webkit-rtl-ordering: visual"
    15         RenderBR {BR} at (270,14) size 0x0
     12      RenderBlock (anonymous) at (0,52) size 784x79
     13        RenderText {#text} at (0,0) size 97x18
     14          text run at (0,0) width 97: "1) direction: rtl;"
     15        RenderBR {BR} at (97,14) size 0x0
    1616        RenderListBox {SELECT} at (2,20) size 77x57 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
    1717        RenderBR {BR} at (81,72) size 0x0
    1818      RenderBlock {DIV} at (0,131) size 100x18
    1919        RenderText {#text} at (18,0) size 82x18
    20           text run at (18,0) width 22 LTR override: "abc"
    21           text run at (40,0) width 60 LTR override: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
    22       RenderBlock (anonymous) at (0,149) size 769x97
     20          text run at (18,0) width 60 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
     21          text run at (78,0) width 22: "abc"
     22      RenderBlock (anonymous) at (0,149) size 784x97
    2323        RenderBR {BR} at (0,0) size 0x18
    24         RenderText {#text} at (0,18) size 275x18
    25           text run at (0,18) width 275: "2) direction: rtl; -webkit-rtl-ordering: logical"
    26         RenderBR {BR} at (275,32) size 0x0
     24        RenderText {#text} at (0,18) size 97x18
     25          text run at (0,18) width 97: "2) direction: ltr;"
     26        RenderBR {BR} at (97,32) size 0x0
    2727        RenderListBox {SELECT} at (2,38) size 77x57 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
    2828        RenderBR {BR} at (81,90) size 0x0
    2929      RenderBlock {DIV} at (0,246) size 100x18
    30         RenderText {#text} at (18,0) size 82x18
    31           text run at (18,0) width 60 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
    32           text run at (78,0) width 22: "abc"
    33       RenderBlock (anonymous) at (0,264) size 769x97
     30        RenderText {#text} at (0,0) size 82x18
     31          text run at (0,0) width 22: "abc"
     32          text run at (22,0) width 60 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
     33      RenderBlock (anonymous) at (0,264) size 784x97
    3434        RenderBR {BR} at (0,0) size 0x18
    35         RenderText {#text} at (0,18) size 270x18
    36           text run at (0,18) width 270: "3) direction: ltr; -webkit-rtl-ordering: visual"
    37         RenderBR {BR} at (270,32) size 0x0
     35        RenderText {#text} at (0,18) size 70x18
     36          text run at (0,18) width 70: "3) No style"
     37        RenderBR {BR} at (70,32) size 0x0
    3838        RenderListBox {SELECT} at (2,38) size 77x57 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
    3939        RenderBR {BR} at (81,90) size 0x0
    4040      RenderBlock {DIV} at (0,361) size 100x18
    4141        RenderText {#text} at (0,0) size 82x18
    42           text run at (0,0) width 22 LTR override: "abc"
    43           text run at (22,0) width 60 LTR override: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
    44       RenderBlock (anonymous) at (0,379) size 769x97
    45         RenderBR {BR} at (0,0) size 0x18
    46         RenderText {#text} at (0,18) size 275x18
    47           text run at (0,18) width 275: "4) direction: ltr; -webkit-rtl-ordering: logical"
    48         RenderBR {BR} at (275,32) size 0x0
    49         RenderListBox {SELECT} at (2,38) size 77x57 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
    50         RenderBR {BR} at (81,90) size 0x0
    51       RenderBlock {DIV} at (0,476) size 100x18
    52         RenderText {#text} at (0,0) size 82x18
    5342          text run at (0,0) width 22: "abc"
    5443          text run at (22,0) width 60 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
    55       RenderBlock (anonymous) at (0,494) size 769x97
     44      RenderBlock (anonymous) at (0,379) size 784x18
    5645        RenderBR {BR} at (0,0) size 0x18
    57         RenderText {#text} at (0,18) size 70x18
    58           text run at (0,18) width 70: "5) No style"
    59         RenderBR {BR} at (70,32) size 0x0
    60         RenderListBox {SELECT} at (2,38) size 77x57 [bgcolor=#FFFFFF] [border: (1px inset #808080)]
    61         RenderBR {BR} at (81,90) size 0x0
    62       RenderBlock {DIV} at (0,591) size 100x18
    63         RenderText {#text} at (0,0) size 82x18
    64           text run at (0,0) width 22: "abc"
    65           text run at (22,0) width 60 RTL: "\x{5D0}\x{5E4}\x{5E8}\x{5E1}\x{5DE}\x{5D5}\x{5DF}"
    66       RenderBlock (anonymous) at (0,609) size 769x18
    67         RenderBR {BR} at (0,0) size 0x18
  • trunk/LayoutTests/fast/text/international/bidi-listbox.html

    r19414 r24582  
    11<style>
    2 .bidi1 {
    3     direction: rtl;
    4     -webkit-rtl-ordering: visual;
    5     max-width: 100px;
    6 }
    72.bidi2 {
    83    direction: rtl;
    94    -webkit-rtl-ordering: logical;
    10     max-width: 100px;
    11 }
    12 .bidi3 {
    13     direction: ltr;
    14     -webkit-rtl-ordering: visual;
    155    max-width: 100px;
    166}
     
    2919The order of the text below each list box should match the order of the select's option text.
    3020</p>
    31     1) direction: rtl; -webkit-rtl-ordering: visual<br>
    32 <select size="2" class="bidi1"><option>abc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</option></select><br>
    33 <div class="bidi1">abc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</div><br>
    34     2) direction: rtl; -webkit-rtl-ordering: logical<br>
     21    1) direction: rtl;<br>
    3522<select size="2" class="bidi2"><option>abc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</option></select><br>
    3623<div class="bidi2">abc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</div><br>
    37     3) direction: ltr; -webkit-rtl-ordering: visual<br>
    38 <select size="2" class="bidi3"><option>abc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</option></select><br>
    39 <div class="bidi3">abc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</div><br>
    40     4) direction: ltr; -webkit-rtl-ordering: logical<br>
     24    2) direction: ltr;<br>
    4125<select size="2" class="bidi4"><option>abc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</option></select><br>
    4226<div class="bidi4">abc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</div><br>
    43     5) No style<br>
     27    3) No style<br>
    4428<select size="2" class="bidi5"><option>abc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</option></select><br>
    4529<div class="bidi5">abc&#x05d0;&#x05e4;&#x05e8;&#x05e1;&#x05de;&#x05d5;&#x05df;</div><br>
  • trunk/WebCore/ChangeLog

    r24564 r24582  
     12007-07-24  Mitz Pettel  <mitz@webkit.org>
     2
     3        Reviewed by Darin.
     4
     5        - fix http://bugs.webkit.org/show_bug.cgi?id=14684
     6          Hebrew text in Safari chrome is reversed (LTR instead of RTL)
     7
     8        Test: fast/text/drawBidiText.html
     9
     10        * WebCore.pro:
     11        * WebCore.vcproj/WebCore.vcproj:
     12        * WebCore.xcodeproj/project.pbxproj:
     13        * WebCoreSources.bkl:
     14        * manual-tests/chrome-bidi-text.html: Added.
     15        * manual-tests/resources/chrome-bidi-text-window.html: Added.
     16        * platform/BidiReorderCharacters.cpp: Removed.
     17        * platform/BidiReorderCharacters.h: Removed.
     18        * platform/BidiResolver.h:
     19        (WebCore::BidiCharacterRun::start): Added accessor method.
     20        (WebCore::BidiCharacterRun::stop): Ditto.
     21        (WebCore::BidiCharacterRun::level): Ditto.
     22        (WebCore::BidiCharacterRun::next): Ditto.
     23        (WebCore::::appendRun): Added default implementation.
     24        * platform/TextStyle.h:
     25        (WebCore::TextStyle::setDirectionalOverride): Added accessor method.
     26        * platform/graphics/GraphicsContext.cpp:
     27        (WebCore::TextRunIterator::TextRunIterator): Added. A BidiResolver-
     28        compliant iterator over the characters in a TextRun.
     29        (WebCore::TextRunIterator::offset):
     30        (WebCore::TextRunIterator::increment):
     31        (WebCore::TextRunIterator::atEnd):
     32        (WebCore::TextRunIterator::current):
     33        (WebCore::TextRunIterator::direction):
     34        (WebCore::TextRunIterator::operator==):
     35        (WebCore::TextRunIterator::operator!=):
     36        (WebCore::GraphicsContext::drawBidiText): Added. Applies the Unicode
     37        Bidi Algorithm to the text and draws the resulting unidirectional runs
     38        in the right order and with the right directionality.
     39        * platform/graphics/GraphicsContext.h:
     40        * platform/win/PopupMenuWin.cpp:
     41        (WebCore::PopupMenu::paint): Replaced the use of a character buffer
     42        and BidiReorderCharacters with calling to drawBidiText(). Removed special
     43        handling of '-webkit-rtl-ordering:visual' because that CSS property is an
     44        implementation detail of WebCore's visual Hebrew support, and the UA stylesheet
     45        sets it to 'logical' for this form control. Authors can specify the ordering
     46        using the 'direction' and 'unicode-bidi' properties.
     47        * platform/win/WebCoreTextRenderer.cpp:
     48        (WebCore::isOneLeftToRightRun): Added. Checks if the text consists of
     49        a single left-to-right run, in which case it requires no bidi processing.
     50        (WebCore::doDrawTextAtPoint): Changed to call drawBidiText if the text
     51        is not entirely left-to-right.
     52        * rendering/RenderFileUploadControl.cpp:
     53        (WebCore::RenderFileUploadControl::paintObject): Replaced the use of a
     54        character buffer in BidiReorderCharacters with calling to drawBidiText().
     55        Removed special handling of '-webkit-rtl-ordering:visual' for the same reason
     56        stated above.
     57        * rendering/RenderListBox.cpp:
     58        (WebCore::RenderListBox::paintItemForeground): Ditto. Also changed the
     59        run-rounding modes used when drawing to match those used when measuring.
     60
    1612007-07-23  Oliver Hunt  <oliver@apple.com>
    262
  • trunk/WebCore/WebCore.pro

    r24537 r24582  
    591591    platform/Base64.cpp \
    592592    platform/BidiContext.cpp \
    593     platform/BidiReorderCharacters.cpp \
    594593    platform/ContextMenu.cpp \
    595594    platform/CString.cpp \
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r24493 r24582  
    28962896                        <File
    28972897                                RelativePath="..\platform\BidiContext.h"
    2898                                 >
    2899                         </File>
    2900                         <File
    2901                                 RelativePath="..\platform\BidiReorderCharacters.cpp"
    2902                                 >
    2903                         </File>
    2904                         <File
    2905                                 RelativePath="..\platform\BidiReorderCharacters.h"
    29062898                                >
    29072899                        </File>
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r24541 r24582  
    27282728                B2FA3E180AB75A6F000E5AC4 /* JSSVGZoomEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2FA3D300AB75A6F000E5AC4 /* JSSVGZoomEvent.cpp */; };
    27292729                B2FA3E190AB75A6F000E5AC4 /* JSSVGZoomEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = B2FA3D310AB75A6F000E5AC4 /* JSSVGZoomEvent.h */; };
    2730                 B402007C0C4D217800210AA6 /* BidiReorderCharacters.h in Headers */ = {isa = PBXBuildFile; fileRef = B402007A0C4D217800210AA6 /* BidiReorderCharacters.h */; };
    2731                 B402007D0C4D217800210AA6 /* BidiReorderCharacters.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B402007B0C4D217800210AA6 /* BidiReorderCharacters.cpp */; };
    27322730                B402FD0B0C4C9C3900210AA6 /* BidiResolver.h in Headers */ = {isa = PBXBuildFile; fileRef = B402FD090C4C9C3900210AA6 /* BidiResolver.h */; settings = {ATTRIBUTES = (Private, ); }; };
    27332731                BC066F6F09FEB2FA00C589A7 /* WebCoreTextRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = BC066F6C09FEB2FA00C589A7 /* WebCoreTextRenderer.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    60596057                B2FA3D300AB75A6F000E5AC4 /* JSSVGZoomEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGZoomEvent.cpp; sourceTree = "<group>"; };
    60606058                B2FA3D310AB75A6F000E5AC4 /* JSSVGZoomEvent.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = JSSVGZoomEvent.h; sourceTree = "<group>"; };
    6061                 B402007A0C4D217800210AA6 /* BidiReorderCharacters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BidiReorderCharacters.h; sourceTree = "<group>"; };
    6062                 B402007B0C4D217800210AA6 /* BidiReorderCharacters.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BidiReorderCharacters.cpp; sourceTree = "<group>"; };
    60636059                B402FD090C4C9C3900210AA6 /* BidiResolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BidiResolver.h; sourceTree = "<group>"; };
    60646060                BC066F6C09FEB2FA00C589A7 /* WebCoreTextRenderer.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreTextRenderer.h; sourceTree = "<group>"; };
     
    95269522                                514AF320BE854014A7DA49FB /* BidiContext.h */,
    95279523                                A579C284B928484FB9A446BC /* BidiContext.cpp */,
    9528                                 B402007A0C4D217800210AA6 /* BidiReorderCharacters.h */,
    9529                                 B402007B0C4D217800210AA6 /* BidiReorderCharacters.cpp */,
    95309524                                B402FD090C4C9C3900210AA6 /* BidiResolver.h */,
    95319525                                65F5382009B2B55700F3DC4A /* character-sets.txt */,
     
    1170211696                                BC772C4F0C4EB3040083285F /* MIMETypeRegistry.h in Headers */,
    1170311697                                B402FD0B0C4C9C3900210AA6 /* BidiResolver.h in Headers */,
    11704                                 B402007C0C4D217800210AA6 /* BidiReorderCharacters.h in Headers */,
    1170511698                                0F31CBF92B654730BA0535E8 /* BidiContext.h in Headers */,
    1170611699                                1432E8470C51493800B1500F /* GCController.h in Headers */,
     
    1314313136                                BC772C5E0C4EB3440083285F /* MIMETypeRegistryMac.mm in Sources */,
    1314413137                                F971E27FD70F4382BC66D792 /* BidiContext.cpp in Sources */,
    13145                                 B402007D0C4D217800210AA6 /* BidiReorderCharacters.cpp in Sources */,
    1314613138                                1432E8490C51493F00B1500F /* GCController.cpp in Sources */,
    1314713139                        );
  • trunk/WebCore/WebCoreSources.bkl

    r24493 r24582  
    164164        platform/Base64.cpp
    165165        platform/BidiContext.cpp
    166         platform/BidiReorderCharacters.cpp
    167166        platform/CString.cpp
    168167        platform/ContextMenu.cpp
  • trunk/WebCore/platform/BidiResolver.h

    r24485 r24582  
    8787    }
    8888
     89    int start() const { return m_start; }
     90    int stop() const { return m_stop; }
     91    unsigned char level() const { return m_level; }
    8992    bool reversed(bool visuallyOrdered) { return m_level % 2 && !visuallyOrdered; }
    9093    bool dirOverride(bool visuallyOrdered) { return m_override || visuallyOrdered; }
    9194
    92     BidiCharacterRun* next() { return m_next; }
     95    BidiCharacterRun* next() const { return m_next; }
    9396
    9497    unsigned char m_level;
     
    158161    int m_runCount;
    159162};
     163
     164template <class Iterator, class Run>
     165void BidiResolver<Iterator, Run>::appendRun()
     166{
     167    if (emptyRun || eor.atEnd())
     168        return;
     169
     170    Run* bidiRun = new Run(sor.offset(), eor.offset() + 1, context(), m_direction);
     171    if (!m_firstRun)
     172        m_firstRun = bidiRun;
     173    else
     174        m_lastRun->m_next = bidiRun;
     175    m_lastRun = bidiRun;
     176    m_runCount++;
     177
     178    eor.increment(*this);
     179    sor = eor;
     180    m_direction = WTF::Unicode::OtherNeutral;
     181    m_status.eor = WTF::Unicode::OtherNeutral;
     182}
    160183
    161184template <class Iterator, class Run>
  • trunk/WebCore/platform/TextStyle.h

    r20610 r24582  
    5151    void disableRoundingHacks() { m_applyRunRounding = m_applyWordRounding = false; }
    5252    void setRTL(bool b) { m_rtl = b; }
     53    void setDirectionalOverride(bool override) { m_directionalOverride = override; }
    5354   
    5455private:
  • trunk/WebCore/platform/graphics/GraphicsContext.cpp

    r21601 r24582  
    2727#include "GraphicsContext.h"
    2828
     29#include "BidiResolver.h"
    2930#include "Font.h"
    3031#include "TextStyle.h"
     
    3334
    3435namespace WebCore {
     36
     37class TextRunIterator {
     38public:
     39    TextRunIterator()
     40        : m_textRun(0)
     41        , m_offset(0)
     42    {
     43    }
     44
     45    TextRunIterator(const TextRun* textRun, unsigned offset)
     46        : m_textRun(textRun)
     47        , m_offset(offset)
     48    {
     49    }
     50
     51    TextRunIterator(const TextRunIterator& other)
     52        : m_textRun(other.m_textRun)
     53        , m_offset(other.m_offset)
     54    {
     55    }
     56
     57    unsigned offset() const { return m_offset; }
     58    void increment(BidiResolver<TextRunIterator, BidiCharacterRun>&) { m_offset++; }
     59    bool atEnd() const { return m_offset >= m_textRun->length(); }
     60    UChar current() const { return (*m_textRun)[m_offset]; }
     61    WTF::Unicode::Direction direction() const { return atEnd() ? WTF::Unicode::OtherNeutral : WTF::Unicode::direction(current()); }
     62
     63    bool operator==(const TextRunIterator& other)
     64    {
     65        return m_offset == other.m_offset && m_textRun == other.m_textRun;
     66    }
     67
     68    bool operator!=(const TextRunIterator& other) { return !operator==(other); }
     69
     70private:
     71    const TextRun* m_textRun;
     72    int m_offset;
     73};
    3574
    3675struct GraphicsContextState {
     
    216255}
    217256
     257void GraphicsContext::drawBidiText(const TextRun& run, const IntPoint& point, const TextStyle& style)
     258{
     259    if (paintingDisabled())
     260        return;
     261
     262    BidiResolver<TextRunIterator, BidiCharacterRun> bidiResolver;
     263    WTF::Unicode::Direction paragraphDirection = style.ltr() ? WTF::Unicode::LeftToRight : WTF::Unicode::RightToLeft;
     264
     265    bidiResolver.setStatus(BidiStatus(paragraphDirection, paragraphDirection, paragraphDirection, new BidiContext(style.ltr() ? 0 : 1, paragraphDirection, style.directionalOverride())));
     266
     267    bidiResolver.createBidiRunsForLine(TextRunIterator(&run, 0), TextRunIterator(&run, run.length()));
     268
     269    if (!bidiResolver.runCount())
     270        return;
     271
     272    FloatPoint currPoint = point;
     273    BidiCharacterRun* bidiRun = bidiResolver.firstRun();
     274    while (bidiRun) {
     275        TextStyle subrunStyle(style);
     276        subrunStyle.setRTL(bidiRun->level() % 2);
     277        subrunStyle.setDirectionalOverride(bidiRun->dirOverride(false));
     278
     279        TextRun subrun(run.data(bidiRun->start()), bidiRun->stop() - bidiRun->start());
     280
     281        font().drawText(this, subrun, subrunStyle, currPoint);
     282
     283        bidiRun = bidiRun->next();
     284        // FIXME: Have Font::drawText return the width of what it drew so that we don't have to re-measure here.
     285        if (bidiRun)
     286            currPoint.move(font().floatWidth(subrun, subrunStyle), 0.f);
     287    }
     288
     289    bidiResolver.deleteRuns();
     290}
     291
    218292void GraphicsContext::drawHighlightForText(const TextRun& run, const IntPoint& point, int h, const TextStyle& style, const Color& backgroundColor, int from, int to)
    219293{
  • trunk/WebCore/platform/graphics/GraphicsContext.h

    r24322 r24582  
    148148        void drawText(const TextRun&, const IntPoint&, int from = 0, int to = -1);
    149149        void drawText(const TextRun&, const IntPoint&, const TextStyle&, int from = 0, int to = -1);
     150        void drawBidiText(const TextRun&, const IntPoint&, const TextStyle&);
    150151        void drawHighlightForText(const TextRun&, const IntPoint&, int h, const TextStyle&, const Color& backgroundColor, int from = 0, int to = -1);
    151152
  • trunk/WebCore/platform/win/PopupMenuWin.cpp

    r24485 r24582  
    2222#include "PopupMenu.h"
    2323
    24 #include "BidiReorderCharacters.h"
    2524#include "Document.h"
    2625#include "FloatRect.h"
     
    493492        unsigned length = itemText.length();
    494493        const UChar* string = itemText.characters();
    495         TextStyle textStyle(0, 0, 0, false, true);
    496         CharacterBuffer characterBuffer;
    497 
    498         if (clientStyle->direction() == RTL && clientStyle->unicodeBidi() == Override)
    499             textStyle.setRTL(true);
    500         else if ((clientStyle->direction() == RTL || clientStyle->unicodeBidi() != Override) && !clientStyle->visuallyOrdered()) {
    501             // If necessary, reorder characters by running the string through the bidi algorithm
    502             characterBuffer.append(string, length);
    503             bidiReorderCharacters(characterBuffer, clientStyle->direction() == RTL, clientStyle->unicodeBidi() == Override, clientStyle->visuallyOrdered());
    504             string = characterBuffer.data();
    505         }
     494        TextStyle textStyle(0, 0, 0, clientStyle->direction() == RTL, clientStyle->unicodeBidi() == Override);
    506495        TextRun textRun(string, length);
    507496
     
    521510            int textX = client()->clientPaddingLeft();
    522511            int textY = itemRect.y() + itemFont.ascent() + (itemRect.height() - itemFont.height()) / 2;
    523             context.drawText(textRun, IntPoint(textX, textY), textStyle);
     512            context.drawBidiText(textRun, IntPoint(textX, textY), textStyle);
    524513        }
    525514    }
  • trunk/WebCore/platform/win/WebCoreTextRenderer.cpp

    r23877 r24582  
    3131#include "StringTruncator.h"
    3232#include "TextStyle.h"
     33#include <wtf/unicode/Unicode.h>
    3334
    3435namespace WebCore {
     36
     37static bool isOneLeftToRightRun(const TextRun& run)
     38{
     39    unsigned i;
     40    for (i = 0; i < run.length(); i++) {
     41        WTF::Unicode::Direction direction = WTF::Unicode::direction(run[i]);
     42        if (direction == WTF::Unicode::RightToLeft || direction > WTF::Unicode::OtherNeutral)
     43            return false;
     44    }
     45    return true;
     46}
    3547
    3648static void doDrawTextAtPoint(GraphicsContext& context, const String& text, const IntPoint& point, const Font& font, const Color& color, int underlinedIndex)
     
    4052
    4153    context.setFillColor(color);
    42     font.drawText(&context, run, style, point);
     54    if (isOneLeftToRightRun(run))
     55        font.drawText(&context, run, style, point);
     56    else {
     57        context.setFont(font);
     58        context.drawBidiText(run, point, style);
     59    }
    4360
    4461    if (underlinedIndex >= 0) {
  • trunk/WebCore/rendering/RenderFileUploadControl.cpp

    r24485 r24582  
    2222#include "RenderFileUploadControl.h"
    2323
    24 #include "BidiReorderCharacters.h"
    2524#include "FrameView.h"
    2625#include "GraphicsContext.h"
     
    178177        unsigned length = displayedFilename.length();
    179178        const UChar* string = displayedFilename.characters();
    180         TextStyle textStyle(0, 0, 0, false, true);
    181         CharacterBuffer characterBuffer;
    182 
    183         if (style()->direction() == RTL && style()->unicodeBidi() == Override)
    184             textStyle.setRTL(true);
    185         else if ((style()->direction() == RTL || style()->unicodeBidi() != Override) && !style()->visuallyOrdered()) {
    186             // If necessary, reorder characters by running the string through the bidi algorithm
    187             characterBuffer.append(string, length);
    188             bidiReorderCharacters(characterBuffer, style()->direction() == RTL, style()->unicodeBidi() == Override, style()->visuallyOrdered());
    189             string = characterBuffer.data();
    190         }
     179        TextStyle textStyle(0, 0, 0, style()->direction() == RTL, style()->unicodeBidi() == Override);
    191180        TextRun textRun(string, length);
    192181       
     
    210199       
    211200        // Draw the filename
    212         paintInfo.context->drawText(textRun, IntPoint(textX, textY), textStyle);
     201        paintInfo.context->drawBidiText(textRun, IntPoint(textX, textY), textStyle);
    213202       
    214203        if (m_fileChooser->icon()) {
  • trunk/WebCore/rendering/RenderListBox.cpp

    r24485 r24582  
    3232#include "RenderListBox.h"
    3333
    34 #include "BidiReorderCharacters.h"
    3534#include "Document.h"
    3635#include "EventHandler.h"
     
    332331    unsigned length = itemText.length();
    333332    const UChar* string = itemText.characters();
    334     TextStyle textStyle(0, 0, 0, false, true);
    335     CharacterBuffer characterBuffer;
    336 
    337     if (itemStyle->direction() == RTL && itemStyle->unicodeBidi() == Override)
    338         textStyle.setRTL(true);
    339     else if ((itemStyle->direction() == RTL || itemStyle->unicodeBidi() != Override) && !itemStyle->visuallyOrdered()) {
    340         // If necessary, reorder characters by running the string through the bidi algorithm
    341         characterBuffer.append(string, length);
    342         bidiReorderCharacters(characterBuffer, itemStyle->direction() == RTL, itemStyle->unicodeBidi() == Override, itemStyle->visuallyOrdered());
    343         string = characterBuffer.data();
    344     }
     333    TextStyle textStyle(0, 0, 0, itemStyle->direction() == RTL, itemStyle->unicodeBidi() == Override, false, false);
    345334    TextRun textRun(string, length);
    346335
    347336    // Draw the item text
    348337    if (itemStyle->visibility() != HIDDEN)
    349         paintInfo.context->drawText(textRun, r.location(), textStyle);
     338        paintInfo.context->drawBidiText(textRun, r.location(), textStyle);
    350339}
    351340
Note: See TracChangeset for help on using the changeset viewer.