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

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:59:24 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 823a805717ec6506f8a2ec7f6b77afbd8d13729a
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Oct 2 18:35:05 2003 +0000

            Reviewed by Ken.
    
            - in preparation for a WebCore whitespace-handling change, made WebTextRenderer draw and measure
              newline characters as if they are spaces (just as we already do with non-breaking spaces)
            - removed some unused stuff from WebTextRenderer
            - other unimportant tweaks (e.g. unsigned int -> unsigned)
    
            * WebCoreSupport.subproj/WebTextRenderer.m:
            (kFixedOne), (fixed1), (FixToFloat), (FloatToFixed): Removed these. We can use the standard ones
            from <FixMath.h> instead of defining our own.
            (isControlCharacter): Added. Inline function that we can use instead of the macro we had before.
            (isAlternateSpace): Added. Returns YES for newlines and non-breaking spaces.
            (isSpace): Added. Returns YES for real spaces and the two alternate spaces as well.
            (initializeCharacterWidthIterator): Use isSpace.
            (-[WebTextRenderer convertCharacters:length:toGlyphs:skipControlCharacters:]): Use isAlternateSpace
            and isControlCharacter.
            (-[WebTextRenderer _CG_floatWidthForRun:style:widths:fonts:glyphs:startGlyph:endGlyph:numGlyphs:]):
            Use isControlCharacter, isAlternateSpace, and isSpace. Also fix a small bug where numGlyphs would
            not get set up properly when the run length is 0, and used local variables when possible instead
            of going back at the run structure.
            (-[WebTextRenderer _ATSU_floatWidthForRun:style:]): Use the standard FixedToFloat instead of our
            own FixToFloat.
            (-[WebTextRenderer _ATSU_drawHighlightForRun:style:atPoint:]): Ditto.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5118 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 7e17f69..613272a 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,29 @@
+2003-10-02  Darin Adler  <darin at apple.com>
+
+        Reviewed by Ken.
+
+        - in preparation for a WebCore whitespace-handling change, made WebTextRenderer draw and measure
+          newline characters as if they are spaces (just as we already do with non-breaking spaces)
+        - removed some unused stuff from WebTextRenderer
+        - other unimportant tweaks (e.g. unsigned int -> unsigned)
+
+        * WebCoreSupport.subproj/WebTextRenderer.m:
+        (kFixedOne), (fixed1), (FixToFloat), (FloatToFixed): Removed these. We can use the standard ones
+        from <FixMath.h> instead of defining our own.
+        (isControlCharacter): Added. Inline function that we can use instead of the macro we had before.
+        (isAlternateSpace): Added. Returns YES for newlines and non-breaking spaces.
+        (isSpace): Added. Returns YES for real spaces and the two alternate spaces as well.
+        (initializeCharacterWidthIterator): Use isSpace.
+        (-[WebTextRenderer convertCharacters:length:toGlyphs:skipControlCharacters:]): Use isAlternateSpace
+        and isControlCharacter.
+        (-[WebTextRenderer _CG_floatWidthForRun:style:widths:fonts:glyphs:startGlyph:endGlyph:numGlyphs:]):
+        Use isControlCharacter, isAlternateSpace, and isSpace. Also fix a small bug where numGlyphs would
+        not get set up properly when the run length is 0, and used local variables when possible instead
+        of going back at the run structure.
+        (-[WebTextRenderer _ATSU_floatWidthForRun:style:]): Use the standard FixedToFloat instead of our
+        own FixToFloat.
+        (-[WebTextRenderer _ATSU_drawHighlightForRun:style:atPoint:]): Ditto.
+
 2003-10-02  David Hyatt  <hyatt at apple.com>
 
 	Work on exposing elements to the Acc API.  This patch gets us to the point where text
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
index 48f3ae8..774cdd1 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
@@ -23,12 +23,9 @@
 
 #import <float.h>
 
-#define NON_BREAKING_SPACE 0x00A0
 #define SPACE 0x0020
 
