[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:54:41 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 9c5fbe8a7cd8269f70352dea519ce60260b30571
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Oct 26 02:11:27 2002 +0000

            Implemented support for bidi text layout.
    
            * WebCoreSupport.subproj/WebTextRenderer.m:
            (_drawGlyphs):
            (-[WebTextRenderer drawCharacters:stringLength:fromCharacterPosition:toCharacterPosition:atPoint:withPadding:withTextColor:backgroundColor:rightToLeft:]):
    
            Implemented support for bidi text layout.  WebCore
            temporarily depends on SPI to get unicode character
            attribute from CF.  This will change shortly.
    
            * khtml/rendering/font.cpp:
            (Font::drawText):
            * kwq/KWQChar.mm:
            (QChar::direction):
            * kwq/KWQPainter.mm:
            (QPainter::drawText):
            * kwq/WebCoreTextRenderer.h:
            * kwq/qt/qpainter.h:
    
            Updated to reflect change in WebKit SPI.
    
            * EtchedStringView.m:
            (-[EtchedStringView drawRect:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2473 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index f1f02f6..523cba5 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,18 @@
+2002-10-25  Richard Williamson   <rjw at apple.com>
+
+        Implemented support for bidi text layout.  WebCore
+        temporarily depends on SPI to get unicode character
+        attribute from CF.  This will change shortly.
+        
+        * khtml/rendering/font.cpp:
+        (Font::drawText):
+        * kwq/KWQChar.mm:
+        (QChar::direction):
+        * kwq/KWQPainter.mm:
+        (QPainter::drawText):
+        * kwq/WebCoreTextRenderer.h:
+        * kwq/qt/qpainter.h:
+
 2002-10-25  Chris Blumenberg  <cblu at apple.com>
 
 	Cleaned up the frame searching shenanigans. Things are much cleaner and clearer now.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index f1f02f6..523cba5 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,18 @@
+2002-10-25  Richard Williamson   <rjw at apple.com>
+
+        Implemented support for bidi text layout.  WebCore
+        temporarily depends on SPI to get unicode character
+        attribute from CF.  This will change shortly.
+        
+        * khtml/rendering/font.cpp:
+        (Font::drawText):
+        * kwq/KWQChar.mm:
+        (QChar::direction):
+        * kwq/KWQPainter.mm:
+        (QPainter::drawText):
+        * kwq/WebCoreTextRenderer.h:
+        * kwq/qt/qpainter.h:
+
 2002-10-25  Chris Blumenberg  <cblu at apple.com>
 
 	Cleaned up the frame searching shenanigans. Things are much cleaner and clearer now.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index f1f02f6..523cba5 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,18 @@
+2002-10-25  Richard Williamson   <rjw at apple.com>
+
+        Implemented support for bidi text layout.  WebCore
+        temporarily depends on SPI to get unicode character
+        attribute from CF.  This will change shortly.
+        
+        * khtml/rendering/font.cpp:
+        (Font::drawText):
+        * kwq/KWQChar.mm:
+        (QChar::direction):
+        * kwq/KWQPainter.mm:
+        (QPainter::drawText):
+        * kwq/WebCoreTextRenderer.h:
+        * kwq/qt/qpainter.h:
+
 2002-10-25  Chris Blumenberg  <cblu at apple.com>
 
 	Cleaned up the frame searching shenanigans. Things are much cleaner and clearer now.
diff --git a/WebCore/khtml/rendering/font.cpp b/WebCore/khtml/rendering/font.cpp
index a44e608..94a7dae 100644
--- a/WebCore/khtml/rendering/font.cpp
+++ b/WebCore/khtml/rendering/font.cpp
@@ -41,7 +41,8 @@ void Font::drawText( QPainter *p, int x, int y, QChar *str, int slen, int pos, i
         int toAdd, QPainter::TextDirection d, int from, int to, QColor bg ) const
 {
 #ifdef APPLE_CHANGES
-    p->drawText(x, y, str + pos, std::min(slen - pos, len), from, to, toAdd, bg);
+    printf ("QPainter::TextDirection d = %s\n", d == QPainter::RTL ? "QPainter::RTL" : "QPainter::LTR");
+    p->drawText(x, y, str + pos, std::min(slen - pos, len), from, to, toAdd, bg, d);
 #else
     QString qstr = QConstString(str, slen).string();
 
diff --git a/WebCore/kwq/KWQChar.mm b/WebCore/kwq/KWQChar.mm
index de6913c..0ddf547 100644
--- a/WebCore/kwq/KWQChar.mm
+++ b/WebCore/kwq/KWQChar.mm
@@ -27,6 +27,9 @@
 #import <KWQLogging.h>
 #import <Foundation/Foundation.h>
 
+#import <CoreFoundation/CFBidi.h>
+
+
 static UniChar scratchUniChar;
 
 static CFMutableStringRef GetScratchUniCharString()
@@ -100,13 +103,76 @@ QChar QChar::upper() const
     return scratchUniChar;
 }
 
+extern "C" {
+}
+
 QChar::Direction QChar::direction() const
 {
     // FIXME: unimplemented because we don't do BIDI yet
-    LOG(NotYetImplemented, "not yet implemented");
-    if (c == ' ')
-        return DirWS;
-    return DirL;
+    uint8_t type;
+    QChar::Direction dir = DirL;
+
+    CFUniCharGetBidiCategory (&c, 1, &type);
+    switch (type){
+        case kCFUniCharBiDiPropertyON:
+            dir = DirON;
+            break;
+        case kCFUniCharBiDiPropertyL:
+            dir = DirL;
+            break;
+        case kCFUniCharBiDiPropertyR:
+            dir = DirR;
+            break;
+        case kCFUniCharBiDiPropertyAN:
+            dir = DirAN;
+            break;
+        case kCFUniCharBiDiPropertyEN:
+            dir = DirEN;
+            break;
+        case kCFUniCharBiDiPropertyAL:
+            dir = DirAL;
+            break;
+        case kCFUniCharBiDiPropertyNSM:
+            dir = DirNSM;
+            break;
+        case kCFUniCharBiDiPropertyCS:
+            dir = DirCS;
+            break;
+        case kCFUniCharBiDiPropertyES:
+            dir = DirES;
+            break;
+        case kCFUniCharBiDiPropertyET:
+            dir = DirET;
+            break;
+        case kCFUniCharBiDiPropertyBN:
+            dir = DirBN;
+            break;
+        case kCFUniCharBiDiPropertyS:
+            dir = DirS;
+            break;
+        case kCFUniCharBiDiPropertyWS:
+            dir = DirWS;
+            break;
+        case kCFUniCharBiDiPropertyB:
+            dir = DirB;
+            break;
+        case kCFUniCharBiDiPropertyRLO:
+            dir = DirRLO;
+            break;
+        case kCFUniCharBiDiPropertyRLE:
+            dir = DirRLE;
+            break;
+        case kCFUniCharBiDiPropertyLRO:
+            dir = DirLRO;
+            break;
+        case kCFUniCharBiDiPropertyLRE:
+            dir = DirLRE;
+            break;
+        case kCFUniCharBiDiPropertyPDF:
+            dir = DirPDF;
+            break;
+    }
+    return dir;
 }
 
 bool QChar::mirrored() const
diff --git a/WebCore/kwq/KWQPainter.h b/WebCore/kwq/KWQPainter.h
index 4b407d0..1067a44 100644
--- a/WebCore/kwq/KWQPainter.h
+++ b/WebCore/kwq/KWQPainter.h
@@ -91,7 +91,7 @@ public:
     void setRasterOp(RasterOp);
 
     void drawText(int x, int y, int, int, int alignmentFlags, const QString &);
-    void drawText(int x, int y, const QChar *, int length, int from, int to, int toAdd, const QColor& backgroundColor);
+    void drawText(int x, int y, const QChar *, int length, int from, int to, int toAdd, const QColor& backgroundColor, QPainter::TextDirection d);
     void drawUnderlineForText(int x, int y, const QChar *, int length);
     static QColor selectedTextBackgroundColor();
     
diff --git a/WebCore/kwq/KWQPainter.mm b/WebCore/kwq/KWQPainter.mm
index 460a966..f4ff704 100644
--- a/WebCore/kwq/KWQPainter.mm
+++ b/WebCore/kwq/KWQPainter.mm
@@ -368,10 +368,11 @@ void QPainter::drawText(int x, int y, int, int, int alignmentFlags, const QStrin
         atPoint:NSMakePoint(x, y)
         withPadding: 0
         withTextColor:data->state.pen.color().getNSColor() 
-        backgroundColor:nil];
+        backgroundColor:nil
+        rightToLeft: false];
 }
 
-void QPainter::drawText(int x, int y, const QChar *str, int len, int from, int to, int toAdd, const QColor &backgroundColor)
+void QPainter::drawText(int x, int y, const QChar *str, int len, int from, int to, int toAdd, const QColor &backgroundColor, QPainter::TextDirection d)
 {
     if (data->state.paintingDisabled || len <= 0)
         return;
@@ -384,7 +385,8 @@ void QPainter::drawText(int x, int y, const QChar *str, int len, int from, int t
         atPoint:NSMakePoint(x, y)
         withPadding: toAdd
         withTextColor:data->state.pen.color().getNSColor() 
-        backgroundColor:backgroundColor.isValid() ? backgroundColor.getNSColor() : nil];
+        backgroundColor:backgroundColor.isValid() ? backgroundColor.getNSColor() : nil
+        rightToLeft: d == RTL ? true : false];
 }
 
 void QPainter::drawUnderlineForText(int x, int y, const QChar *str, int len)
