Fix layout test regressions from r94352.
authormitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Sep 2011 00:16:30 +0000 (00:16 +0000)
committermitz@apple.com <mitz@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Sep 2011 00:16:30 +0000 (00:16 +0000)
Reviewed by Anders Carlsson.

* platform/graphics/mac/FontCacheMac.mm:
(WebCore::FontCache::getFontDataForCharacters): In the custom font case (that is, when there is
not base NSFont) always get and use the best variation.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/mac/FontCacheMac.mm

index d41de38252fe2dd53981401b7f90bdcfda3f147d..61731b728bae74c288b479dc5274c6a6444d8234 100644 (file)
@@ -1,3 +1,13 @@
+2011-09-01  Dan Bernstein  <mitz@apple.com>
+
+        Fix layout test regressions from r94352.
+
+        Reviewed by Anders Carlsson.
+
+        * platform/graphics/mac/FontCacheMac.mm:
+        (WebCore::FontCache::getFontDataForCharacters): In the custom font case (that is, when there is
+        not base NSFont) always get and use the best variation.
+
 2011-09-01  Ryosuke Niwa  <rniwa@webkit.org>
 
         Revert r94355 because it caused bunch of builds to break.
 2011-09-01  Ryosuke Niwa  <rniwa@webkit.org>
 
         Revert r94355 because it caused bunch of builds to break.
index fc119f190f3118cd7876ef02a72a6ec9c98fc07f..c6b9f0fc85467f88a63264364d80b881c5b46dec 100644 (file)
@@ -145,10 +145,10 @@ const SimpleFontData* FontCache::getFontDataForCharacters(const Font& font, cons
     NSFontTraitMask substituteFontTraits = [fontManager traitsOfFont:substituteFont];
     NSInteger substituteFontWeight = [fontManager weightOfFont:substituteFont];
 
     NSFontTraitMask substituteFontTraits = [fontManager traitsOfFont:substituteFont];
     NSInteger substituteFontWeight = [fontManager weightOfFont:substituteFont];
 
-    if (traits != substituteFontTraits || weight != substituteFontWeight) {
+    if (traits != substituteFontTraits || weight != substituteFontWeight || !nsFont) {
         if (NSFont *bestVariation = [fontManager fontWithFamily:[substituteFont familyName] traits:traits weight:weight size:size]) {
         if (NSFont *bestVariation = [fontManager fontWithFamily:[substituteFont familyName] traits:traits weight:weight size:size]) {
-            if (([fontManager traitsOfFont:bestVariation] != substituteFontTraits || [fontManager weightOfFont:bestVariation] != substituteFontWeight)
-                && [[bestVariation coveredCharacterSet] longCharacterIsMember:character])
+            if (!nsFont || (([fontManager traitsOfFont:bestVariation] != substituteFontTraits || [fontManager weightOfFont:bestVariation] != substituteFontWeight)
+                && [[bestVariation coveredCharacterSet] longCharacterIsMember:character]))
                 substituteFont = bestVariation;
         }
     }
                 substituteFont = bestVariation;
         }
     }