WebCore
authorrjw <rjw@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Feb 2005 00:50:27 +0000 (00:50 +0000)
committerrjw <rjw@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 25 Feb 2005 00:50:27 +0000 (00:50 +0000)
Fixed <rdar://problem/3382926> Bidi neutrals at RTL/LTR boundaries not handled correctly.

Use mirror characters correctly when rendering with RTL directionality.

        Reviewed by Hyatt.

        * khtml/rendering/bidi.cpp:
        (khtml::BidiIterator::direction):

WebKit
Fixed <rdar://problem/3382926> Bidi neutrals at RTL/LTR boundaries not handled correctly.

If directionality is specified use that as initial directionality,
rather than neutral directionality.

        Reviewed by Hyatt.

        * WebCoreSupport.subproj/WebTextRenderer.m:
        (widthForNextCharacter):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@8689 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog-2005-08-23
WebCore/khtml/rendering/bidi.cpp
WebKit/ChangeLog
WebKit/WebCoreSupport.subproj/WebTextRenderer.m

index a7680b6521b4feb9384cbf6b04a642346f129bcc..5f8fe363e18f7fe3f47b9c2d7e98d7532f26bbdb 100644 (file)
@@ -1,3 +1,14 @@
+2005-02-24  Richard Williamson   <rjw@apple.com>
+
+       Fixed <rdar://problem/3382926> Bidi neutrals at RTL/LTR boundaries not handled correctly.
+
+       Use mirror characters correctly when rendering with RTL directionality.
+
+        Reviewed by Hyatt.
+
+        * khtml/rendering/bidi.cpp:
+        (khtml::BidiIterator::direction):
+
 2005-02-24  Richard Williamson   <rjw@apple.com>
 
        Fixed <rdar://problem/3985889> REGRESSION (125-180): setting <img> src to GIF that already animated does not animate; just shows final frame
index cacb9214b9c57d62b0b28ca3215570a847f3726e..42d1e77fd1d56378bb3cfe66b3026be31ced50db 100644 (file)
@@ -364,6 +364,10 @@ inline QChar::Direction BidiIterator::direction() const
     RenderText *renderTxt = static_cast<RenderText *>( obj );
     if ( pos >= renderTxt->stringLength() )
         return QChar::DirON;
+        
+    if (obj->style()->direction() == RTL && pos == 0)
+        return QChar::DirR;
+        
     return renderTxt->text()[pos].direction();
 }
 
index 36063c62494384c1f5ccc3aae5ccffcdd2087a2f..0a4e2b40dc3b383790c6815dc1155d68289846ce 100644 (file)
@@ -1,3 +1,15 @@
+2005-02-24  Richard Williamson   <rjw@apple.com>
+
+       Fixed <rdar://problem/3382926> Bidi neutrals at RTL/LTR boundaries not handled correctly.
+
+       If directionality is specified use that as initial directionality,
+       rather than neutral directionality.     
+
+        Reviewed by Hyatt.
+
+        * WebCoreSupport.subproj/WebTextRenderer.m:
+        (widthForNextCharacter):
+
 2005-02-24  Adele Amchan  <adele@apple.com>
 
         Reviewed by Chris.
index f8b8b5aae37c5a25714dc7a6f55ce41e06436ad9..73ce637bd0fa527b583aa85bbb8ee6e8d1f09ee6 100644 (file)
@@ -1957,6 +1957,7 @@ static float widthForNextCharacter(CharacterWidthIterator *iterator, ATSGlyphRef
 {
     WebTextRenderer *renderer = iterator->renderer;
     const WebCoreTextRun *run = iterator->run;
+    const WebCoreTextStyle *style = iterator->style;
     unsigned currentCharacter = iterator->currentCharacter;
 
     NSFont *_fontUsed = nil;
@@ -2007,6 +2008,9 @@ static float widthForNextCharacter(CharacterWidthIterator *iterator, ATSGlyphRef
         }
     }
 
+    if (style->rtl) {
+        c = u_charMirror(c);
+    }
     if (c <= 0xFFFF) {
         *glyphUsed = glyphForCharacter(renderer->characterToGlyphMap, c, fontUsed);
         if (*glyphUsed == nonGlyphID) {