-#define IS_CONTROL_CHARACTER(c) ((c) < 0x0020 || (c) == 0x007F)
-
-#define ROUND_TO_INT(x) (unsigned int)((x)+.5)
+#define ROUND_TO_INT(x) (unsigned)((x)+.5)
 
 // Lose precision beyond 1000ths place. This is to work around an apparent
 // bug in CoreGraphics where there seem to be small errors to some metrics.
@@ -100,22 +97,12 @@ struct CharacterWidthIterator
     const WebCoreTextStyle *style;
     unsigned currentCharacter;
     CharacterShapeIterator shapeIterator;
-    unsigned int needsShaping;
+    unsigned needsShaping;
     float runWidthSoFar;
     int padding;
     int padPerSpace;
 };
 
-static void initializeCharacterWidthIterator (CharacterWidthIterator *iterator, WebTextRenderer *renderer, const WebCoreTextRun *run , const WebCoreTextStyle *style);
-static float widthForNextCharacter (CharacterWidthIterator *iterator);
-
-// These somewhat cryptically named constants were 'borrowed' from
-// some example carbon code.
-#define kFixedOne ((Fixed)1<<16)
-#define fixed1 ((Fixed) 0x00010000L)
-#define FixToFloat(f) ((float)((f)  * (1./(float)kFixedOne)))
-#define FloatToFixed(a) ((Fixed)((float)(a) * fixed1))
-
 static inline BOOL shouldUseATSU(const WebCoreTextRun *run)
 {
     UniChar c;
@@ -146,6 +133,21 @@ static inline BOOL shouldUseATSU(const WebCoreTextRun *run)
     return NO;
 }
 
+static inline BOOL isControlCharacter(UniChar c)
+{
+    return c < 0x0020 || c == 0x007F;
+}
+
+static inline BOOL isAlternateSpace(UniChar c)
+{
+    return c == '\n' || c == 0xA0;
+}
+
+static inline BOOL isSpace(UniChar c)
+{
+    return c == SPACE || isAlternateSpace(c);
+}
+
 @interface NSLanguage : NSObject 
 {
 }
@@ -350,7 +352,7 @@ static inline WebGlyphWidth widthForGlyph (WebTextRenderer *renderer, ATSGlyphRe
 }
 
 
