FontCache::getFontData() does not set the familyIndex to cAllFamiliesScanned if the...
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Aug 2011 16:46:13 +0000 (16:46 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 3 Aug 2011 16:46:13 +0000 (16:46 +0000)
https://bugs.webkit.org/show_bug.cgi?id=65597

Reviewed by Simon Fraser.

No test added because behavior is unchanged, but this saves a call to getFontData().

* platform/graphics/FontCache.cpp:
(WebCore::FontCache::getFontData): Eliminated early return inside the loop, allowing execution
to continue and familyIndex to be set.

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

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

index 5514c271ca66899dd4244e0b949a5af17dd01021..c185910b7fb6b002fd89c209cf64dc2ff3d093cd 100644 (file)
@@ -1,3 +1,16 @@
+2011-08-03  Dan Bernstein  <mitz@apple.com>
+
+        FontCache::getFontData() does not set the familyIndex to cAllFamiliesScanned if the last font is a custom font
+        https://bugs.webkit.org/show_bug.cgi?id=65597
+
+        Reviewed by Simon Fraser.
+
+        No test added because behavior is unchanged, but this saves a call to getFontData().
+
+        * platform/graphics/FontCache.cpp:
+        (WebCore::FontCache::getFontData): Eliminated early return inside the loop, allowing execution
+        to continue and familyIndex to be set.
+
 2011-08-03  Ryosuke Niwa  <rniwa@webkit.org>
 
         Add RenderedPosition
index f1ec9ef31c5546d02c2736b2df1fc0b7e13b3609..1c59cb7ddbd6f482adac5a3ff9596a60e68eef30 100644 (file)
@@ -394,7 +394,7 @@ size_t FontCache::inactiveFontDataCount()
 
 const FontData* FontCache::getFontData(const Font& font, int& familyIndex, FontSelector* fontSelector)
 {
-    SimpleFontData* result = 0;
+    FontData* result = 0;
 
     int startIndex = familyIndex;
     const FontFamily* startFamily = &font.fontDescription().family();
@@ -404,12 +404,11 @@ const FontData* FontCache::getFontData(const Font& font, int& familyIndex, FontS
     while (currFamily && !result) {
         familyIndex++;
         if (currFamily->family().length()) {
-            if (fontSelector) {
-                FontData* data = fontSelector->getFontData(font.fontDescription(), currFamily->family());
-                if (data)
-                    return data;
-            }
-            result = getCachedFontData(font.fontDescription(), currFamily->family());
+            if (fontSelector)
+                result = fontSelector->getFontData(font.fontDescription(), currFamily->family());
+
+            if (!result)
+                result = getCachedFontData(font.fontDescription(), currFamily->family());
         }
         currFamily = currFamily->next();
     }