diff --git a/WebCore/kwq/WebCoreTextRenderer.h b/WebCore/kwq/WebCoreTextRenderer.h
index 843c85a..0887534 100644
--- a/WebCore/kwq/WebCoreTextRenderer.h
+++ b/WebCore/kwq/WebCoreTextRenderer.h
@@ -41,7 +41,7 @@
 - (float)floatWidthForCharacters:(const unichar *)characters stringLength:(unsigned)length fromCharacterPosition: (int)pos numberOfCharacters: (int)len withPadding: (int)padding applyRounding: (BOOL)applyRounding attemptFontSubstitution: (BOOL)attemptFontSubstitution widths: (float *)buffer;
 
 // drawing
-- (void)drawCharacters:(const UniChar *)characters stringLength:(unsigned)length fromCharacterPosition:(int)from toCharacterPosition:(int)to atPoint:(NSPoint)point withPadding: (int)padding withTextColor:(NSColor *)textColor backgroundColor:(NSColor *)backgroundColor;
+- (void)drawCharacters:(const UniChar *)characters stringLength:(unsigned)length fromCharacterPosition:(int)from toCharacterPosition:(int)to atPoint:(NSPoint)point withPadding: (int)padding withTextColor:(NSColor *)textColor backgroundColor:(NSColor *)backgroundColor rightToLeft: (BOOL)rtl;
 - (void)drawUnderlineForCharacters:(const UniChar *)characters stringLength:(unsigned)length atPoint:(NSPoint)point withColor:(NSColor *)color;
 
 @end
