Title: [261166] trunk/Source
Revision
261166
Author
[email protected]
Date
2020-05-05 07:39:16 -0700 (Tue, 05 May 2020)

Log Message

Remove now-unneeded HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
https://bugs.webkit.org/show_bug.cgi?id=211428

Reviewed by Anders Carlsson.

Source/WebCore:

* platform/graphics/Font.h: Removed isUserInstalledFont, only used for
an assertion that I took the liberty of removing.

* platform/graphics/FontCascadeFonts.cpp:
(WebCore::FontCascadeFonts::glyphDataForSystemFallback): Removed an
assertion since it was the only reason to introduce the concept of a
user-installed font to the cross-platform code. The assertion is a bit
of a self-check that doesn't seem critical.

* platform/graphics/cocoa/FontCacheCoreText.cpp:
(WebCore::FontDatabase::singleton): Deleted.
(WebCore::FontDatabase::singletonAllowingUserInstalledFonts): Remove
HAVE(DISALLOWABLE_USER_INSTALLED_FONTS).
(WebCore::FontDatabase::singletonDisallowingUserInstalledFonts): Ditto.
(WebCore::isUserInstalledFont): Ditto.
(WebCore::addAttributesForInstalledFonts): Ditto.
(WebCore::isFontMatchingUserInstalledFontFallback): Ditto.
(WebCore::addAttributesForWebFonts): Ditto.
(WebCore::installedFontMandatoryAttributes): Ditto.

* platform/graphics/mac/SimpleFontDataCoreText.cpp:
(WebCore::Font::isUserInstalledFont const): Deleted.

Source/WTF:

* wtf/PlatformHave.h: Don't define HAVE_DISALLOWABLE_USER_INSTALLED_FONTS.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (261165 => 261166)


--- trunk/Source/WTF/ChangeLog	2020-05-05 14:36:50 UTC (rev 261165)
+++ trunk/Source/WTF/ChangeLog	2020-05-05 14:39:16 UTC (rev 261166)
@@ -1,3 +1,12 @@
+2020-05-05  Darin Adler  <[email protected]>
+
+        Remove now-unneeded HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
+        https://bugs.webkit.org/show_bug.cgi?id=211428
+
+        Reviewed by Anders Carlsson.
+
+        * wtf/PlatformHave.h: Don't define HAVE_DISALLOWABLE_USER_INSTALLED_FONTS.
+
 2020-05-04  Darin Adler  <[email protected]>
 
         [Mac] Remove __MAC_OS_X_VERSION_MIN_REQUIRED checks for versions older than 10.14

Modified: trunk/Source/WTF/wtf/PlatformHave.h (261165 => 261166)


--- trunk/Source/WTF/wtf/PlatformHave.h	2020-05-05 14:36:50 UTC (rev 261165)
+++ trunk/Source/WTF/wtf/PlatformHave.h	2020-05-05 14:39:16 UTC (rev 261166)
@@ -442,10 +442,6 @@
 #define HAVE_MDNS_FAST_REGISTRATION 1
 #endif
 
-#if PLATFORM(COCOA)
-#define HAVE_DISALLOWABLE_USER_INSTALLED_FONTS 1
-#endif
-
 #if PLATFORM(COCOA) && !(PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101500) && !PLATFORM(WATCHOS) && !PLATFORM(APPLETV)
 #define HAVE_CTFONTCREATEFORCHARACTERSWITHLANGUAGEANDOPTION 1
 #endif

Modified: trunk/Source/WebCore/ChangeLog (261165 => 261166)


--- trunk/Source/WebCore/ChangeLog	2020-05-05 14:36:50 UTC (rev 261165)
+++ trunk/Source/WebCore/ChangeLog	2020-05-05 14:39:16 UTC (rev 261166)
@@ -1,3 +1,33 @@
+2020-05-05  Darin Adler  <[email protected]>
+
+        Remove now-unneeded HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
+        https://bugs.webkit.org/show_bug.cgi?id=211428
+
+        Reviewed by Anders Carlsson.
+
+        * platform/graphics/Font.h: Removed isUserInstalledFont, only used for
+        an assertion that I took the liberty of removing.
+
+        * platform/graphics/FontCascadeFonts.cpp:
+        (WebCore::FontCascadeFonts::glyphDataForSystemFallback): Removed an
+        assertion since it was the only reason to introduce the concept of a
+        user-installed font to the cross-platform code. The assertion is a bit
+        of a self-check that doesn't seem critical.
+
+        * platform/graphics/cocoa/FontCacheCoreText.cpp:
+        (WebCore::FontDatabase::singleton): Deleted.
+        (WebCore::FontDatabase::singletonAllowingUserInstalledFonts): Remove
+        HAVE(DISALLOWABLE_USER_INSTALLED_FONTS).
+        (WebCore::FontDatabase::singletonDisallowingUserInstalledFonts): Ditto.
+        (WebCore::isUserInstalledFont): Ditto.
+        (WebCore::addAttributesForInstalledFonts): Ditto.
+        (WebCore::isFontMatchingUserInstalledFontFallback): Ditto.
+        (WebCore::addAttributesForWebFonts): Ditto.
+        (WebCore::installedFontMandatoryAttributes): Ditto.
+
+        * platform/graphics/mac/SimpleFontDataCoreText.cpp:
+        (WebCore::Font::isUserInstalledFont const): Deleted.
+
 2020-05-05  Alicia Boya GarcĂ­a  <[email protected]>
 
         [GStreamer] Video loops when ran in rr record --chaos

