FontVerticalDataCache should allow zero as a key value
authorbashi@chromium.org <bashi@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Oct 2012 22:17:19 +0000 (22:17 +0000)
committerbashi@chromium.org <bashi@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Oct 2012 22:17:19 +0000 (22:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=98877

Reviewed by Tony Chang.

Use WTF::UnsignedWithZeroKeyHashTraits for type definition of
FontVerticalDataCache.

No new tests because there is no certain way to make
FontPlatformDataHarfBuzz::uniqueID() be zero.

* platform/graphics/FontCache.cpp:
(WebCore):
* platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp:
(WebCore::FontPlatformData::verticalData): Removed zero check of uniqueID().
(WebCore::FontPlatformData::openTypeTable): Ditto.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/FontCache.cpp
Source/WebCore/platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp

index 524429b..982306b 100644 (file)
@@ -1,3 +1,22 @@
+2012-10-10  Kenichi Ishibashi  <bashi@chromium.org>
+
+        FontVerticalDataCache should allow zero as a key value
+        https://bugs.webkit.org/show_bug.cgi?id=98877
+
+        Reviewed by Tony Chang.
+
+        Use WTF::UnsignedWithZeroKeyHashTraits for type definition of
+        FontVerticalDataCache.
+
+        No new tests because there is no certain way to make
+        FontPlatformDataHarfBuzz::uniqueID() be zero.
+
+        * platform/graphics/FontCache.cpp:
+        (WebCore):
+        * platform/graphics/harfbuzz/FontPlatformDataHarfBuzz.cpp:
+        (WebCore::FontPlatformData::verticalData): Removed zero check of uniqueID().
+        (WebCore::FontPlatformData::openTypeTable): Ditto.
+
 2012-10-10  Regina Chung  <heejin.r.chung@samsung.com>
 
         [EFL] Use the shareable GraphicsContext3DOpenGL* implementation.
index d04365a..3fea6c2 100644 (file)
@@ -228,7 +228,7 @@ FontPlatformData* FontCache::getCachedFontPlatformData(const FontDescription& fo
 }
 
 #if ENABLE(OPENTYPE_VERTICAL)
-typedef HashMap<FontCache::FontFileKey, OwnPtr<OpenTypeVerticalData> > FontVerticalDataCache;
+typedef HashMap<FontCache::FontFileKey, OwnPtr<OpenTypeVerticalData>, WTF::IntHash<FontCache::FontFileKey>, WTF::UnsignedWithZeroKeyHashTraits<FontCache::FontFileKey> > FontVerticalDataCache;
 
 FontVerticalDataCache& fontVerticalDataCacheInstance()
 {
index 2d9e86a..b9d5fc8 100644 (file)
@@ -350,16 +350,12 @@ static SkFontTableTag reverseByteOrder(uint32_t tableTag)
 
 const OpenTypeVerticalData* FontPlatformData::verticalData() const
 {
-    if (!uniqueID())
-        return 0;
     return fontCache()->getVerticalData(uniqueID(), *this);
 }
 
 PassRefPtr<SharedBuffer> FontPlatformData::openTypeTable(uint32_t table) const
 {
     RefPtr<SharedBuffer> buffer;
-    if (!uniqueID())
-        return buffer.release();
 
     SkFontTableTag tag = reverseByteOrder(table);
     const size_t tableSize = SkFontHost::GetTableSize(uniqueID(), tag);