Reviewed by Adele
authorbeidson <beidson@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Aug 2006 19:31:44 +0000 (19:31 +0000)
committerbeidson <beidson@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 23 Aug 2006 19:31:44 +0000 (19:31 +0000)
        Moved default URL icon from WebKit to WebCore

        * Resources/urlIcon.tiff: Added.
        * WebCore.xcodeproj/project.pbxproj:
        * loader/icon/IconDataCache.cpp:
        (WebCore::IconDataCache::loadImageFromResource):
        * loader/icon/IconDataCache.h:
        * loader/icon/IconDatabase.cpp:
        (WebCore::IconDatabase::IconDatabase):
        (WebCore::IconDatabase::defaultIcon):
        * loader/icon/IconDatabase.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@15992 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/Resources/urlIcon.tiff [new file with mode: 0644]
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/loader/icon/IconDataCache.cpp
WebCore/loader/icon/IconDataCache.h
WebCore/loader/icon/IconDatabase.cpp
WebCore/loader/icon/IconDatabase.h

index 27f89a5b83a316694127b2ca6a2a21757d8f0ef5..f98179bf48b5dcd5c4c83fac25022797466618b1 100644 (file)
@@ -1,3 +1,19 @@
+2006-08-23  Brady Eidson  <beidson@apple.com>
+
+        Reviewed by Adele
+
+        Moved default URL icon from WebKit to WebCore
+
+        * Resources/urlIcon.tiff: Added.
+        * WebCore.xcodeproj/project.pbxproj:
+        * loader/icon/IconDataCache.cpp:
+        (WebCore::IconDataCache::loadImageFromResource):
+        * loader/icon/IconDataCache.h:
+        * loader/icon/IconDatabase.cpp:
+        (WebCore::IconDatabase::IconDatabase):
+        (WebCore::IconDatabase::defaultIcon):
+        * loader/icon/IconDatabase.h:
+
 2006-08-23  Adam Roben  <aroben@apple.com>
 
         Reviewed by Darin, Adele.
diff --git a/WebCore/Resources/urlIcon.tiff b/WebCore/Resources/urlIcon.tiff
new file mode 100644 (file)
index 0000000..2b1b153
Binary files /dev/null and b/WebCore/Resources/urlIcon.tiff differ
index 3ce2fcd44b02445fe3016d3292b1c8acdde727bb..2b820038d7baf1cd2e594e9f24d7959519689707 100644 (file)
                4E19592C0A39DACC00220FE5 /* MediaQueryEvaluator.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959260A39DACC00220FE5 /* MediaQueryEvaluator.h */; };
                4E19592D0A39DACC00220FE5 /* MediaQueryExp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4E1959270A39DACC00220FE5 /* MediaQueryExp.cpp */; };
                4E19592E0A39DACC00220FE5 /* MediaQueryExp.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959280A39DACC00220FE5 /* MediaQueryExp.h */; };