Modified: trunk/Source/WebCore/platform/graphics/Font.h (261165 => 261166)


--- trunk/Source/WebCore/platform/graphics/Font.h	2020-05-05 14:36:50 UTC (rev 261165)
+++ trunk/Source/WebCore/platform/graphics/Font.h	2020-05-05 14:39:16 UTC (rev 261166)
@@ -205,10 +205,6 @@
     const BitVector& glyphsSupportedByAllPetiteCaps() const;
 #endif
 
-#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
-    bool isUserInstalledFont() const;
-#endif
-
     bool canRenderCombiningCharacterSequence(const UChar*, size_t) const;
     void applyTransforms(GlyphBuffer&, unsigned beginningIndex, bool enableKerning, bool requiresShaping, const AtomString& locale) const;
 

Modified: trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp (261165 => 261166)


--- trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp	2020-05-05 14:36:50 UTC (rev 261165)
+++ trunk/Source/WebCore/platform/graphics/FontCascadeFonts.cpp	2020-05-05 14:39:16 UTC (rev 261166)
@@ -351,10 +351,6 @@
     if (!systemFallbackFont)
         return GlyphData();
 
-#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
-    ASSERT(!systemFallbackFont->isUserInstalledFont() || description.shouldAllowUserInstalledFonts() == AllowUserInstalledFonts::Yes);
-#endif
-
     if (systemFallbackShouldBeInvisible)
         systemFallbackFont = const_cast<Font*>(&systemFallbackFont->invisibleFont());
 

Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (261165 => 261166)


--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2020-05-05 14:36:50 UTC (rev 261165)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp	2020-05-05 14:39:16 UTC (rev 261166)
@@ -850,32 +850,16 @@
 
 class FontDatabase {
 public:
-#if !HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
-    static FontDatabase& singleton()
-    {
-        static NeverDestroyed<FontDatabase> database(AllowUserInstalledFonts::Yes);
-        return database;
-    }
-#endif
-
     static FontDatabase& singletonAllowingUserInstalledFonts()
     {
-#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
         static NeverDestroyed<FontDatabase> database(AllowUserInstalledFonts::Yes);
         return database;
-#else
-        return singleton();
-#endif
     }
 
     static FontDatabase& singletonDisallowingUserInstalledFonts()
     {
-#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
         static NeverDestroyed<FontDatabase> database(AllowUserInstalledFonts::No);
         return database;
-#else
-        return singleton();
-#endif
     }
 
     FontDatabase(const FontDatabase&) = delete;
@@ -1397,19 +1381,15 @@
 #endif
 
 #if ASSERT_ENABLED
-static inline bool isUserInstalledFont(CTFontRef font)
+static bool isUserInstalledFont(CTFontRef font)
 {
-#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
-    auto isUserInstalledFont = adoptCF(static_cast<CFBooleanRef>(CTFontCopyAttribute(font, kCTFontUserInstalledAttribute)));
-    return isUserInstalledFont && CFBooleanGetValue(isUserInstalledFont.get());
-#else
-    UNUSED_PARAM(font);
-    return false;
+    auto attribute = adoptCF(static_cast<CFBooleanRef>(CTFontCopyAttribute(font, kCTFontUserInstalledAttribute)));
+    return attribute && CFBooleanGetValue(attribute.get());
+}
 #endif
-}
-#endif // ASSERT_ENABLED
 
