[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 07:54:36 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 3a8520af7a648cfdfc9672a98d88c4aee099380f
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Aug 28 23:17:07 2003 +0000

    	Fixed 3399736.  Fixed several problems with WebView/WebPreferences
    	interaction.
    
            Reviewed by Eric Seymour.
    
            * Misc.subproj/WebKitLogging.h:
            * Misc.subproj/WebKitLogging.m:
    	Added debug logging.
    
            * WebCoreSupport.subproj/WebTextRenderer.m:
            (_drawGlyphs): Checkin for 3398229 below.
    
            * WebView.subproj/WebPreferences.m:
            (-[WebPreferences initWithIdentifier:]):
            (-[WebPreferences initWithCoder:]):
            (-[WebPreferences encodeWithCoder:]):
            (+[WebPreferences standardPreferences]):
            (+[WebPreferences _getInstanceForIdentifier:]):
            (+[WebPreferences _setInstance:forIdentifier:]):
            (+[WebPreferences _concatenateKeyWithIBCreatorID:]):
            * WebView.subproj/WebView.m:
            (-[WebView _commonInitializationWithFrameName:groupName:]):
            (-[WebView initWithCoder:]):
            (-[WebView encodeWithCoder:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4913 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 6433de9..0c762a7 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,30 @@
+2003-08-28  Richard Williamson   <rjw at apple.com>
+
+	Fixed 3399736.  Fixed several problems with WebView/WebPreferences
+	interaction.
+
+        Reviewed by Eric Seymour.
+
+        * Misc.subproj/WebKitLogging.h:
+        * Misc.subproj/WebKitLogging.m:
+	Added debug logging.
+
+        * WebCoreSupport.subproj/WebTextRenderer.m:
+        (_drawGlyphs): Checkin for 3398229 below.
+
+        * WebView.subproj/WebPreferences.m:
+        (-[WebPreferences initWithIdentifier:]):
+        (-[WebPreferences initWithCoder:]):
+        (-[WebPreferences encodeWithCoder:]):
+        (+[WebPreferences standardPreferences]):
+        (+[WebPreferences _getInstanceForIdentifier:]):
+        (+[WebPreferences _setInstance:forIdentifier:]):
+        (+[WebPreferences _concatenateKeyWithIBCreatorID:]):
+        * WebView.subproj/WebView.m:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+        (-[WebView initWithCoder:]):
+        (-[WebView encodeWithCoder:]):
+
 2003-08-27  Richard Williamson   <rjw at apple.com>
 
 	Fixed 3398229.  When we request a font from NSFont by name we should use a case specific name.  We do case insensitve comparsion, but once a match is found we should use the actual font name, not the requested name.  Two layout tests are still failing, but I don't think the failures are font related.
diff --git a/WebKit/Misc.subproj/WebKitLogging.h b/WebKit/Misc.subproj/WebKitLogging.h
index 2df6c8a..fbcfa9d 100644
--- a/WebKit/Misc.subproj/WebKitLogging.h
+++ b/WebKit/Misc.subproj/WebKitLogging.h
@@ -36,3 +36,5 @@ extern WebLogChannel WebKitLogFileDatabaseActivity;
 extern WebLogChannel WebKitLogHistory;
 
 extern WebLogChannel WebKitLogBindings;
+
+extern WebLogChannel WebKitLogEncoding;
diff --git a/WebKit/Misc.subproj/WebKitLogging.m b/WebKit/Misc.subproj/WebKitLogging.m
index 023696a..3ac1a99 100644
--- a/WebKit/Misc.subproj/WebKitLogging.m
+++ b/WebKit/Misc.subproj/WebKitLogging.m
@@ -33,3 +33,5 @@ WebLogChannel WebKitLogHistory =                { 0x00800000, "WebKitLogLevel",
 
 WebLogChannel WebKitLogBindings =               { 0x01000000, "WebKitLogLevel", WebLogChannelUninitialized };
 
+WebLogChannel WebKitLogEncoding =               { 0x04000000, "WebKitLogLevel", WebLogChannelUninitialized };
+
diff --git a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
index 8d5a174..f9a1611 100644
--- a/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
+++ b/WebKit/WebCoreSupport.subproj/WebTextRenderer.m
@@ -980,10 +980,25 @@ static void _drawGlyphs(NSFont *font, NSColor *color, CGGlyph *glyphs, CGSize *a
         [gBuffer addGlyphs: glyphs advances: advances count: numGlyphs at: x : y];
     }
     else {
-        cgContext = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
+        NSGraphicsContext *gContext = [NSGraphicsContext currentContext];
+        cgContext = (CGContextRef)[gContext graphicsPort];
         // Setup the color and font.
+        
+        if ([gContext isDrawingToScreen]){
+            NSFont *screenFont = [font screenFont];
+            if (screenFont != font){
+                NSLog (@"Attempting to set non-screen font (%@) when drawing to screen.  Using screen font anyway, may result in incorrect metrics.", [[[font fontDescriptor] fontAttributes] objectForKey: NSFontNameAttribute]);
+            }
+            [[font screenFont] set];
+        }
+        else {
+            NSFont *printerFont = [font printerFont];
+            if (printerFont != font){
+                NSLog (@"Attempting to set non-printer font (%@) when printing.  Using printer font anyway, may result in incorrect metrics.", [[[font fontDescriptor] fontAttributes] objectForKey: NSFontNameAttribute]);
+            }
+            [printerFont set];
+        }
         [color set];
-        [font set];
 
         CGContextSetTextPosition (cgContext, x, y);
         CGContextShowGlyphsWithAdvances (cgContext, glyphs, advances, numGlyphs);
diff --git a/WebKit/WebView.subproj/WebPreferences.m b/WebKit/WebView.subproj/WebPreferences.m
index bfbb791..336b699 100644
--- a/WebKit/WebView.subproj/WebPreferences.m
+++ b/WebKit/WebView.subproj/WebPreferences.m
@@ -5,6 +5,7 @@
 
 #import <WebKit/WebPreferencesPrivate.h>
 
+#import <WebKit/WebKitLogging.h>
 #import <WebKit/WebKitNSStringExtras.h>
 #import <WebKit/WebNSURLExtras.h>
 
@@ -45,7 +46,7 @@
 
 NSString *WebPreferencesChangedNotification = @"WebPreferencesChangedNotification";
 
-#define KEY(x) [self _concatenateKeyWithIBCreatorID:[(_private->identifier?_private->identifier:@"") stringByAppendingString:x]]
+#define KEY(x) [(_private->identifier?_private->identifier:@"") stringByAppendingString:x]
 
 enum { WebPreferencesVersion = 1 };
 
@@ -70,7 +71,7 @@ enum { WebPreferencesVersion = 1 };
 @end
 
 @interface WebPreferences (WebInternal)
-- (NSString *)_concatenateKeyWithIBCreatorID:(NSString *)key;
++ (NSString *)_concatenateKeyWithIBCreatorID:(NSString *)key;
 + (NSString *)_IBCreatorID;
 @end
 
@@ -81,16 +82,15 @@ enum { WebPreferencesVersion = 1 };
     return [self initWithIdentifier:nil];
 }
 
+static WebPreferences *_standardPreferences = nil;
+
 - (id)initWithIdentifier:(NSString *)anIdentifier
 {
     [super init];
-    
-    if (anIdentifier == nil)
-        anIdentifier = @"";
-        
+
     _private = [[WebPreferencesPrivate alloc] init];
     _private->IBCreatorID = [[WebPreferences _IBCreatorID] retain];
-    
+
     WebPreferences *instance = [[self class] _getInstanceForIdentifier:anIdentifier];
     if (instance){
         [self release];
@@ -122,6 +122,7 @@ NS_DURING
     if ([decoder allowsKeyedCoding]){
         _private->identifier = [[decoder decodeObjectForKey:@"Identifier"] retain];
         _private->values = [[decoder decodeObjectForKey:@"Values"] retain];
+        LOG (Encoding, "Identifier = %@, Values = %@\n", _private->identifier, _private->values);
     }
     else {
         [decoder decodeValueOfObjCType:@encode(int) at:&version];
@@ -158,6 +159,7 @@ NS_ENDHANDLER
     if ([encoder allowsKeyedCoding]){
         [encoder encodeObject:_private->identifier forKey:@"Identifier"];
         [encoder encodeObject:_private->values forKey:@"Values"];
+        LOG (Encoding, "Identifier = %@, Values = %@\n", _private->identifier, _private->values);
     }
     else {
         int version = WebPreferencesVersion;
@@ -169,8 +171,6 @@ NS_ENDHANDLER
 
 + (WebPreferences *)standardPreferences
 {
-    static WebPreferences *_standardPreferences = nil;
-
     if (_standardPreferences == nil) {
         _standardPreferences = [[WebPreferences alloc] init];
         [_standardPreferences setAutosaves:YES];
@@ -560,7 +560,16 @@ static NSMutableDictionary *webPreferencesInstances = nil;
 
 + (WebPreferences *)_getInstanceForIdentifier:(NSString *)ident
 {
-    WebPreferences *instance = [webPreferencesInstances objectForKey:ident];
+        LOG (Encoding, "requesting for %@\n", ident);
+
+    if (!ident){
+        if(_standardPreferences)
+            return _standardPreferences;
+        return nil;
+    }    
+    
+    WebPreferences *instance = [webPreferencesInstances objectForKey:[self _concatenateKeyWithIBCreatorID:ident]];
+
     return instance;
 }
 
@@ -568,7 +577,10 @@ static NSMutableDictionary *webPreferencesInstances = nil;
 {
     if (!webPreferencesInstances)
         webPreferencesInstances = [[NSMutableDictionary alloc] init];
-    [webPreferencesInstances setObject:instance forKey:ident];
+    if (ident) {
+        [webPreferencesInstances setObject:instance forKey:[self _concatenateKeyWithIBCreatorID:ident]];
+        LOG (Encoding, "recording %p for %@\n", instance, [self _concatenateKeyWithIBCreatorID:ident]);
+    }
 }
 
 + (void)_removeReferenceForIdentifier:(NSString *)ident
@@ -583,6 +595,7 @@ static NSMutableDictionary *webPreferencesInstances = nil;
                     userInfo:nil];
 }
 
+// This may NOT be used by IB anymore.  Check we Eric S. to see if we can remove.
 + (NSArray *)_userDefaultsKeysForIB
 {
     return [NSArray arrayWithObjects:
@@ -623,7 +636,7 @@ static NSString *classIBCreatorID = 0;
     return classIBCreatorID;
 }
 
-- (NSString *)_concatenateKeyWithIBCreatorID:(NSString *)key
++ (NSString *)_concatenateKeyWithIBCreatorID:(NSString *)key
 {
     NSString *IBCreatorID = [WebPreferences _IBCreatorID];
     if (!IBCreatorID)
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index e9a807c..737f99e 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -93,7 +93,7 @@ enum { WebViewVersion = 2 };
     return [WebFrameView _canShowMIMETypeAsHTML:MIMEType];
 }
 
-- (void)_commonInitializationFrameName:(NSString *)frameName groupName:(NSString *)groupName
+- (void)_commonInitializationWithFrameName:(NSString *)frameName groupName:(NSString *)groupName
 {
     NSRect f = [self frame];
     WebFrameView *wv = [[WebFrameView alloc] initWithFrame: NSMakeRect(0,0,f.size.width,f.size.height)];
@@ -101,20 +101,21 @@ enum { WebViewVersion = 2 };
     [self addSubview: wv];
     [wv release];
 
-    _private = [[WebViewPrivate alloc] init];
     _private->mainFrame = [[WebFrame alloc] initWithName: frameName webFrameView: wv  webView: self];
     [self setGroupName:groupName];
 
-    [self setMaintainsBackForwardList: YES];
-
     ++WebViewCount;
 
-    [self _updateWebCoreSettingsFromPreferences: [WebPreferences standardPreferences]];
+    [self _registerDraggedTypes];
 
+    // Update WebCore with preferences.  These values will either come from an archived WebPreferences,
+    // or from the standard preferences, depending on whether this method was called from initWithCoder:
+    // or initWithFrame, respectively.
+    [self _updateWebCoreSettingsFromPreferences: [self preferences]];
+    
+    // Register to receive notifications whenever preference values change.
     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesChangedNotification:)
                                                  name:WebPreferencesChangedNotification object:[self preferences]];
-
-    [self _registerDraggedTypes];
 }
 
 - init
@@ -131,38 +132,48 @@ enum { WebViewVersion = 2 };
 - initWithFrame: (NSRect)f frameName: (NSString *)frameName groupName: (NSString *)groupName;
 {
     [super initWithFrame: f];
-    [self _commonInitializationFrameName:frameName groupName:groupName];
+    _private = [[WebViewPrivate alloc] init];
+    [self _commonInitializationWithFrameName:frameName groupName:groupName];
+    [self setMaintainsBackForwardList: YES];
     return self;
 }
 
 - (id)initWithCoder:(NSCoder *)decoder
 {
-    volatile id result = nil;
+    WebView *result = nil;
 
 NS_DURING
 
+    NSString *frameName;
+    NSString *groupName;
+    
     result = [super initWithCoder:decoder];
-    // We don't want any of the archived subviews.
+    result->_private = [[WebViewPrivate alloc] init];
+    
+    // We don't want any of the archived subviews.  The subviews will always
+    // be created in _commonInitializationFrameName:groupName:.
     [[result subviews] makeObjectsPerformSelector:@selector(removeFromSuperview)];
     
     if ([decoder allowsKeyedCoding]){
-        NSString *frameName = [decoder decodeObjectForKey:@"FrameName"];
-        NSString *groupName = [decoder decodeObjectForKey:@"GroupName"];
-        [result _commonInitializationFrameName:frameName groupName:groupName];
+        frameName = [decoder decodeObjectForKey:@"FrameName"];
+        groupName = [decoder decodeObjectForKey:@"GroupName"];
+                
         [result setPreferences: [decoder decodeObjectForKey:@"Preferences"]];
-	_private->useBackForwardList = [decoder decodeBoolForKey:@"UseBackForwardList"];
+	result->_private->useBackForwardList = [decoder decodeBoolForKey:@"UseBackForwardList"];
+
+        LOG (Encoding, "FrameName = %@, GroupName = %@, useBackForwardList = %d\n", frameName, groupName, (int)_private->useBackForwardList);
     }
     else {
         int version;
     
         [decoder decodeValueOfObjCType:@encode(int) at:&version];
-        NSString *frameName = [decoder decodeObject];
-        NSString *groupName = [decoder decodeObject];
-        [result _commonInitializationFrameName:frameName groupName:groupName];
+        frameName = [decoder decodeObject];
+        groupName = [decoder decodeObject];
         [result setPreferences: [decoder decodeObject]];
         if (version > 1)
-            [decoder decodeValuesOfObjCTypes:"c",&_private->useBackForwardList];
+            [decoder decodeValuesOfObjCTypes:"c",&result->_private->useBackForwardList];
     }
+    [result _commonInitializationWithFrameName:frameName groupName:groupName];
     
 NS_HANDLER
 
@@ -183,6 +194,8 @@ NS_ENDHANDLER
         [encoder encodeObject:[self groupName] forKey:@"GroupName"];
         [encoder encodeObject:[self preferences] forKey:@"Preferences"];
 	[encoder encodeBool:_private->useBackForwardList forKey:@"UseBackForwardList"];
+
+        LOG (Encoding, "FrameName = %@, GroupName = %@, useBackForwardList = %d\n", [[self mainFrame] name], [self groupName], (int)_private->useBackForwardList);
     }
     else {
         int version = WebViewVersion;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list