Remove second-to-last client of WebFontCache
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Oct 2014 19:16:05 +0000 (19:16 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Oct 2014 19:16:05 +0000 (19:16 +0000)
https://bugs.webkit.org/show_bug.cgi?id=137550

Reviewed by Darin Adler.

Source/WebCore:

No new tests because no behavior change.

* WebCore.exp.in:
* platform/graphics/FontCache.h: Allow migration of client to getCachedFontData()

Source/WebKit/mac:

Use FontCache::getCachedFontData() instead of WebFontCache.

* WebView/WebHTMLView.mm:
(-[WebHTMLView _addToStyle:fontA:fontB:]):

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

Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/platform/graphics/FontCache.h
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebHTMLView.mm

index af17a6c..43e5ef2 100644 (file)
@@ -1,3 +1,15 @@
+2014-10-09  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Remove second-to-last client of WebFontCache
+        https://bugs.webkit.org/show_bug.cgi?id=137550
+
+        Reviewed by Darin Adler.
+
+        No new tests because no behavior change.
+
+        * WebCore.exp.in:
+        * platform/graphics/FontCache.h: Allow migration of client to getCachedFontData()
+
 2014-10-09  Chris Dumez  <cdumez@apple.com>
 
         [Mac] Spending too much time mapping desired font families to available ones
index a5aae4d..bcd1276 100644 (file)
@@ -1404,6 +1404,7 @@ __ZN7WebCore9FloatSizeC1ERK6CGSize
 __ZN7WebCore9FloatSizeC1ERKNS_7IntSizeE
 __ZN7WebCore9FontCache10invalidateEv
 __ZN7WebCore9FontCache13fontDataCountEv
+__ZN7WebCore9FontCache17getCachedFontDataERKNS_15FontDescriptionERKN3WTF12AtomicStringEbNS0_12ShouldRetainE
 __ZN7WebCore9FontCache21inactiveFontDataCountEv
 __ZN7WebCore9FontCache21purgeInactiveFontDataEi
 __ZN7WebCore9FontCache29purgeInactiveFontDataIfNeededEv
@@ -2744,7 +2745,6 @@ __ZN7WebCore8Settings23setNetworkInterfaceNameERKN3WTF6StringE
 __ZN7WebCore8Settings31setAudioSessionCategoryOverrideEj
 __ZN7WebCore8Settings34setNetworkDataUsageTrackingEnabledEb
 __ZN7WebCore8Settings38gShouldOptOutOfNetworkStateObservationE
-__ZN7WebCore9FontCache17getCachedFontDataERKNS_15FontDescriptionERKN3WTF12AtomicStringEbNS0_12ShouldRetainE
 __ZN7WebCore9FontCache25getLastResortFallbackFontERKNS_15FontDescriptionENS0_12ShouldRetainE
 __ZN7WebCore9FrameView17setScrollVelocityEdddd
 __ZN7WebCore9FrameView20setWasScrolledByUserEb
index 0b273e4..4bc9dfa 100644 (file)
@@ -133,7 +133,7 @@ public:
 
     void getTraitsInFamily(const AtomicString&, Vector<unsigned>&);
 
-    PassRefPtr<SimpleFontData> getCachedFontData(const FontDescription&, const AtomicString&, bool checkingAlternateName = false, ShouldRetain = Retain);
+    WEBCORE_EXPORT PassRefPtr<SimpleFontData> getCachedFontData(const FontDescription&, const AtomicString&, bool checkingAlternateName = false, ShouldRetain = Retain);
     WEBCORE_EXPORT PassRefPtr<SimpleFontData> getLastResortFallbackFont(const FontDescription&, ShouldRetain = Retain);
     SimpleFontData* getNonRetainedLastResortFallbackFont(const FontDescription&);
 
index 43486be..30003a2 100644 (file)
@@ -1,3 +1,15 @@
+2014-10-09  Myles C. Maxfield  <mmaxfield@apple.com>
+
+        Remove second-to-last client of WebFontCache
+        https://bugs.webkit.org/show_bug.cgi?id=137550
+
+        Reviewed by Darin Adler.
+
+        Use FontCache::getCachedFontData() instead of WebFontCache.
+
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _addToStyle:fontA:fontB:]):
+
 2014-10-09  Chris Dumez  <cdumez@apple.com>
 
         Use is<>() / downcast<>() for Widget subclasses
index 532dccc..93d38f0 100644 (file)
@@ -90,6 +90,7 @@
 #import <WebCore/ExceptionHandlers.h>
 #import <WebCore/FloatRect.h>
 #import <WebCore/FocusController.h>
+#import <WebCore/FontCache.h>
 #import <WebCore/Frame.h>
 #import <WebCore/FrameLoader.h>
 #import <WebCore/FrameSelection.h>
@@ -4894,13 +4895,16 @@ static PassRefPtr<KeyboardEvent> currentKeyboardEvent(Frame* coreFrame)
         // the Postscript name.
         
         // Find the font the same way the rendering code would later if it encountered this CSS.
-        NSFontTraitMask traits = aIsItalic ? NSFontItalicTrait : 0;
-        int weight = aIsBold ? STANDARD_BOLD_WEIGHT : STANDARD_WEIGHT;
-        NSFont *foundFont = [WebFontCache fontWithFamily:aFamilyName traits:traits weight:weight size:aPointSize];
+        FontDescription fontDescription;
+        fontDescription.setItalic(aIsItalic);
+        fontDescription.setWeight(aIsBold ? FontWeight900 : FontWeight500);
+        fontDescription.setSpecifiedSize(aPointSize);
+        FontCachePurgePreventer purgePreventer;
+        RefPtr<SimpleFontData> simpleFontData = fontCache().getCachedFontData(fontDescription, aFamilyName, false, WebCore::FontCache::DoNotRetain);
 
         // If we don't find a font with the same Postscript name, then we'll have to use the
         // Postscript name to make the CSS specific enough.
-        if (![[foundFont fontName] isEqualToString:[a fontName]])
+        if (![[simpleFontData->platformData().font() fontName] isEqualToString:[a fontName]])
             familyNameForCSS = [a fontName];
 
         // FIXME: Need more sophisticated escaping code if we want to handle family names