diff --git a/WebCore/kwq/qt/qpainter.h b/WebCore/kwq/qt/qpainter.h
index 4b407d0..1067a44 100644
--- a/WebCore/kwq/qt/qpainter.h
+++ b/WebCore/kwq/qt/qpainter.h
@@ -91,7 +91,7 @@ public:
     void setRasterOp(RasterOp);
 
     void drawText(int x, int y, int, int, int alignmentFlags, const QString &);
-    void drawText(int x, int y, const QChar *, int length, int from, int to, int toAdd, const QColor& backgroundColor);
+    void drawText(int x, int y, const QChar *, int length, int from, int to, int toAdd, const QColor& backgroundColor, QPainter::TextDirection d);
     void drawUnderlineForText(int x, int y, const QChar *, int length);
     static QColor selectedTextBackgroundColor();
     
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 69c941d..afad36a 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,11 @@
+2002-10-25  Richard Williamson   <rjw at apple.com>
+
+        Implemented support for bidi text layout.
+        
+        * WebCoreSupport.subproj/WebTextRenderer.m:
+        (_drawGlyphs):
+        (-[WebTextRenderer drawCharacters:stringLength:fromCharacterPosition:toCharacterPosition:atPoint:withPadding:withTextColor:backgroundColor:rightToLeft:]):
+
 2002-10-25  Chris Blumenberg  <cblu at apple.com>
 
 	Made frameNamed private in WebController and renamed it to _findFrameNamed. Got rid of _frameInThisWindowNamed in WebController because it isn't needed anymore.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 69c941d..afad36a 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,11 @@
