[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:03:49 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 5ec9808a23ff5596328744e5660d702a50f83014
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Oct 20 18:09:26 2003 +0000
WebBrowser
Add a debug menu item to always use ATSU text drawing. This will be helpful
to the ATSU folks in performance tuning there API. Right now I see approx.
2X slowdown using ATSU.
Reviewed by Chris.
* Debug/DebugUtilities.m:
(-[DebugUtilities createDebugMenu]):
(-[BrowserDocument toggleAlternateProgress:]):
(-[BrowserDocument toggleUseATSUForAllTextDrawing:]):
WebKit
Fixed 3456103. Don't assert, just check for inappropriate state.
Reviewed by Hyatt
Add a debug menu item to always use ATSU text drawing. This will be helpful
to the ATSU folks in performance tuning there API. Right now I see approx.
2X slowdown using ATSU.
Also did some shuffling around of inline related stuff.
Reviewed by Chris.
* WebCoreSupport.subproj/WebTextRenderer.h:
* WebCoreSupport.subproj/WebTextRenderer.m:
(isControlCharacter):
(isAlternateSpace):
(isSpace):
(getUncachedWidth):
(widthFromMap):
(widthForGlyph):
(+[WebTextRenderer _setAlwaysUseATSU:]):
(glyphForCharacter):
(glyphForUnicodeCharacter):
(shouldUseATSU):
* WebView.subproj/WebView.m:
(+[WebView _setAlwaysUseATSU:]):
(-[WebView _progressCompleted:]):
* WebView.subproj/WebViewPrivate.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5227 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index c668041..8e7d032 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,33 @@
+2003-10-20 Richard Williamson <rjw at apple.com>
+
+ Fixed 3456103. Don't assert, just check for inappropriate state.
+ Reviewed by Hyatt
+
+ Add a debug menu item to always use ATSU text drawing. This will be helpful
+ to the ATSU folks in performance tuning there API. Right now I see approx.
+ 2X slowdown using ATSU.
+
+ Also did some shuffling around of inline related stuff.
+
+ Reviewed by Chris.
+
+ * WebCoreSupport.subproj/WebTextRenderer.h:
+ * WebCoreSupport.subproj/WebTextRenderer.m:
+ (isControlCharacter):
+ (isAlternateSpace):
+ (isSpace):
+ (getUncachedWidth):
+ (widthFromMap):
+ (widthForGlyph):
+ (+[WebTextRenderer _setAlwaysUseATSU:]):
+ (glyphForCharacter):
+ (glyphForUnicodeCharacter):
+ (shouldUseATSU):
+ * WebView.subproj/WebView.m:
+ (+[WebView _setAlwaysUseATSU:]):
+ (-[WebView _progressCompleted:]):
+ * WebView.subproj/WebViewPrivate.h:
+
2003-10-19 Chris Blumenberg <cblu at apple.com>
Fixed: <rdar://problem/3442218>: crash due to infinite recursion trying to load standalone plug-in content
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.h b/WebKit/WebCoreSupport.subproj/WebTextRenderer.h
index a52574f..2cdc60a 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.h
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.h
@@ -53,3 +53,11 @@ typedef struct CharacterWidthIterator CharacterWidthIterator;
- (id)initWithFont:(NSFont *)font usingPrinterFont:(BOOL)usingPrinterFont;
@end
+
+
+ at interface WebTextRenderer (WebPrivate)
+
++ (void)_setAlwaysUseATSU:(BOOL)f;
+
+ at end
+
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
index b083f64..b36561a 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
@@ -22,6 +22,39 @@
#import <float.h>
+// Macros
+#define SPACE 0x0020
+
+#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.
+#define CEIL_TO_INT(x) ((int)(x + 0.999)) /* ((int)(x + 1.0 - FLT_EPSILON)) */
+
+// MAX_GLYPH_EXPANSION is the maximum numbers of glyphs that may be
+// use to represent a single unicode code point.
+#define MAX_GLYPH_EXPANSION 4
+#define LOCAL_BUFFER_SIZE 2048
+
+// Covers Latin1.
+#define INITIAL_BLOCK_SIZE 0x200
+
+// Get additional blocks of glyphs and widths in bigger chunks.
+// This will typically be for other character sets.
+#define INCREMENTAL_BLOCK_SIZE 0x400
+
+#define UNINITIALIZED_GLYPH_WIDTH 65535
+
+// combining char, hangul jamo, or Apple corporate variant tag
+#define JunseongStart 0x1160
+#define JonseongEnd 0x11F9
+#define IsHangulConjoiningJamo(X) (X >= JunseongStart && X <= JonseongEnd)
+#define IsNonBaseChar(X) ((CFCharacterSetIsCharacterMember(nonBaseChars, X) || IsHangulConjoiningJamo(X) || (((X) & 0x1FFFF0) == 0xF870)))
+
+#define ATSFontRefFromNSFont(font) (FMGetATSFontRefFromFont((FMFont)[font _atsFontID]))
+
+#define SMALLCAPS_FONTSIZE_MULTIPLIER 0.7
+#define INVALID_WIDTH -(__FLT_MAX__)
// Datatypes
typedef float WebGlyphWidth;
@@ -78,80 +111,6 @@ struct CharacterWidthIterator
};
-// Character property functions.
-static inline BOOL isControlCharacter(UniChar c);
-static inline BOOL isAlternateSpace(UniChar c);
-static inline BOOL isSpace(UniChar c);
-static inline UniChar toUpper(UniChar c);
-static inline BOOL isUpper(UniChar c);
-
-
-// Map utility functions
-static void freeWidthMap (WidthMap *map);
-static void freeGlyphMap (GlyphMap *map);
-static inline ATSGlyphRef glyphForUnicodeCharacter (UnicodeGlyphMap *map, UnicodeChar c, NSFont **font);
-static inline SubstituteFontWidthMap *mapForSubstituteFont(WebTextRenderer *renderer, NSFont *font);
-static inline ATSGlyphRef glyphForCharacter (GlyphMap *map, UniChar c, NSFont **font);
-static inline SubstituteFontWidthMap *mapForSubstituteFont(WebTextRenderer *renderer, NSFont *font);
-static inline WebGlyphWidth widthFromMap (WebTextRenderer *renderer, WidthMap *map, ATSGlyphRef glyph, NSFont *font);
-static inline WebGlyphWidth widthForGlyph (WebTextRenderer *renderer, ATSGlyphRef glyph, NSFont *font);
-
-
-// Iterator functions
-static void initializeCharacterWidthIterator (CharacterWidthIterator *iterator, WebTextRenderer *renderer, const WebCoreTextRun *run , const WebCoreTextStyle *style);
-static float widthForNextCharacter (CharacterWidthIterator *iterator, ATSGlyphRef *glyphUsed, NSFont **fontUsed);
-
-
-// Misc.
-static BOOL fillStyleWithAttributes(ATSUStyle style, NSFont *theFont);
-#ifdef NEED_FINDLENGTHOFCHARACTERCLUSTER
-static unsigned findLengthOfCharacterCluster(const UniChar *characters, unsigned length);
-#endif
-static inline BOOL fontContainsString (NSFont *font, NSString *string);
-static inline BOOL shouldUseATSU(const WebCoreTextRun *run);
-static NSString *pathFromFont (NSFont *font);
-
-
-// Globals
-static CFCharacterSetRef nonBaseChars = NULL;
-static BOOL bufferTextDrawing = NO;
-static NSString *WebFallbackFontFamily = nil;
-
-
-// Macros
-#define SPACE 0x0020
-
-#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.
-#define CEIL_TO_INT(x) ((int)(x + 0.999)) /* ((int)(x + 1.0 - FLT_EPSILON)) */
-
-// MAX_GLYPH_EXPANSION is the maximum numbers of glyphs that may be
-// use to represent a single unicode code point.
-#define MAX_GLYPH_EXPANSION 4
-#define LOCAL_BUFFER_SIZE 2048
-
-// Covers Latin1.
-#define INITIAL_BLOCK_SIZE 0x200
-
-// Get additional blocks of glyphs and widths in bigger chunks.
-// This will typically be for other character sets.
-#define INCREMENTAL_BLOCK_SIZE 0x400
-
-#define UNINITIALIZED_GLYPH_WIDTH 65535
-
-// combining char, hangul jamo, or Apple corporate variant tag
-#define JunseongStart 0x1160
-#define JonseongEnd 0x11F9
-#define IsHangulConjoiningJamo(X) (X >= JunseongStart && X <= JonseongEnd)
-#define IsNonBaseChar(X) ((CFCharacterSetIsCharacterMember(nonBaseChars, X) || IsHangulConjoiningJamo(X) || (((X) & 0x1FFFF0) == 0xF870)))
-
-#define ATSFontRefFromNSFont(font) (FMGetATSFontRefFromFont((FMFont)[font _atsFontID]))
-
-#define SMALLCAPS_FONTSIZE_MULTIPLIER 0.7
-#define INVALID_WIDTH -(__FLT_MAX__)
-
// SPI from other frameworks.
@interface NSLanguage : NSObject
{}
@@ -170,6 +129,7 @@ static NSString *WebFallbackFontFamily = nil;
- (BOOL)_isFakeFixedPitch;
@end
+
// Internal API
@interface WebTextRenderer (WebInternal)
@@ -209,6 +169,125 @@ static NSString *WebFallbackFontFamily = nil;
@end
+// Character property functions.
+static inline BOOL isControlCharacter(UniChar c);
+static inline BOOL isAlternateSpace(UniChar c);
+static inline BOOL isSpace(UniChar c);
+static inline UniChar toUpper(UniChar c);
+static inline BOOL isUpper(UniChar c);
+
+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);
+}
+
+
+// Map utility functions
+static void freeWidthMap (WidthMap *map);
+static void freeGlyphMap (GlyphMap *map);
+static inline ATSGlyphRef glyphForUnicodeCharacter (UnicodeGlyphMap *map, UnicodeChar c, NSFont **font);
+static inline SubstituteFontWidthMap *mapForSubstituteFont(WebTextRenderer *renderer, NSFont *font);
+static inline ATSGlyphRef glyphForCharacter (GlyphMap *map, UniChar c, NSFont **font);
+static inline SubstituteFontWidthMap *mapForSubstituteFont(WebTextRenderer *renderer, NSFont *font);
+static inline WebGlyphWidth widthFromMap (WebTextRenderer *renderer, WidthMap *map, ATSGlyphRef glyph, NSFont *font);
+static inline WebGlyphWidth widthForGlyph (WebTextRenderer *renderer, ATSGlyphRef glyph, NSFont *font);
+
+static WebGlyphWidth getUncachedWidth(WebTextRenderer *renderer, WidthMap *map, ATSGlyphRef glyph, NSFont *font)
+{
+ WebGlyphWidth width;
+ BOOL errorResult;
+
+ if (font)
+ errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &glyph, 1, &width, [font pointSize]);
+ else
+ errorResult = CGFontGetGlyphScaledAdvances ([renderer->font _backingCGSFont], &glyph, 1, &width, [renderer->font pointSize]);
+ if (errorResult == 0)
+ FATAL_ALWAYS ("Unable to cache glyph widths for %@ %f", [renderer->font displayName], [renderer->font pointSize]);
+
+ // Hack to ensure that characters that match the width of the space character
+ // have the same integer width as the space character. This is necessary so
+ // glyphs in fixed pitch fonts all have the same integer width. We can't depend
+ // on the fixed pitch property of NSFont because that isn't set for all
+ // monospaced fonts, in particular Courier! This has the downside of inappropriately
+ // adjusting the widths of characters in non-monospaced fonts that are coincidentally
+ // the same width as a space in that font. In practice this is not an issue as the
+ // adjustment is always as the sub-pixel level.
+ if (width == renderer->spaceWidth)
+ return renderer->ceiledSpaceWidth;
+
+ return width;
+}
+
+static inline WebGlyphWidth widthFromMap (WebTextRenderer *renderer, WidthMap *map, ATSGlyphRef glyph, NSFont *font)
+{
+ WebGlyphWidth width = UNINITIALIZED_GLYPH_WIDTH;
+
+ while (1){
+ if (map == 0)
+ map = [renderer _extendGlyphToWidthMapToInclude: glyph font:font];
+
+ if (glyph >= map->startRange && glyph <= map->endRange){
+ width = map->widths[glyph - map->startRange].width;
+ if (width == UNINITIALIZED_GLYPH_WIDTH){
+ width = getUncachedWidth (renderer, map, glyph, font);
+ map->widths[glyph - map->startRange].width = width;
+ }
+ }
+ else {
+ map = map->next;
+ continue;
+ }
+
+ return width;
+ }
+ // never get here.
+ return 0;
+}
+
+static inline WebGlyphWidth widthForGlyph (WebTextRenderer *renderer, ATSGlyphRef glyph, NSFont *font)
+{
+ WidthMap *map;
+
+ if (font && font != renderer->font)
+ map = mapForSubstituteFont(renderer, font)->map;
+ else
+ map = renderer->glyphToWidthMap;
+
+ return widthFromMap (renderer, map, glyph, font);
+}
+
+// Iterator functions
+static void initializeCharacterWidthIterator (CharacterWidthIterator *iterator, WebTextRenderer *renderer, const WebCoreTextRun *run , const WebCoreTextStyle *style);
+static float widthForNextCharacter (CharacterWidthIterator *iterator, ATSGlyphRef *glyphUsed, NSFont **fontUsed);
+
+
+// Misc.
+static BOOL fillStyleWithAttributes(ATSUStyle style, NSFont *theFont);
+#ifdef NEED_FINDLENGTHOFCHARACTERCLUSTER
+static unsigned findLengthOfCharacterCluster(const UniChar *characters, unsigned length);
+#endif
+static inline BOOL fontContainsString (NSFont *font, NSString *string);
+static inline BOOL shouldUseATSU(const WebCoreTextRun *run);
+static NSString *pathFromFont (NSFont *font);
+
+
+// Globals
+static CFCharacterSetRef nonBaseChars = NULL;
+static BOOL bufferTextDrawing = NO;
+static NSString *WebFallbackFontFamily = nil;
+static BOOL alwaysUseATSU = NO;
+
+
@implementation WebTextRenderer
+ (BOOL)shouldBufferTextDrawing
@@ -488,6 +567,11 @@ static NSString *WebFallbackFontFamily = nil;
@implementation WebTextRenderer (WebInternal)
++ (void)_setAlwaysUseATSU:(BOOL)f
+{
+ alwaysUseATSU = f;
+}
+
- (void)_setIsSmallCapsRenderer:(BOOL)flag
{
isSmallCapsRenderer = flag;
@@ -1552,12 +1636,14 @@ static inline ATSGlyphRef glyphForCharacter (GlyphMap *map, UniChar c, NSFont **
if (map == 0)
return nonGlyphID;
- if (c >= map->startRange && c <= map->endRange){
- *font = map->glyphs[c-map->startRange].font;
- return map->glyphs[c-map->startRange].glyph;
+ while (map) {
+ if (c >= map->startRange && c <= map->endRange){
+ *font = map->glyphs[c-map->startRange].font;
+ return map->glyphs[c-map->startRange].glyph;
+ }
+ map = map->next;
}
-
- return glyphForCharacter (map->next, c, font);
+ return nonGlyphID;
}
@@ -1566,12 +1652,14 @@ static inline ATSGlyphRef glyphForUnicodeCharacter (UnicodeGlyphMap *map, Unicod
if (map == 0)
return nonGlyphID;
- if (c >= map->startRange && c <= map->endRange){
- *font = map->glyphs[c-map->startRange].font;
- return map->glyphs[c-map->startRange].glyph;
+ while (map) {
+ if (c >= map->startRange && c <= map->endRange){
+ *font = map->glyphs[c-map->startRange].font;
+ return map->glyphs[c-map->startRange].glyph;
+ }
+ map = map->next;
}
-
- return glyphForUnicodeCharacter (map->next, c, font);
+ return nonGlyphID;
}
@@ -1601,72 +1689,6 @@ static inline SubstituteFontWidthMap *mapForSubstituteFont(WebTextRenderer *rend
return &renderer->substituteFontWidthMaps[renderer->numSubstituteFontWidthMaps++];
}
-static inline WebGlyphWidth widthFromMap (WebTextRenderer *renderer, WidthMap *map, ATSGlyphRef glyph, NSFont *font)
-{
- WebGlyphWidth width = UNINITIALIZED_GLYPH_WIDTH;
- BOOL errorResult;
-
- while (1){
- if (map == 0)
- map = [renderer _extendGlyphToWidthMapToInclude: glyph font:font];
-
- if (glyph >= map->startRange && glyph <= map->endRange){
- width = map->widths[glyph-map->startRange].width;
- if (width == UNINITIALIZED_GLYPH_WIDTH){
-
-#ifdef _TIMING
- double startTime = CFAbsoluteTimeGetCurrent();
-#endif
- if (font)
- errorResult = CGFontGetGlyphScaledAdvances ([font _backingCGSFont], &glyph, 1, &map->widths[glyph-map->startRange].width, [font pointSize]);
- else
- errorResult = CGFontGetGlyphScaledAdvances ([renderer->font _backingCGSFont], &glyph, 1, &map->widths[glyph-map->startRange].width, [renderer->font pointSize]);
- if (errorResult == 0)
- FATAL_ALWAYS ("Unable to cache glyph widths for %@ %f", [renderer->font displayName], [renderer->font pointSize]);
-
-#ifdef _TIMING
- double thisTime = CFAbsoluteTimeGetCurrent() - startTime;
- totalCGGetAdvancesTime += thisTime;
-#endif
- width = map->widths[glyph-map->startRange].width;
- }
- }
-
- if (width == UNINITIALIZED_GLYPH_WIDTH){
- map = map->next;
- continue;
- }
-
- // Hack to ensure that characters that match the width of the space character
- // have the same integer width as the space character. This is necessary so
- // glyphs in fixed pitch fonts all have the same integer width. We can't depend
- // on the fixed pitch property of NSFont because that isn't set for all
- // monospaced fonts, in particular Courier! This has the downside of inappropriately
- // adjusting the widths of characters in non-monospaced fonts that are coincidentally
- // the same width as a space in that font. In practice this is not an issue as the
- // adjustment is always as the sub-pixel level.
- if (width == renderer->spaceWidth)
- return renderer->ceiledSpaceWidth;
-
- return width;
- }
- // never get here.
- return 0;
-}
-
-static inline WebGlyphWidth widthForGlyph (WebTextRenderer *renderer, ATSGlyphRef glyph, NSFont *font)
-{
- WidthMap *map;
-
- if (font && font != renderer->font)
- map = mapForSubstituteFont(renderer, font)->map;
- else
- map = renderer->glyphToWidthMap;
-
- return widthFromMap (renderer, map, glyph, font);
-}
-
-
static void initializeCharacterWidthIterator (CharacterWidthIterator *iterator, WebTextRenderer *renderer, const WebCoreTextRun *run , const WebCoreTextStyle *style)
{
iterator->needsShaping = initializeCharacterShapeIterator (&iterator->shapeIterator, run);
@@ -1991,6 +2013,9 @@ static inline BOOL shouldUseATSU(const WebCoreTextRun *run)
const UniChar *characters = run->characters;
int i, from = run->from, to = run->to;
+ if (alwaysUseATSU)
+ return YES;
+
for (i = from; i < to; i++){
c = characters[i];
if (c < 0x300) // Early continue to avoid other checks.
@@ -2015,21 +2040,6 @@ 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);
-}
-
static inline BOOL fontContainsString (NSFont *font, NSString *string)
{
if ([string rangeOfCharacterFromSet:[[font coveredCharacterSet] invertedSet]].location == NSNotFound) {
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index 3da8035..be27413 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -30,6 +30,7 @@
#import <WebKit/WebResourceLoadDelegate.h>
#import <WebKit/WebTextView.h>
#import <WebKit/WebTextRepresentation.h>
+#import <WebKit/WebTextRenderer.h>
#import <WebKit/WebViewPrivate.h>
#import <WebKit/WebUIDelegate.h>
@@ -138,9 +139,14 @@ NSString *_WebMainFrameURLKey = @"mainFrameURL";
@end
-
@implementation WebView (WebPrivate)
++ (void)_setAlwaysUseATSU:(BOOL)f
+{
+ [WebTextRenderer _setAlwaysUseATSU:f];
+}
+
+
+ (BOOL)canShowFile:(NSString *)path
{
NSString *MIMEType;
@@ -757,10 +763,12 @@ NSString *_WebMainFrameURLKey = @"mainFrameURL";
}
- (void)_progressCompleted:(WebFrame *)frame
-{
- ASSERT (_private->numProgressTrackedFrames > 0);
-
+{
LOG (Progress, "frame %p(%@), _private->numProgressTrackedFrames %d, _private->orginatingProgressFrame %p", frame, [frame name], _private->numProgressTrackedFrames, _private->orginatingProgressFrame);
+
+ if (_private->numProgressTrackedFrames <= 0)
+ return;
+
[self _willChangeValueForKey: @"estimatedProgress"];
_private->numProgressTrackedFrames--;
@@ -776,6 +784,11 @@ NSString *_WebMainFrameURLKey = @"mainFrameURL";
if (!con)
return;
+ LOG (Progress, "_private->numProgressTrackedFrames %d, _private->orginatingProgressFrame %p", _private->numProgressTrackedFrames, _private->orginatingProgressFrame);
+
+ if (_private->numProgressTrackedFrames <= 0)
+ return;
+
WebProgressItem *item = [[WebProgressItem alloc] init];
if (!item)
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index 417ca8b..a6d4b24 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -253,6 +253,7 @@ Could be worth adding to the API.
- (void)_didChangeValueForKey:(NSString *)key;
- (void)_reloadForPluginChanges;
++ (void)_setAlwaysUseATSU:(BOOL)f;
@end
@interface _WebSafeForwarder : NSObject
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list