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

cblu cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:30:30 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 18a4bbdd4ec7094d1e24704f8190bf95ff97f348
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Aug 9 07:25:52 2002 +0000

    %5 gain on cvs-static related to loading page icons:
    
    WebKit:
    
    	- Cache icon image for HTML files
    	- resize the icon only in WebIconLoader instead of in multiple places elsewhere
    
            * Misc.subproj/WebIconLoader.h:
            * Misc.subproj/WebIconLoader.m:
            (+[WebIconLoader _resizeImage:]):
            (+[WebIconLoader defaultIcon]): call _resizeImage
            (+[WebIconLoader iconForFileAtPath:]): added, caches html icon
            (-[WebIconLoader WebResourceHandleDidFinishLoading:data:]): call _resizeImage
            * WebView.subproj/WebDataSourcePrivate.m:
            (-[WebDataSource _loadIcon]): call iconForFileAtPath
    
    WebBrowser:
    
    	- resize the page icon in WebIconLoader instead of in multiple places elsewhere
    	- call resetNoDragRect less often
    
            * LocationTextField.h:
            * LocationTextField.m:
            (-[LocationTextField _setIcon:save:]): no need to resize
            * TitleBarButton.m:
            (-[TitleBarButton setImage:]): no need to resize
            (-[TitleBarButton resetNoDragRect]): renamed
            (-[TitleBarButton updateFrame]): no need to call resetNoDragRect
            (-[TitleBarButton viewDidEndLiveResize]): added, call resetNoDragRect
            (-[TitleBarButton windowDidEndSheet:]): call resetNoDragRect
            (-[TitleBarButton windowDidDeminiaturize:]): call resetNoDragRect
            (-[TitleBarButton setTitle:]): call resetNoDragRect
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1783 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index ecab3e0..6078791 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,17 @@
+2002-08-09  Chris Blumenberg  <cblu at apple.com>
+
+	- Cache icon image for HTML files
+	- resize the icon in WebIconLoader instead of in multiple places elsewhere
+
+        * Misc.subproj/WebIconLoader.h:
+        * Misc.subproj/WebIconLoader.m:
+        (+[WebIconLoader _resizeImage:]):
+        (+[WebIconLoader defaultIcon]): call _resizeImage
+        (+[WebIconLoader iconForFileAtPath:]): added, caches html icon
+        (-[WebIconLoader WebResourceHandleDidFinishLoading:data:]): call _resizeImage
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSource _loadIcon]): call iconForFileAtPath
+
 2002-08-08  Maciej Stachowiak  <mjs at apple.com>
 
 	Fix to get onLoad to fire, so the iBench test works.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index ecab3e0..6078791 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,17 @@
+2002-08-09  Chris Blumenberg  <cblu at apple.com>
+
+	- Cache icon image for HTML files
+	- resize the icon in WebIconLoader instead of in multiple places elsewhere
+
+        * Misc.subproj/WebIconLoader.h:
+        * Misc.subproj/WebIconLoader.m:
+        (+[WebIconLoader _resizeImage:]):
+        (+[WebIconLoader defaultIcon]): call _resizeImage
+        (+[WebIconLoader iconForFileAtPath:]): added, caches html icon
+        (-[WebIconLoader WebResourceHandleDidFinishLoading:data:]): call _resizeImage
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSource _loadIcon]): call iconForFileAtPath
+
 2002-08-08  Maciej Stachowiak  <mjs at apple.com>
 
 	Fix to get onLoad to fire, so the iBench test works.
diff --git a/WebKit/Misc.subproj/WebIconLoader.h b/WebKit/Misc.subproj/WebIconLoader.h
index 46296ee..9de69b0 100644
--- a/WebKit/Misc.subproj/WebIconLoader.h
+++ b/WebKit/Misc.subproj/WebIconLoader.h
@@ -13,12 +13,16 @@
 @class WebIconLoaderPrivate;
 @protocol WebResourceClient;
 
+#define IconWidth 16
+#define IconHeight 16
+
 @interface WebIconLoader : NSObject <WebResourceClient>
 {
     WebIconLoaderPrivate *_private;
 }
 
 + (NSImage *)defaultIcon;
++ (NSImage *)iconForFileAtPath:(NSString *)path;
 
 - initWithURL:(NSURL *)iconURL;
 - (void)setDelegate:(id)delegate;
diff --git a/WebKit/Misc.subproj/WebIconLoader.m b/WebKit/Misc.subproj/WebIconLoader.m
index 9f02a4f..3f07305 100644
--- a/WebKit/Misc.subproj/WebIconLoader.m
+++ b/WebKit/Misc.subproj/WebIconLoader.m
@@ -34,6 +34,12 @@
 
 @implementation WebIconLoader
 
++ (void)_resizeImage:(NSImage *)image
+{
+    [image setScalesWhenResized:YES];
+    [image setSize:NSMakeSize(IconWidth,IconHeight)];
+}
+
 + (NSImage *)defaultIcon
 {
     static NSImage *defaultIcon = nil;
@@ -46,6 +52,7 @@
             [[NSBundle bundleForClass:[self class]] pathForResource:@"url_icon" ofType:@"tiff"];
         if (pathForDefaultImage != nil) {
             defaultIcon = [[NSImage alloc] initByReferencingFile: pathForDefaultImage];
+            [[self class] _resizeImage:defaultIcon];
         }
         loadedDefaultImage = YES;
     }
@@ -53,6 +60,26 @@
     return defaultIcon;
 }
 
++ (NSImage *)iconForFileAtPath:(NSString *)path
+{
+    static NSImage *htmlIcon = nil;
+    NSImage *icon;
+
+    if([[path pathExtension] rangeOfString:@"htm"].length != 0){
+        if(!htmlIcon){
+            htmlIcon = [[[NSWorkspace sharedWorkspace] iconForFile:path] retain];
+            [[self class] _resizeImage:htmlIcon];
+        }
+        icon = htmlIcon;
+    }else{
+        icon = [[NSWorkspace sharedWorkspace] iconForFile:path];
+        [[self class] _resizeImage:icon];
+    }
+
+    return icon;
+}
+
+
 - initWithURL:(NSURL *)iconURL
 {
     [super init];
@@ -103,6 +130,7 @@
 {
     NSImage *image = [[NSImage alloc] initWithData:data];
     if (image) {
+        [[self class] _resizeImage:image];
         [_private->delegate iconLoader:self receivedPageIcon:image];
         [image release];
     }
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index e63ebbc..6c408c9 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -459,7 +459,7 @@
             NSURL *dataSourceURL = [self URL];
     
             if([dataSourceURL isFileURL]){
-                NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:[dataSourceURL path]];
+                NSImage *icon = [WebIconLoader iconForFileAtPath:[dataSourceURL path]];
                 [[_private->controller locationChangeHandler] receivedPageIcon:icon forDataSource:self];
             } else {
                 _private->iconURL = [[NSURL _web_URLWithString:@"/favicon.ico" relativeToURL:dataSourceURL] retain];

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list