-void initializeCharacterWidthIterator (CharacterWidthIterator *iterator, WebTextRenderer *renderer, const WebCoreTextRun *run , const WebCoreTextStyle *style) 
+static void initializeCharacterWidthIterator (CharacterWidthIterator *iterator, WebTextRenderer *renderer, const WebCoreTextRun *run , const WebCoreTextStyle *style) 
 {
     iterator->needsShaping = initializeCharacterShapeIterator (&iterator->shapeIterator, run);
     iterator->renderer = renderer;
@@ -367,9 +369,10 @@ void initializeCharacterWidthIterator (CharacterWidthIterator *iterator, WebText
         int from = run->from;
         int len = run->to - from;
         int k;
-        for (k = from; k < from + len; k++){
-            if (run->characters[k] == NON_BREAKING_SPACE || run->characters[k] == SPACE)
+        for (k = from; k < from + len; k++) {
+            if (isSpace(run->characters[k])) {
                 numSpaces++;
+            }
         }
         iterator->padPerSpace = CEIL_TO_INT ((((float)style->padding) / ((float)numSpaces)));
     }
@@ -391,7 +394,7 @@ static float widthAndGlyphForSurrogate (WebTextRenderer *renderer, UniChar high,
 
     if (*glyphID == 0){
         UniChar surrogates[2];
-        unsigned int clusterLength;
+        unsigned clusterLength;
         
         clusterLength = 2;
         surrogates[0] = high;
@@ -417,7 +420,7 @@ static float widthForNextCharacter (CharacterWidthIterator *iterator)
     const WebCoreTextRun *run = iterator->run;
     NSFont *font = renderer->font;
     UniChar c;
-    unsigned int offset = iterator->currentCharacter;
+    unsigned offset = iterator->currentCharacter;
     WebGlyphWidth width;
 
     if (offset >= run->length)
@@ -513,7 +516,7 @@ static BOOL FillStyleWithAttributes(ATSUStyle style, NSFont *theFont)
 {
     if (theFont) {
         ATSUFontID fontId = (ATSUFontID)[theFont _atsFontID];
-        LOG (FontCache, "FillStyleWithAttributes:  font = %p,%@, _atsFontID = %x\n", theFont, theFont, (unsigned int)fontId);
+        LOG (FontCache, "FillStyleWithAttributes:  font = %p,%@, _atsFontID = %x\n", theFont, theFont, (unsigned)fontId);
         ATSUAttributeTag tag = kATSUFontTag;
         ByteCount size = sizeof(ATSUFontID);
         ATSUFontID *valueArray[1] = {&fontId};
@@ -522,7 +525,7 @@ static BOOL FillStyleWithAttributes(ATSUStyle style, NSFont *theFont)
         if (fontId) {
             status = ATSUSetAttributes(style, 1, &tag, &size, (void *)valueArray);
             if (status != noErr){
-                LOG (FontCache, "FillStyleWithAttributes failed(%d):  font = %p,%@, _atsFontID = %x\n", (int)status, theFont, theFont, (unsigned int)fontId);
+                LOG (FontCache, "FillStyleWithAttributes failed(%d):  font = %p,%@, _atsFontID = %x\n", (int)status, theFont, theFont, (unsigned)fontId);
                 return NO;
             }
         }
@@ -535,9 +538,9 @@ static BOOL FillStyleWithAttributes(ATSUStyle style, NSFont *theFont)
 }
 
 
-static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsigned int length)
+static unsigned findLengthOfCharacterCluster(const UniChar *characters, unsigned length)
 {
-    unsigned int k;
+    unsigned k;
 
     if (length <= 1)
         return length;
@@ -627,7 +630,7 @@ static inline BOOL _fontContainsString (NSFont *font, NSString *string)
 }
 
 
-/* Convert non-breaking spaces into spaces, and skip control characters. */
+/* Convert newlines and non-breaking spaces into spaces, and skip control characters. */
 - (void)convertCharacters: (const UniChar *)characters length: (unsigned)numCharacters toGlyphs: (ATSGlyphVector *)glyphs skipControlCharacters:(BOOL)skipControlCharacters
 {
     unsigned i, numCharactersInBuffer;
@@ -637,7 +640,7 @@ static inline BOOL _fontContainsString (NSFont *font, NSString *string)
     
     for (i = 0; i < numCharacters; i++) {
         UniChar c = characters[i];
-        if ((skipControlCharacters && IS_CONTROL_CHARACTER(c)) || c == NON_BREAKING_SPACE) {
+        if ((skipControlCharacters && isControlCharacter(c)) || isAlternateSpace(c)) {
             break;
         }
     }
@@ -650,9 +653,9 @@ static inline BOOL _fontContainsString (NSFont *font, NSString *string)
         numCharactersInBuffer = 0;
         for (i = 0; i < numCharacters; i++) {
             UniChar c = characters[i];
-            if (c == NON_BREAKING_SPACE) {
+            if (isAlternateSpace(c)) {
                 buffer[numCharactersInBuffer++] = SPACE;
-            } else if (!(skipControlCharacters && IS_CONTROL_CHARACTER(c))) {
+            } else if (!(skipControlCharacters && isControlCharacter(c))) {
                 buffer[numCharactersInBuffer++] = characters[i];
             }
         }
@@ -852,7 +855,7 @@ static NSString *WebFallbackFontFamily;
     // in the appkit.
     CGFontRef cgFont = [font _backingCGSFont];
     const CGFontHMetrics *metrics = CGFontGetHMetrics(cgFont);
-    unsigned int unitsPerEm = CGFontGetUnitsPerEm(cgFont);
+    unsigned unitsPerEm = CGFontGetUnitsPerEm(cgFont);
     float pointSize = [font pointSize];
     float asc = (ScaleEmToUnits(metrics->ascent, unitsPerEm)*pointSize);
     float dsc = (-ScaleEmToUnits(metrics->descent, unitsPerEm)*pointSize);
@@ -934,7 +937,7 @@ static NSString *WebFallbackFontFamily;
     UniChar localCharacterBuffer[LOCAL_BUFFER_SIZE];
     UniChar *characterBuffer = localCharacterBuffer;
     const UniChar *usedCharacterBuffer = CFStringGetCharactersPtr((CFStringRef)string);
-    unsigned int length;
+    unsigned length;
     int width;
 
     // Get the characters from the string into a buffer.
@@ -1034,7 +1037,7 @@ static void _drawGlyphs(NSFont *font, NSColor *color, CGGlyph *glyphs, CGSize *a
     CGSize *advances, localAdvanceBuffer[LOCAL_BUFFER_SIZE];
     int numGlyphs = 0, i, startGlyph = 0, endGlyph = 0;
     float startX;
-    unsigned int length = run->length;
+    unsigned length = run->length;
     
     if (run->length == 0)
         return;
@@ -1125,7 +1128,7 @@ static void _drawGlyphs(NSFont *font, NSColor *color, CGGlyph *glyphs, CGSize *a
     CGSize *advances, localAdvanceBuffer[LOCAL_BUFFER_SIZE];
     int numGlyphs = 0, i, startGlyph = 0, endGlyph = 0;
     float startX;
-    unsigned int length = run->length;
+    unsigned length = run->length;
     
     if (run->length == 0)
         return;
@@ -1354,7 +1357,7 @@ static const char *joiningNames[] = {
 - (float)_CG_floatWidthForRun:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style widths: (float *)widthBuffer fonts: (NSFont **)fontBuffer glyphs: (CGGlyph *)glyphBuffer  startGlyph:(int *)startGlyph endGlyph:(int *)endGlyph numGlyphs: (int *)_numGlyphs
 {
     float totalWidth = 0, widthFromStart = 0;
-    unsigned int i, clusterLength;
+    unsigned i, clusterLength;
     NSFont *substituteFont = nil;
     ATSGlyphRef glyphID;
     float lastWidth = 0;
@@ -1366,14 +1369,11 @@ static const char *joiningNames[] = {
     int to = run->to;
     int len = to - from;
     const UniChar *characters = run->characters;
-    unsigned int stringLength = run->length;
+    unsigned stringLength = run->length;
     int pos = run->from;
     int padding = style->padding;
     
-    if (run->length <= 0)
-        return 0;
-        
-    if (len <= 0){
+    if (stringLength <= 0 || len <= 0) {
         if (_numGlyphs)
             *_numGlyphs = 0;
         return 0;
@@ -1390,7 +1390,7 @@ static const char *joiningNames[] = {
         // FIXME:  Change to use the new CharacterShapeIterator internal API.
         shaped = shapedString (run, &lengthOut);        
         if (shaped){
-             if (run->length < LOCAL_BUFFER_SIZE)
+             if (stringLength < LOCAL_BUFFER_SIZE)
                  munged = &_localMunged[0];
              else
                  munged = (UniChar *)malloc(stringLength * sizeof(UniChar));
@@ -1418,9 +1418,10 @@ static const char *joiningNames[] = {
     if (style->padding > 0){
         int k;
         // Distribute the padding over the spaces in the entire run.
-        for (k = 0; k < (int)run->length; k++){
-            if (characters[k] == NON_BREAKING_SPACE || characters[k] == SPACE)
+        for (k = 0; k < (int)stringLength; k++) {
+            if (isSpace(characters[k])) {
                 numSpaces++;
+            }
         }
         padPerSpace = CEIL_TO_INT ((((float)style->padding) / ((float)numSpaces)));
     }
@@ -1430,31 +1431,31 @@ static const char *joiningNames[] = {
         UniChar c = characters[i];
         BOOL foundMetrics = NO;
         
+        if (isAlternateSpace(c)) {
+            c = SPACE;
+        }
+        
         // Skip control characters.
-        if (IS_CONTROL_CHARACTER(c)) {
-            if (glyphBuffer && i < (unsigned int)(run->to) && endGlyph)
+        if (isControlCharacter(c)) {
+            if (glyphBuffer && i < (unsigned)to && endGlyph)
                 *endGlyph = numGlyphs-1;
             continue;
         }
         
-        if (c == NON_BREAKING_SPACE) {
-            c = SPACE;
-        }
-        
         // Drop out early if we've measured to the end of the requested
         // fragment.
         if ((int)i - pos >= len) {
             // Check if next character is a space. If so, we have to apply rounding.
             if (c == SPACE && style->applyRounding) {
                 float delta = CEIL_TO_INT(widthFromStart) - widthFromStart;
-                if (i >= (unsigned int)pos)
+                if (i >= (unsigned)pos)
                     totalWidth += delta;
                 widthFromStart += delta;
                 if (widthBuffer && numGlyphs > 0)
                     widthBuffer[numGlyphs - 1] += delta;
             }
 
-            if (glyphBuffer && i < (unsigned int)(run->to) && endGlyph)
+            if (glyphBuffer && i < (unsigned)to && endGlyph)
                 *endGlyph = numGlyphs-1;
 
             break;
@@ -1464,7 +1465,7 @@ static const char *joiningNames[] = {
             high = c;
 
             // Make sure we have another character and it's a low surrogate.
-            if (i+1 >= run->length || !IsLowSurrogatePair((low = characters[++i]))){
+            if (i+1 >= stringLength || !IsLowSurrogatePair((low = characters[++i]))){
                 // Error!  Use 0 glyph.
                 glyphID = 0;
             }
@@ -1505,7 +1506,7 @@ static const char *joiningNames[] = {
                 _characters = &surrogates[0];
             }
             else {
-                clusterLength = findLengthOfCharacterCluster (&characters[i], run->length - i);
+                clusterLength = findLengthOfCharacterCluster (&characters[i], stringLength - i);
                 _characters = &characters[i];
             }
             substituteFont = [self substituteFontForCharacters: _characters length: clusterLength families: style->families];
@@ -1531,7 +1532,7 @@ static const char *joiningNames[] = {
                 
                 int j;
                 if (glyphBuffer){
-                    if (i-1 == (unsigned int)run->from && startGlyph)
+                    if (i-1 == (unsigned)from && startGlyph)
                         *startGlyph = numGlyphs;
                     for (j = 0; j < cNumGlyphs; j++){
                         glyphBuffer[numGlyphs+j] = localGlyphBuffer[j];
@@ -1549,7 +1550,7 @@ static const char *joiningNames[] = {
 
                 numGlyphs += cNumGlyphs;
 
-                if (glyphBuffer && i == (unsigned int)(run->to-1) && endGlyph)
+                if (glyphBuffer && i == (unsigned)(to-1) && endGlyph)
                     *endGlyph = numGlyphs-1;
 
                 foundMetrics = YES;
@@ -1568,7 +1569,7 @@ static const char *joiningNames[] = {
             if (glyphID == spaceGlyph && style->applyRounding) {
                 if (lastWidth > 0){
                     float delta = CEIL_TO_INT(widthFromStart) - widthFromStart;
-                    if (i >= (unsigned int)pos)
+                    if (i >= (unsigned)pos)
                         totalWidth += delta;
                     widthFromStart += delta;
                     if (widthBuffer)
@@ -1595,7 +1596,7 @@ static const char *joiningNames[] = {
                 fontBuffer[numGlyphs] = (substituteFont ? substituteFont: font);
             }
             if (glyphBuffer) {
-                if (i == (unsigned int)run->from && startGlyph)
+                if (i == (unsigned)from && startGlyph)
                     *startGlyph = numGlyphs;
                 glyphBuffer[numGlyphs] = glyphID;
             }
@@ -1607,7 +1608,7 @@ static const char *joiningNames[] = {
 
             // Account for word-spacing.  Make the size of the last character (grapheme cluster)
             // in the word wider.
-            if (glyphID == spaceGlyph && numGlyphs > 0 && (characters[i-1] != SPACE || characters[i-1] != NON_BREAKING_SPACE)){
+            if (glyphID == spaceGlyph && numGlyphs > 0 && !isSpace(characters[i-1])) {
                 // Find the base glyph in the grapheme cluster.  Combining glyphs
                 // should have zero width.
                 if (widthBuffer){
@@ -1618,7 +1619,7 @@ static const char *joiningNames[] = {
                         widthBuffer[ng] += style->wordSpacing;
                     }
                 }
-                if (i >= (unsigned int)pos)
+                if (i >= (unsigned)pos)
                     totalWidth += style->wordSpacing;
                 widthFromStart += style->wordSpacing;
             }
@@ -1628,14 +1629,14 @@ static const char *joiningNames[] = {
             }
             numGlyphs++;
 
-            if (glyphBuffer && i == (unsigned int)(run->to-1) && endGlyph)
+            if (glyphBuffer && i == (unsigned)(to-1) && endGlyph)
                 *endGlyph = numGlyphs-1;
         }
 #ifdef DEBUG_COMBINING        
         printf ("Character 0x%04x, joining attribute %d(%s), combining class %d, direction %d(%s)\n", c, WebCoreUnicodeJoiningFunction(c), joiningNames[WebCoreUnicodeJoiningFunction(c)], WebCoreUnicodeCombiningClassFunction(c), WebCoreUnicodeDirectionFunction(c), directionNames[WebCoreUnicodeDirectionFunction(c)]);
 #endif
         
-        if (i >= (unsigned int)pos)
+        if (i >= (unsigned)pos)
             totalWidth += lastWidth;
         widthFromStart += lastWidth;
     }
@@ -1643,9 +1644,9 @@ static const char *joiningNames[] = {
     // Ceil the last glyph, but only if
     // 1) The string is longer than one character
     // 2) or the entire stringLength is one character
-    if ((len > 1 || run->length == 1) && style->applyRounding){
+    if ((len > 1 || stringLength == 1) && style->applyRounding){
         float delta = CEIL_TO_INT(widthFromStart) - widthFromStart;
-        if (i >= (unsigned int)pos)
+        if (i >= (unsigned)pos)
             totalWidth += delta;
         widthFromStart += delta;
         if (widthBuffer && numGlyphs > 0)
@@ -1669,7 +1670,7 @@ static const char *joiningNames[] = {
     ATSLayoutRecord *glyphRecord;
     ATSGlyphVector glyphVector;
     UnicodeChar end, start;
-    unsigned int blockSize;
+    unsigned blockSize;
     ATSGlyphRef glyphID;
     
     if (unicodeCharacterToGlyphMap == 0)
@@ -1684,7 +1685,7 @@ static const char *joiningNames[] = {
     map->startRange = start;
     map->endRange = end;
     
-    unsigned int i, count = end - start + 1;
+    unsigned i, count = end - start + 1;
     UnicodeChar buffer[INCREMENTAL_BLOCK_SIZE+2];
     
     for (i = 0; i < count; i++){
@@ -1752,7 +1753,7 @@ static const char *joiningNames[] = {
     ATSLayoutRecord *glyphRecord;
     ATSGlyphVector glyphVector;
     UniChar end, start;
-    unsigned int blockSize;
+    unsigned blockSize;
     ATSGlyphRef glyphID;
     
     if (characterToGlyphMap == 0)
@@ -1767,8 +1768,8 @@ static const char *joiningNames[] = {
     map->startRange = start;
     map->endRange = end;
     
-    unsigned int i, count = end - start + 1;
-    short unsigned int buffer[INCREMENTAL_BLOCK_SIZE+2];
+    unsigned i, count = end - start + 1;
+    short unsigned buffer[INCREMENTAL_BLOCK_SIZE+2];
     
     for (i = 0; i < count; i++){
         buffer[i] = i+start;
@@ -1823,10 +1824,10 @@ static const char *joiningNames[] = {
 - (WidthMap *)extendGlyphToWidthMapToInclude:(ATSGlyphRef)glyphID font:(NSFont *)subFont
 {
     WidthMap *map = (WidthMap *)calloc (1, sizeof(WidthMap)), **rootMap;
-    unsigned int end;
+    unsigned end;
     ATSGlyphRef start;
-    unsigned int blockSize;
-    unsigned int i, count;
+    unsigned blockSize;
+    unsigned i, count;
     
     if (subFont && subFont != font)
         rootMap = &mapForSubstituteFont(self,subFont)->map;
@@ -1842,7 +1843,7 @@ static const char *joiningNames[] = {
     else
         blockSize = INCREMENTAL_BLOCK_SIZE;
     start = (glyphID / blockSize) * blockSize;
-    end = ((unsigned int)start) + blockSize; 
+    end = ((unsigned)start) + blockSize; 
     if (end > 0xffff)
         end = 0xffff;
 
@@ -1975,8 +1976,8 @@ static const char *joiningNames[] = {
     oGlyphBounds = [self _trapezoidForRun:run style:style atPoint:NSMakePoint (0,0)];
     
     float width = 
-        MAX(FixToFloat(oGlyphBounds.upperRight.x), FixToFloat(oGlyphBounds.lowerRight.x)) - 
-        MIN(FixToFloat(oGlyphBounds.upperLeft.x), FixToFloat(oGlyphBounds.lowerLeft.x));
+        MAX(FixedToFloat(oGlyphBounds.upperRight.x), FixedToFloat(oGlyphBounds.lowerRight.x)) - 
+        MIN(FixedToFloat(oGlyphBounds.upperLeft.x), FixedToFloat(oGlyphBounds.lowerLeft.x));
     
     return width;
 }
@@ -2015,13 +2016,13 @@ static const char *joiningNames[] = {
     ATSTrapezoid selectedTrapezoid = [self _trapezoidForRun:run style:style atPoint:point];
 
     float backgroundWidth = 
-            MAX(FixToFloat(selectedTrapezoid.upperRight.x), FixToFloat(selectedTrapezoid.lowerRight.x)) - 
-            MIN(FixToFloat(selectedTrapezoid.upperLeft.x), FixToFloat(selectedTrapezoid.lowerLeft.x));
+            MAX(FixedToFloat(selectedTrapezoid.upperRight.x), FixedToFloat(selectedTrapezoid.lowerRight.x)) - 
+            MIN(FixedToFloat(selectedTrapezoid.upperLeft.x), FixedToFloat(selectedTrapezoid.lowerLeft.x));
 
     if (run->from == 0)
         selectedLeftX = point.x;
     else
-        selectedLeftX = MIN(FixToFloat(leadingTrapezoid.upperRight.x), FixToFloat(leadingTrapezoid.lowerRight.x));
+        selectedLeftX = MIN(FixedToFloat(leadingTrapezoid.upperRight.x), FixedToFloat(leadingTrapezoid.lowerRight.x));
     
     [style->backgroundColor set];
     
@@ -2087,7 +2088,7 @@ static const char *joiningNames[] = {
 
 - (int)_ATSU_pointToOffset:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style position:(int)x reversed:(BOOL)reversed
 {
-    unsigned int offset = 0;
+    unsigned offset = 0;
     ATSUTextLayout layout;
     UniCharArrayOffset primaryOffset = 0;
     UniCharArrayOffset secondaryOffset = 0;
@@ -2096,9 +2097,9 @@ static const char *joiningNames[] = {
 
     layout = [self _createATSUTextLayoutForRun:run];
 
-    status = ATSUPositionToOffset (layout, (ATSUTextMeasurement)FloatToFixed(((float)x)), 1, &primaryOffset, &isLeading, &secondaryOffset);
+    status = ATSUPositionToOffset(layout, FloatToFixed(x), 1, &primaryOffset, &isLeading, &secondaryOffset);
     if (status == noErr){
-        offset = (unsigned int)primaryOffset;
+        offset = (unsigned)primaryOffset;
     }
     else {
         // Failed to find offset!  Return 0 offset.
@@ -2107,13 +2108,11 @@ static const char *joiningNames[] = {
     return offset;
 }
 
-#define LOCAL_WIDTH_BUF_SIZE 1024
-
 - (int)_CG_pointToOffset:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style position:(int)x reversed:(BOOL)reversed
 {
     float delta = (float)x;
     float width;
-    unsigned int offset = run->from;
+    unsigned offset = run->from;
     CharacterWidthIterator widthIterator;
     
     initializeCharacterWidthIterator(&widthIterator, self, run, style);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list