+               5115095C0A9CE04700901013 /* urlIcon.tiff in Resources */ = {isa = PBXBuildFile; fileRef = 5115095B0A9CE04600901013 /* urlIcon.tiff */; };
                5126E6BB0A2E3B12005C29FA /* IconDatabase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5126E6B90A2E3B12005C29FA /* IconDatabase.cpp */; };
                5126E6BC0A2E3B12005C29FA /* IconDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 5126E6BA0A2E3B12005C29FA /* IconDatabase.h */; settings = {ATTRIBUTES = (Private, ); }; };
                5126E6BF0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 5126E6BD0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4E1959260A39DACC00220FE5 /* MediaQueryEvaluator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaQueryEvaluator.h; sourceTree = "<group>"; };
                4E1959270A39DACC00220FE5 /* MediaQueryExp.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MediaQueryExp.cpp; sourceTree = "<group>"; };
                4E1959280A39DACC00220FE5 /* MediaQueryExp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaQueryExp.h; sourceTree = "<group>"; };
+               5115095B0A9CE04600901013 /* urlIcon.tiff */ = {isa = PBXFileReference; lastKnownFileType = image.tiff; path = urlIcon.tiff; sourceTree = "<group>"; };
                5126E6B90A2E3B12005C29FA /* IconDatabase.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = IconDatabase.cpp; sourceTree = "<group>"; };
                5126E6BA0A2E3B12005C29FA /* IconDatabase.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = IconDatabase.h; sourceTree = "<group>"; };
                5126E6BD0A2E3B29005C29FA /* WebCoreIconDatabaseBridge.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebCoreIconDatabaseBridge.h; sourceTree = "<group>"; };
                089C1665FE841158C02AAC07 /* Resources */ = {
                        isa = PBXGroup;
                        children = (
+                               5115095B0A9CE04600901013 /* urlIcon.tiff */,
                                AB4261D70A2F6C9700BDD17D /* missingImage.tiff */,
                                84C0FA24052B966D000440A1 /* eastResizeCursor.tiff */,
                                84C0FA25052B966D000440A1 /* helpCursor.tiff */,
                                1CD4418F0A4CE76F00A007AB /* northSouthResizeCursor.tiff in Resources */,
                                1CD441900A4CE76F00A007AB /* northWestSouthEastResizeCursor.tiff in Resources */,
                                1A750D880A90E394000FF215 /* NodeIterator.idl in Resources */,
+                               5115095C0A9CE04700901013 /* urlIcon.tiff in Resources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index df68e29bd6f438d169e180a159cc04476d8effad..7c3ddb78e68ff858fd9267eef43e9201c0389f1c 100644 (file)
@@ -86,6 +86,15 @@ void IconDataCache::setImageData(unsigned char* data, int size)
     m_dataSet = true;
 }
 
+void IconDataCache::loadImageFromResource(const char* resource)
+{
+    if (!resource)
+        return;
+    delete m_image;
+    m_image = Image::loadResource(resource);
+    m_dataSet = true;
+}
+
 void IconDataCache::writeToDatabase(SQLDatabase& db)
 {
     if (m_iconURL.isEmpty())
index 7d16905fc2e8a603c3231038116a7e9b378743d0..f1814cda9833a73dcb98f3d9eaa118e10aee2b42 100644 (file)
@@ -51,6 +51,8 @@ public:
 
     void setImageData(unsigned char* data, int size);
     
+    void loadImageFromResource(const char*);
+    
     void writeToDatabase(SQLDatabase& db);
     
     ImageDataStatus imageDataStatus();
index b6f3b9f04f6fee55b07ded8460adb096b8015a47..f3522375d79747285f913d44daa974607fb4eb86 100644 (file)
@@ -93,6 +93,7 @@ IconDatabase* IconDatabase::sharedIconDatabase()
 
 IconDatabase::IconDatabase()
     : m_currentDB(&m_mainDB)
+    , m_defaultIconDataCache(0)
     , m_privateBrowsingEnabled(false)
     , m_startupTimer(this, &IconDatabase::pruneUnretainedIconsOnStartup)
     , m_updateTimer(this, &IconDatabase::updateDatabase)
@@ -328,7 +329,12 @@ String IconDatabase::iconURLForPageURL(const String& pageURL)
 
 Image* IconDatabase::defaultIcon(const IntSize& size)
 {
-    return 0;
+    if (!m_defaultIconDataCache) {
+        m_defaultIconDataCache = new IconDataCache("urlIcon");
+        m_defaultIconDataCache->loadImageFromResource("urlIcon");
+    }
+    
+    return m_defaultIconDataCache->getImage(size);
 }
 
 void IconDatabase::retainIconForPageURL(const String& pageURL)
index bd713f64c6a49d1407bc8efd741aa90ad72aab7a..655ec4ac363aa772d8ffc2169bbe8243d03a8460 100644 (file)
@@ -153,12 +153,13 @@ private:
     void loadIconFromURL(const String&);
     
     static IconDatabase* m_sharedInstance;
-    static const int DefaultCachedPageCount;
-    
+        
     SQLDatabase m_mainDB;
     SQLDatabase m_privateBrowsingDB;
     SQLDatabase* m_currentDB;
     
+    IconDataCache* m_defaultIconDataCache;
+    
     bool m_privateBrowsingEnabled;
     
     Timer<IconDatabase> m_startupTimer;