[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:21:46 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit f7877f6a71a9693a650f470cffa737dd72cd3618
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Jun 27 15:54:52 2002 +0000

            Fix selection in 'slow' code path (non-base characters and font substitution).
    
            * WebCoreSupport.subproj/IFTextRenderer.m:
            (-[IFTextRenderer drawGlyphs:numGlyphs:fromGlyphPosition:toGlyphPosition:atPoint:withTextColor:backgroundColor:]):
            (-[IFTextRenderer slowDrawCharacters:length:fromCharacterPosition:toCharacterPosition:atPoint:withTextColor:backgroundColor:attemptFontSubstitution:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1453 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index fe931ec..d0138c5 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,4 +1,12 @@
 2002-06-27  Richard Williamson  <rjw at apple.com>
+        
+        Fix selection in 'slow' code path (non-base characters and font substitution).
+        
+        * WebCoreSupport.subproj/IFTextRenderer.m:
+        (-[IFTextRenderer drawGlyphs:numGlyphs:fromGlyphPosition:toGlyphPosition:atPoint:withTextColor:backgroundColor:]):
+        (-[IFTextRenderer slowDrawCharacters:length:fromCharacterPosition:toCharacterPosition:atPoint:withTextColor:backgroundColor:attemptFontSubstitution:]):
+
+2002-06-27  Richard Williamson  <rjw at apple.com>
 
         Implemented auto scrolling.
         
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index fe931ec..d0138c5 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,4 +1,12 @@
 2002-06-27  Richard Williamson  <rjw at apple.com>
+        
+        Fix selection in 'slow' code path (non-base characters and font substitution).
+        
+        * WebCoreSupport.subproj/IFTextRenderer.m:
+        (-[IFTextRenderer drawGlyphs:numGlyphs:fromGlyphPosition:toGlyphPosition:atPoint:withTextColor:backgroundColor:]):
+        (-[IFTextRenderer slowDrawCharacters:length:fromCharacterPosition:toCharacterPosition:atPoint:withTextColor:backgroundColor:attemptFontSubstitution:]):
+
+2002-06-27  Richard Williamson  <rjw at apple.com>
 
         Implemented auto scrolling.
         
diff --git a/WebKit/WebCoreSupport.subproj/IFTextRenderer.m b/WebKit/WebCoreSupport.subproj/IFTextRenderer.m
index 3f01b30..34e2f7b 100644
--- a/WebKit/WebCoreSupport.subproj/IFTextRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/IFTextRenderer.m
@@ -428,7 +428,7 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
     CGSize *advances, localAdvanceBuffer[LOCAL_BUFFER_SIZE];
     CGContextRef cgContext;
     NSPoint advancePoint = point;
-    float startX, backgroundWidth;
+    float startX, backgroundWidth = 0.0;
 
     if (numGlyphs == 0)
         return point;
@@ -440,6 +440,9 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
         advances = localAdvanceBuffer;
     }
 
+    // Calculate advances for the entire string taking into account.
+    // 1.  Rounding of spaces.
+    // 2.  Rounding at the end of words.
     for (i = 0; i < numGlyphs; i++) {
         advances[i].width = widthForGlyph(self, glyphToWidthMap, glyphs[i]);
         if (glyphs[i] == spaceGlyph){
@@ -453,15 +456,15 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
     }
 
     startX = point.x;
-    for (i = 0; (int)i < from; i++)
+    for (i = 0; (int)i < MIN(from,(int)numGlyphs); i++)
         startX += advances[i].width;
  
-     for (i = from; (int)i < to; i++)
+     for (i = from; (int)i < MIN(to,(int)numGlyphs); i++)
         backgroundWidth += advances[i].width;
     
     if (backgroundColor != nil){
         [backgroundColor set];
-        [NSBezierPath fillRect:NSMakeRect(startX, point.y - ascent, backgroundWidth, lineSpacing)];
+        [NSBezierPath fillRect:NSMakeRect(startX, point.y - [self ascent], backgroundWidth, [self lineSpacing])];
     }
     
     // Setup the color and font.
@@ -515,8 +518,13 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
             
             // Draw everthing up to this point.
             fragmentLength = i - lastDrawnGlyph;
-            if (fragmentLength > 0)
-                point = [self drawGlyphs: &glyphs[lastDrawnGlyph] numGlyphs: fragmentLength fromGlyphPosition: fromGlyph-lastDrawnGlyph toGlyphPosition:MIN(toGlyph-lastDrawnGlyph,fragmentLength) atPoint: point withTextColor: textColor backgroundColor: backgroundColor];
+            if (fragmentLength > 0){
+                int _fromGlyph = fromGlyph-lastDrawnGlyph;
+                
+                if (_fromGlyph < 0)
+                    _fromGlyph = 0;
+                point = [self drawGlyphs: &glyphs[lastDrawnGlyph] numGlyphs: fragmentLength fromGlyphPosition: _fromGlyph toGlyphPosition:MIN(toGlyph-lastDrawnGlyph,fragmentLength) atPoint: point withTextColor: textColor backgroundColor: backgroundColor];
+            }
             
             // Draw the character in the alternate font.
             substituteFont = [self substituteFontForCharacters: &characters[charPos] length: clusterLength];
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
index 3f01b30..34e2f7b 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
@@ -428,7 +428,7 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
     CGSize *advances, localAdvanceBuffer[LOCAL_BUFFER_SIZE];
     CGContextRef cgContext;
     NSPoint advancePoint = point;
-    float startX, backgroundWidth;
+    float startX, backgroundWidth = 0.0;
 
     if (numGlyphs == 0)
         return point;
@@ -440,6 +440,9 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
         advances = localAdvanceBuffer;
     }
 
+    // Calculate advances for the entire string taking into account.
+    // 1.  Rounding of spaces.
+    // 2.  Rounding at the end of words.
     for (i = 0; i < numGlyphs; i++) {
         advances[i].width = widthForGlyph(self, glyphToWidthMap, glyphs[i]);
         if (glyphs[i] == spaceGlyph){
@@ -453,15 +456,15 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
     }
 
     startX = point.x;
-    for (i = 0; (int)i < from; i++)
+    for (i = 0; (int)i < MIN(from,(int)numGlyphs); i++)
         startX += advances[i].width;
  
-     for (i = from; (int)i < to; i++)
+     for (i = from; (int)i < MIN(to,(int)numGlyphs); i++)
         backgroundWidth += advances[i].width;
     
     if (backgroundColor != nil){
         [backgroundColor set];
-        [NSBezierPath fillRect:NSMakeRect(startX, point.y - ascent, backgroundWidth, lineSpacing)];
+        [NSBezierPath fillRect:NSMakeRect(startX, point.y - [self ascent], backgroundWidth, [self lineSpacing])];
     }
     
     // Setup the color and font.
@@ -515,8 +518,13 @@ static unsigned int findLengthOfCharacterCluster(const UniChar *characters, unsi
             
             // Draw everthing up to this point.
             fragmentLength = i - lastDrawnGlyph;
-            if (fragmentLength > 0)
-                point = [self drawGlyphs: &glyphs[lastDrawnGlyph] numGlyphs: fragmentLength fromGlyphPosition: fromGlyph-lastDrawnGlyph toGlyphPosition:MIN(toGlyph-lastDrawnGlyph,fragmentLength) atPoint: point withTextColor: textColor backgroundColor: backgroundColor];
+            if (fragmentLength > 0){
+                int _fromGlyph = fromGlyph-lastDrawnGlyph;
+                
+                if (_fromGlyph < 0)
+                    _fromGlyph = 0;
+                point = [self drawGlyphs: &glyphs[lastDrawnGlyph] numGlyphs: fragmentLength fromGlyphPosition: _fromGlyph toGlyphPosition:MIN(toGlyph-lastDrawnGlyph,fragmentLength) atPoint: point withTextColor: textColor backgroundColor: backgroundColor];
+            }
             
             // Draw the character in the alternate font.
             substituteFont = [self substituteFontForCharacters: &characters[charPos] length: clusterLength];

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list