-#if !USE(PLATFORM_SYSTEM_FALLBACK_LIST) && (PLATFORM(MAC) || (PLATFORM(IOS_FAMILY) && TARGET_OS_IOS))
+// FIXME: Why not do this on watchOS and tvOS?
+#if !USE(PLATFORM_SYSTEM_FALLBACK_LIST) && (PLATFORM(MAC) || PLATFORM(IOS))
 static RetainPtr<CTFontRef> createFontForCharacters(CTFontRef font, CFStringRef localeString, AllowUserInstalledFonts, const UChar* characters, unsigned length)
 {
     CFIndex coveredLength = 0;
@@ -1435,7 +1415,8 @@
     ASSERT(length > 0);
 
     RetainPtr<CFStringRef> localeString;
-#if (PLATFORM(IOS_FAMILY) && TARGET_OS_IOS) || PLATFORM(MAC)
+// FIXME: Why not do this on watchOS and tvOS?
+#if PLATFORM(IOS) || PLATFORM(MAC)
     if (!locale.isNull())
         localeString = locale.string().createCFString();
 #else
@@ -1553,7 +1534,6 @@
 
 void addAttributesForInstalledFonts(CFMutableDictionaryRef attributes, AllowUserInstalledFonts allowUserInstalledFonts)
 {
-#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
     if (allowUserInstalledFonts == AllowUserInstalledFonts::No) {
         CFDictionaryAddValue(attributes, kCTFontUserInstalledAttribute, kCFBooleanFalse);
         CTFontFallbackOption fallbackOption = kCTFontFallbackOptionSystem;
@@ -1560,10 +1540,6 @@
         auto fallbackOptionNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &fallbackOption));
         CFDictionaryAddValue(attributes, kCTFontFallbackOptionAttribute, fallbackOptionNumber.get());
     }
-#else
-    UNUSED_PARAM(attributes);
-    UNUSED_PARAM(allowUserInstalledFonts);
-#endif
 }
 
 RetainPtr<CTFontRef> createFontForInstalledFonts(CTFontDescriptorRef fontDescriptor, CGFloat size, AllowUserInstalledFonts allowUserInstalledFonts)
@@ -1579,7 +1555,6 @@
 
 static inline bool isFontMatchingUserInstalledFontFallback(CTFontRef font, AllowUserInstalledFonts allowUserInstalledFonts)
 {
-#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
     bool willFallbackToSystemOnly = false;
     if (auto fontFallbackOptionAttributeRef = adoptCF(static_cast<CFNumberRef>(CTFontCopyAttribute(font, kCTFontFallbackOptionAttribute)))) {
         int64_t fontFallbackOptionAttribute;
@@ -1589,11 +1564,6 @@
 
     bool shouldFallbackToSystemOnly = allowUserInstalledFonts == AllowUserInstalledFonts::No;
     return willFallbackToSystemOnly == shouldFallbackToSystemOnly;
-#else
-    UNUSED_PARAM(font);
-    UNUSED_PARAM(allowUserInstalledFonts);
-    return true;
-#endif
 }
 
 RetainPtr<CTFontRef> createFontForInstalledFonts(CTFontRef font, AllowUserInstalledFonts allowUserInstalledFonts)
@@ -1612,28 +1582,19 @@
 
 void addAttributesForWebFonts(CFMutableDictionaryRef attributes, AllowUserInstalledFonts allowUserInstalledFonts)
 {
-#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
     if (allowUserInstalledFonts == AllowUserInstalledFonts::No) {
         CTFontFallbackOption fallbackOption = kCTFontFallbackOptionSystem;
         auto fallbackOptionNumber = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, &fallbackOption));
         CFDictionaryAddValue(attributes, kCTFontFallbackOptionAttribute, fallbackOptionNumber.get());
     }
-#else
-    UNUSED_PARAM(attributes);
-    UNUSED_PARAM(allowUserInstalledFonts);
-#endif
 }
 
 RetainPtr<CFSetRef> installedFontMandatoryAttributes(AllowUserInstalledFonts allowUserInstalledFonts)
 {
-#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
     if (allowUserInstalledFonts == AllowUserInstalledFonts::No) {
         CFTypeRef mandatoryAttributesValues[] = { kCTFontFamilyNameAttribute, kCTFontPostScriptNameAttribute, kCTFontEnabledAttribute, kCTFontUserInstalledAttribute, kCTFontFallbackOptionAttribute };
         return adoptCF(CFSetCreate(kCFAllocatorDefault, mandatoryAttributesValues, WTF_ARRAY_LENGTH(mandatoryAttributesValues), &kCFTypeSetCallBacks));
     }
-#else
-    UNUSED_PARAM(allowUserInstalledFonts);
-#endif
     return nullptr;
 }
 

Modified: trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp (261165 => 261166)


--- trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp	2020-05-05 14:36:50 UTC (rev 261165)
+++ trunk/Source/WebCore/platform/graphics/mac/SimpleFontDataCoreText.cpp	2020-05-05 14:39:16 UTC (rev 261166)
@@ -80,12 +80,4 @@
     return adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, count, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks));
 }
 
-#if HAVE(DISALLOWABLE_USER_INSTALLED_FONTS)
-bool Font::isUserInstalledFont() const
-{
-    auto isUserInstalledFont = adoptCF(static_cast<CFBooleanRef>(CTFontCopyAttribute(getCTFont(), kCTFontUserInstalledAttribute)));
-    return isUserInstalledFont && CFBooleanGetValue(isUserInstalledFont.get());
-}
-#endif
-
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to