[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 08:19:39 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 64333de0975d2118d85403fc272519dcc8280e3b
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Dec 17 03:21:37 2003 +0000
Fixed 3512348: Rewrote _CG_drawHighlightForRun:style:atPoint: to use width
iterators. Much faster, better cheaper, etc.
Reviewed by Dave.
* WebCoreSupport.subproj/WebTextRenderer.m:
(-[WebTextRenderer _CG_drawHighlightForRun:style:atPoint:]):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5811 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index e03d6a1..b66d863 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,5 +1,15 @@
2003-12-16 Richard Williamson <rjw at apple.com>
+ Fixed 3512348: Rewrote _CG_drawHighlightForRun:style:atPoint: to use width
+ iterators. Much faster, better cheaper, etc.
+
+ Reviewed by Dave.
+
+ * WebCoreSupport.subproj/WebTextRenderer.m:
+ (-[WebTextRenderer _CG_drawHighlightForRun:style:atPoint:]):
+
+2003-12-16 Richard Williamson <rjw at apple.com>
+
Fixed 3503011. Added '-' and '?' to rounding hack.
Reviewed by John.
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
index d21bad8..f75fb3b 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
@@ -869,86 +869,47 @@ static void _drawGlyphs(NSFont *font, NSColor *color, CGGlyph *glyphs, CGSize *a
- (void)_CG_drawHighlightForRun:(const WebCoreTextRun *)run style:(const WebCoreTextStyle *)style atPoint:(NSPoint)point
{
- float *widthBuffer, localWidthBuffer[LOCAL_BUFFER_SIZE];
- CGGlyph *glyphBuffer, localGlyphBuffer[LOCAL_BUFFER_SIZE];
- NSFont **fontBuffer, *localFontBuffer[LOCAL_BUFFER_SIZE];
- CGSize *advances, localAdvanceBuffer[LOCAL_BUFFER_SIZE];
- int numGlyphs = 0, i;
- float startX, startPosition;
- unsigned length = run->length;
-
if (run->length == 0)
return;
- if (length*MAX_GLYPH_EXPANSION > LOCAL_BUFFER_SIZE) {
- advances = (CGSize *)calloc(length*MAX_GLYPH_EXPANSION, sizeof(CGSize));
- widthBuffer = (float *)calloc(length*MAX_GLYPH_EXPANSION, sizeof(float));
- glyphBuffer = (CGGlyph *)calloc(length*MAX_GLYPH_EXPANSION, sizeof(ATSGlyphRef));
- fontBuffer = (NSFont **)calloc(length*MAX_GLYPH_EXPANSION, sizeof(NSFont *));
- } else {
- advances = localAdvanceBuffer;
- widthBuffer = localWidthBuffer;
- glyphBuffer = localGlyphBuffer;
- fontBuffer = localFontBuffer;
+ CharacterWidthIterator widthIterator;
+ WebCoreTextRun completeRun = *run;
+ completeRun.from = 0;
+ completeRun.to = run->length;
+ initializeCharacterWidthIterator(&widthIterator, self, &completeRun, style);
+
+ float startPosition = 0;
+ while (widthIterator.currentCharacter < (unsigned)run->from) {
+ startPosition += widthForNextCharacter(&widthIterator, 0, 0);
}
- [self _floatWidthForRun:run
- style:style
- widths:widthBuffer
- fonts:fontBuffer
- glyphs:glyphBuffer
- startPosition:&startPosition
- numGlyphs: &numGlyphs];
-
- // Eek. We couldn't generate ANY glyphs for the run.
- if (numGlyphs <= 0)
- return;
-
- // Fill the advances array.
- for (i = 0; i <= numGlyphs; i++){
- advances[i].width = widthBuffer[i];
- advances[i].height = 0;
+ float backgroundWidth = 0.0;
+ while (widthIterator.currentCharacter < (unsigned)run->to) {
+ backgroundWidth += widthForNextCharacter(&widthIterator, 0, 0);
}
// The starting point needs to be adjusted to account for the width of
// the glyphs at the start of the run.
- startX = startPosition + point.x;
+ float startX = startPosition + point.x;
if (style->backgroundColor != nil){
// Calculate the width of the selection background by adding
// up the advances of all the glyphs in the selection.
- float backgroundWidth = 0.0;
- for (i = 0; i < numGlyphs; i++)
- backgroundWidth += advances[i].width;
-
[style->backgroundColor set];
float yPos = point.y - [self ascent] - (lineGap/2);
if (style->rtl){
- WebCoreTextRun completeRun = *run;
- completeRun.from = 0;
- completeRun.to = run->length;
- float completeRunWidth = [self _floatWidthForRun:&completeRun
- style:style
- widths:nil
- fonts:nil
- glyphs:nil
- startPosition:nil
- numGlyphs: &numGlyphs];
+ float completeRunWidth = startPosition + backgroundWidth;
+ while (widthIterator.currentCharacter < run->length) {
+ completeRunWidth += widthForNextCharacter(&widthIterator, 0, 0);
+ }
[NSBezierPath fillRect:NSMakeRect(point.x + completeRunWidth - startPosition - backgroundWidth, yPos, backgroundWidth, [self lineSpacing])];
}
else
[NSBezierPath fillRect:NSMakeRect(startX, yPos, backgroundWidth, [self lineSpacing])];
}
-
- if (advances != localAdvanceBuffer) {
- free(advances);
- free(widthBuffer);
- free(glyphBuffer);
- free(fontBuffer);
- }
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list