+2002-10-25  Richard Williamson   <rjw at apple.com>
+
+        Implemented support for bidi text layout.
+        
+        * WebCoreSupport.subproj/WebTextRenderer.m:
+        (_drawGlyphs):
+        (-[WebTextRenderer drawCharacters:stringLength:fromCharacterPosition:toCharacterPosition:atPoint:withPadding:withTextColor:backgroundColor:rightToLeft:]):
+
 2002-10-25  Chris Blumenberg  <cblu at apple.com>
 
 	Made frameNamed private in WebController and renamed it to _findFrameNamed. Got rid of _frameInThisWindowNamed in WebController because it isn't needed anymore.
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
index 0c9c4f3..adb4cb7 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
@@ -406,8 +406,28 @@ static BOOL bufferTextDrawing = NO;
 
 
 // Useful page for testing http://home.att.net/~jameskass
+static void _drawGlyphs(NSFont *font, NSColor *color, CGGlyph *glyphs, CGSize *advances, float x, float y, int numGlyphs)
+{
+    CGContextRef cgContext;
+
+    if ([WebTextRenderer shouldBufferTextDrawing] && [[WebTextRendererFactory sharedFactory] coalesceTextDrawing]){
+        // Add buffered glyphs and advances
+        // FIXME:  If we ever use this again, need to add RTL.
+        WebGlyphBuffer *gBuffer = [[WebTextRendererFactory sharedFactory] glyphBufferForFont: font andColor: color];
+        [gBuffer addGlyphs: glyphs advances: advances count: numGlyphs at: x : y];
+    }
+    else {
+        cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
+        // Setup the color and font.
+        [color set];
+        [font set];
 
-- (void)drawCharacters:(const UniChar *)characters stringLength: (unsigned int)length fromCharacterPosition: (int)from toCharacterPosition: (int)to atPoint:(NSPoint)point withPadding: (int)padding withTextColor:(NSColor *)textColor backgroundColor: (NSColor *)backgroundColor
+        CGContextSetTextPosition (cgContext, x, y);
+        CGContextShowGlyphsWithAdvances (cgContext, glyphs, advances, numGlyphs);
+    }
+}
+
+- (void)drawCharacters:(const UniChar *)characters stringLength: (unsigned int)length fromCharacterPosition: (int)from toCharacterPosition: (int)to atPoint:(NSPoint)point withPadding: (int)padding withTextColor:(NSColor *)textColor backgroundColor: (NSColor *)backgroundColor rightToLeft: (BOOL)rtl
 {
     float *widthBuffer, localWidthBuffer[LOCAL_BUFFER_SIZE];
     CGGlyph *glyphBuffer, localGlyphBuffer[LOCAL_BUFFER_SIZE];
@@ -416,7 +436,6 @@ static BOOL bufferTextDrawing = NO;
     int numGlyphs, i;
     float startX, nextX, backgroundWidth = 0.0;
     NSFont *currentFont;
-    CGContextRef cgContext;
     
     if (length == 0)
         return;
@@ -473,25 +492,39 @@ static BOOL bufferTextDrawing = NO;
     if (from < (int)numGlyphs){
         int lastFrom = from;
         int pos = from;
+
+        if (rtl && numGlyphs > 1){
+            int i;
+            int end = numGlyphs;
+            CGGlyph gswap1, gswap2;
+            CGSize aswap1, aswap2;
+            NSFont *fswap1, *fswap2;
+            
+            for (i = pos, end = numGlyphs; i < (numGlyphs - pos)/2; i++){
+                gswap1 = glyphBuffer[i];
+                gswap2 = glyphBuffer[--end];
+                glyphBuffer[i] = gswap2;
+                glyphBuffer[end] = gswap1;
+            }
+            for (i = pos, end = numGlyphs; i < (numGlyphs - pos)/2; i++){
+                aswap1 = advances[i];
+                aswap2 = advances[--end];
+                advances[i] = aswap2;
+                advances[end] = aswap1;
+            }
+            for (i = pos, end = numGlyphs; i < (numGlyphs - pos)/2; i++){
+                fswap1 = fontBuffer[i];
+                fswap2 = fontBuffer[--end];
+                fontBuffer[i] = fswap2;
+                fontBuffer[end] = fswap1;
+            }
+        }
         
         currentFont = fontBuffer[pos];
         nextX = startX;
         while (pos < to){
             if ((fontBuffer[pos] != 0 && fontBuffer[pos] != currentFont)){
-                if ([WebTextRenderer shouldBufferTextDrawing] && [[WebTextRendererFactory sharedFactory] coalesceTextDrawing]){
-                    // Add buffered glyphs and advances
-                    WebGlyphBuffer *gBuffer = [[WebTextRendererFactory sharedFactory] glyphBufferForFont: currentFont andColor: textColor];
-                    [gBuffer addGlyphs: &glyphBuffer[lastFrom] advances: &advances[lastFrom] count: pos - lastFrom at: startX : point.y];
-                }
-                else {
-                    cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
-                    // Setup the color and font.
-                    [textColor set];
-                    [currentFont set];
-            
-                    CGContextSetTextPosition (cgContext, startX, point.y);
-                    CGContextShowGlyphsWithAdvances (cgContext, &glyphBuffer[lastFrom], &advances[lastFrom], pos - lastFrom);
-                }
+                _drawGlyphs(currentFont, textColor, &glyphBuffer[lastFrom], &advances[lastFrom], startX, point.y, pos - lastFrom);
                 lastFrom = pos;
                 currentFont = fontBuffer[pos];
                 startX = nextX;
@@ -499,20 +532,7 @@ static BOOL bufferTextDrawing = NO;
             nextX += advances[pos].width;
             pos++;
         }
-        if ([WebTextRenderer shouldBufferTextDrawing] && [[WebTextRendererFactory sharedFactory] coalesceTextDrawing]){
-            // Add buffered glyphs and advances
-            WebGlyphBuffer *gBuffer = [[WebTextRendererFactory sharedFactory] glyphBufferForFont: currentFont andColor: textColor];
-            [gBuffer addGlyphs: &glyphBuffer[lastFrom] advances: &advances[lastFrom] count: pos - lastFrom at: startX : point.y];
-        }
-        else {
-            cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
-            // Setup the color and font.
-            [textColor set];
-            [currentFont set];
-    
-            CGContextSetTextPosition (cgContext, startX, point.y);
-            CGContextShowGlyphsWithAdvances (cgContext, &glyphBuffer[lastFrom], &advances[lastFrom], pos - lastFrom);
-        }
+        _drawGlyphs(currentFont, textColor, &glyphBuffer[lastFrom], &advances[lastFrom], startX, point.y, pos - lastFrom);
     }
 
     if (advances != localAdvanceBuffer) {

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list