Diff
Modified: trunk/Source/WebCore/ChangeLog (252805 => 252806)
--- trunk/Source/WebCore/ChangeLog 2019-11-22 22:42:59 UTC (rev 252805)
+++ trunk/Source/WebCore/ChangeLog 2019-11-22 22:49:10 UTC (rev 252806)
@@ -1,3 +1,32 @@
+2019-11-22 Myles C. Maxfield <[email protected]>
+
+ [Cocoa] Rename some internal names for system fonts
+ https://bugs.webkit.org/show_bug.cgi?id=204486
+
+ Reviewed by Simon Fraser.
+
+ designSystemUI -> systemDesign (because https://developer.apple.com/documentation/appkit/nsfontdescriptorsystemdesign?language=objc)
+ SystemFontDatabaseCoreText::ClientUse -> SystemFontKind
+ ForSystemUI -> SystemUI (because https://drafts.csswg.org/css-fonts-4/#system-ui-def)
+ ForSystemUISerif -> UISerif (because https://drafts.csswg.org/css-fonts-4/#ui-serif-def)
+ ForSystemUIMonospace -> UIMonospace (because https://drafts.csswg.org/css-fonts-4/#ui-monospace-def)
+ ForSystemUIRounded -> UIRounded (because https://drafts.csswg.org/css-fonts-4/#ui-rounded-def)
+ ForTextStyle -> TextStyle (because CTFontDescriptorCreateWithTextStyle())
+
+ No new tests because there is no behavior change.
+
+ * platform/graphics/cocoa/FontCacheCoreText.cpp:
+ (WebCore::fontWithFamilySpecialCase):
+ * platform/graphics/cocoa/FontDescriptionCocoa.cpp:
+ (WebCore::matchSystemFontUse):
+ (WebCore::systemFontCascadeList):
+ * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp:
+ (WebCore::SystemFontDatabaseCoreText::createSystemDesignFont):
+ (WebCore::SystemFontDatabaseCoreText::cascadeList):
+ (WebCore::SystemFontDatabaseCoreText::systemFontParameters):
+ (WebCore::SystemFontDatabaseCoreText::createDesignSystemUIFont): Deleted.
+ * platform/graphics/cocoa/SystemFontDatabaseCoreText.h:
+
2019-11-22 Sihui Liu <[email protected]>
Cross-thread version StorageQuotaManager
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp (252805 => 252806)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2019-11-22 22:42:59 UTC (rev 252805)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontCacheCoreText.cpp 2019-11-22 22:49:10 UTC (rev 252806)
@@ -1267,24 +1267,24 @@
static RetainPtr<CTFontRef> fontWithFamilySpecialCase(const AtomString& family, const FontDescription& fontDescription, float size, AllowUserInstalledFonts allowUserInstalledFonts)
{
- Optional<SystemFontDatabaseCoreText::ClientUse> designSystemUI;
+ Optional<SystemFontKind> systemDesign;
#if HAVE(DESIGN_SYSTEM_UI_FONTS)
if (equalLettersIgnoringASCIICase(family, "ui-serif"))
- designSystemUI = SystemFontDatabaseCoreText::ClientUse::ForSystemUISerif;
+ systemDesign = SystemFontKind::UISerif;
else if (equalLettersIgnoringASCIICase(family, "ui-monospace"))
- designSystemUI = SystemFontDatabaseCoreText::ClientUse::ForSystemUIMonospace;
+ systemDesign = SystemFontKind::UIMonospace;
else if (equalLettersIgnoringASCIICase(family, "ui-rounded"))
- designSystemUI = SystemFontDatabaseCoreText::ClientUse::ForSystemUIRounded;
+ systemDesign = SystemFontKind::UIRounded;
#endif
if (equalLettersIgnoringASCIICase(family, "ui-sans-serif")) {
- ASSERT(!designSystemUI);
- designSystemUI = SystemFontDatabaseCoreText::ClientUse::ForSystemUI;
+ ASSERT(!systemDesign);
+ systemDesign = SystemFontKind::SystemUI;
}
- if (designSystemUI) {
- auto cascadeList = SystemFontDatabaseCoreText::singleton().cascadeList(fontDescription, family, *designSystemUI, allowUserInstalledFonts);
+ if (systemDesign) {
+ auto cascadeList = SystemFontDatabaseCoreText::singleton().cascadeList(fontDescription, family, *systemDesign, allowUserInstalledFonts);
if (!cascadeList.isEmpty())
return createFontForInstalledFonts(cascadeList[0].get(), size, allowUserInstalledFonts);
}
Modified: trunk/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp (252805 => 252806)
--- trunk/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp 2019-11-22 22:42:59 UTC (rev 252805)
+++ trunk/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp 2019-11-22 22:49:10 UTC (rev 252806)
@@ -47,7 +47,7 @@
}
#endif
-static inline Optional<SystemFontDatabaseCoreText::ClientUse> matchSystemFontUse(const AtomString& string)
+static inline Optional<SystemFontKind> matchSystemFontUse(const AtomString& string)
{
if (equalLettersIgnoringASCIICase(string, "-webkit-system-font")
|| equalLettersIgnoringASCIICase(string, "-apple-system")
@@ -54,15 +54,15 @@
|| equalLettersIgnoringASCIICase(string, "-apple-system-font")
|| equalLettersIgnoringASCIICase(string, "system-ui")
|| equalLettersIgnoringASCIICase(string, "ui-sans-serif"))
- return SystemFontDatabaseCoreText::ClientUse::ForSystemUI;
+ return SystemFontKind::SystemUI;
#if HAVE(DESIGN_SYSTEM_UI_FONTS)
if (equalLettersIgnoringASCIICase(string, "ui-serif"))
- return SystemFontDatabaseCoreText::ClientUse::ForSystemUISerif;
+ return SystemFontKind::UISerif;
if (equalLettersIgnoringASCIICase(string, "ui-monospace"))
- return SystemFontDatabaseCoreText::ClientUse::ForSystemUIMonospace;
+ return SystemFontKind::UIMonospace;
if (equalLettersIgnoringASCIICase(string, "ui-rounded"))
- return SystemFontDatabaseCoreText::ClientUse::ForSystemUIRounded;
+ return SystemFontKind::UIRounded;
#endif
#if PLATFORM(IOS_FAMILY)
@@ -90,15 +90,15 @@
static auto strings { makeNeverDestroyed(convertArray<AtomString>(styles)) };
if (std::find(strings.get().begin(), strings.get().end(), string) != strings.get().end())
- return SystemFontDatabaseCoreText::ClientUse::ForTextStyle;
+ return SystemFontKind::TextStyle;
#endif
return WTF::nullopt;
}
-static inline Vector<RetainPtr<CTFontDescriptorRef>> systemFontCascadeList(const FontDescription& description, const AtomString& cssFamily, SystemFontDatabaseCoreText::ClientUse clientUse, AllowUserInstalledFonts allowUserInstalledFonts)
+static inline Vector<RetainPtr<CTFontDescriptorRef>> systemFontCascadeList(const FontDescription& description, const AtomString& cssFamily, SystemFontKind systemFontKind, AllowUserInstalledFonts allowUserInstalledFonts)
{
- return SystemFontDatabaseCoreText::singleton().cascadeList(description, cssFamily, clientUse, allowUserInstalledFonts);
+ return SystemFontDatabaseCoreText::singleton().cascadeList(description, cssFamily, systemFontKind, allowUserInstalledFonts);
}
unsigned FontCascadeDescription::effectiveFamilyCount() const
Modified: trunk/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp (252805 => 252806)
--- trunk/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp 2019-11-22 22:42:59 UTC (rev 252805)
+++ trunk/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp 2019-11-22 22:49:10 UTC (rev 252806)
@@ -61,17 +61,17 @@
}
#if HAVE(DESIGN_SYSTEM_UI_FONTS)
-RetainPtr<CTFontRef> SystemFontDatabaseCoreText::createDesignSystemUIFont(ClientUse clientUse, const CascadeListParameters& parameters)
+RetainPtr<CTFontRef> SystemFontDatabaseCoreText::createSystemDesignFont(SystemFontKind systemFontKind, const CascadeListParameters& parameters)
{
CFStringRef design = kCTFontUIFontDesignDefault;
- switch (clientUse) {
- case ClientUse::ForSystemUISerif:
+ switch (systemFontKind) {
+ case SystemFontKind::UISerif:
design = kCTFontUIFontDesignSerif;
break;
- case ClientUse::ForSystemUIMonospace:
+ case SystemFontKind::UIMonospace:
design = kCTFontUIFontDesignMonospaced;
break;
- case ClientUse::ForSystemUIRounded:
+ case SystemFontKind::UIRounded:
design = kCTFontUIFontDesignRounded;
break;
default:
@@ -97,24 +97,24 @@
#endif
}
-Vector<RetainPtr<CTFontDescriptorRef>> SystemFontDatabaseCoreText::cascadeList(const CascadeListParameters& parameters, ClientUse clientUse)
+Vector<RetainPtr<CTFontDescriptorRef>> SystemFontDatabaseCoreText::cascadeList(const CascadeListParameters& parameters, SystemFontKind systemFontKind)
{
ASSERT(!parameters.fontName.isNull());
return m_systemFontCache.ensure(parameters, [&] {
auto localeString = parameters.locale.string().createCFString();
RetainPtr<CTFontRef> systemFont;
- switch (clientUse) {
- case ClientUse::ForSystemUI:
+ switch (systemFontKind) {
+ case SystemFontKind::SystemUI:
systemFont = createSystemUIFont(parameters, localeString.get());
break;
- case ClientUse::ForSystemUISerif:
- case ClientUse::ForSystemUIMonospace:
- case ClientUse::ForSystemUIRounded:
+ case SystemFontKind::UISerif:
+ case SystemFontKind::UIMonospace:
+ case SystemFontKind::UIRounded:
#if HAVE(DESIGN_SYSTEM_UI_FONTS)
- systemFont = createDesignSystemUIFont(clientUse, parameters);
+ systemFont = createSystemDesignFont(systemFontKind, parameters);
#endif
break;
- case ClientUse::ForTextStyle:
+ case SystemFontKind::TextStyle:
systemFont = createTextStyleFont(parameters);
break;
}
@@ -179,7 +179,7 @@
return result;
}
-SystemFontDatabaseCoreText::CascadeListParameters SystemFontDatabaseCoreText::systemFontParameters(const FontDescription& description, const AtomString& familyName, ClientUse clientUse, AllowUserInstalledFonts allowUserInstalledFonts)
+SystemFontDatabaseCoreText::CascadeListParameters SystemFontDatabaseCoreText::systemFontParameters(const FontDescription& description, const AtomString& familyName, SystemFontKind systemFontKind, AllowUserInstalledFonts allowUserInstalledFonts)
{
CascadeListParameters result;
result.locale = description.locale();
@@ -210,28 +210,28 @@
else
result.weight = kCTFontWeightBlack;
- switch (clientUse) {
- case ClientUse::ForSystemUI: {
+ switch (systemFontKind) {
+ case SystemFontKind::SystemUI: {
static NeverDestroyed<AtomString> systemUI = AtomString("system-ui", AtomString::ConstructFromLiteral);
result.fontName = systemUI.get();
break;
}
- case ClientUse::ForSystemUISerif: {
+ case SystemFontKind::UISerif: {
static NeverDestroyed<AtomString> systemUISerif = AtomString("ui-serif", AtomString::ConstructFromLiteral);
result.fontName = systemUISerif.get();
break;
}
- case ClientUse::ForSystemUIMonospace: {
+ case SystemFontKind::UIMonospace: {
static NeverDestroyed<AtomString> systemUIMonospace = AtomString("ui-monospace", AtomString::ConstructFromLiteral);
result.fontName = systemUIMonospace.get();
break;
}
- case ClientUse::ForSystemUIRounded: {
+ case SystemFontKind::UIRounded: {
static NeverDestroyed<AtomString> systemUIRounded = AtomString("ui-rounded", AtomString::ConstructFromLiteral);
result.fontName = systemUIRounded.get();
break;
}
- case ClientUse::ForTextStyle:
+ case SystemFontKind::TextStyle:
result.fontName = familyName;
break;
}
@@ -239,9 +239,9 @@
return result;
}
-Vector<RetainPtr<CTFontDescriptorRef>> SystemFontDatabaseCoreText::cascadeList(const FontDescription& description, const AtomString& cssFamily, ClientUse clientUse, AllowUserInstalledFonts allowUserInstalledFonts)
+Vector<RetainPtr<CTFontDescriptorRef>> SystemFontDatabaseCoreText::cascadeList(const FontDescription& description, const AtomString& cssFamily, SystemFontKind systemFontKind, AllowUserInstalledFonts allowUserInstalledFonts)
{
- return cascadeList(systemFontParameters(description, cssFamily, clientUse, allowUserInstalledFonts), clientUse);
+ return cascadeList(systemFontParameters(description, cssFamily, systemFontKind, allowUserInstalledFonts), systemFontKind);
}
#endif // USE(PLATFORM_SYSTEM_FALLBACK_LIST)
Modified: trunk/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h (252805 => 252806)
--- trunk/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h 2019-11-22 22:42:59 UTC (rev 252805)
+++ trunk/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h 2019-11-22 22:49:10 UTC (rev 252806)
@@ -34,6 +34,14 @@
namespace WebCore {
+enum class SystemFontKind : uint8_t {
+ SystemUI,
+ UISerif,
+ UIMonospace,
+ UIRounded,
+ TextStyle
+};
+
class SystemFontDatabaseCoreText {
public:
struct CascadeListParameters {
@@ -96,16 +104,8 @@
static SystemFontDatabaseCoreText& singleton();
- enum class ClientUse : uint8_t {
- ForSystemUI,
- ForSystemUISerif,
- ForSystemUIMonospace,
- ForSystemUIRounded,
- ForTextStyle
- };
+ Vector<RetainPtr<CTFontDescriptorRef>> cascadeList(const FontDescription&, const AtomString& cssFamily, SystemFontKind, AllowUserInstalledFonts);
- Vector<RetainPtr<CTFontDescriptorRef>> cascadeList(const FontDescription&, const AtomString& cssFamily, ClientUse, AllowUserInstalledFonts);
-
String serifFamily(const String& locale);
String sansSerifFamily(const String& locale);
String cursiveFamily(const String& locale);
@@ -117,16 +117,16 @@
private:
SystemFontDatabaseCoreText();
- Vector<RetainPtr<CTFontDescriptorRef>> cascadeList(const CascadeListParameters&, ClientUse);
+ Vector<RetainPtr<CTFontDescriptorRef>> cascadeList(const CascadeListParameters&, SystemFontKind);
RetainPtr<CTFontRef> createSystemUIFont(const CascadeListParameters&, CFStringRef locale);
- RetainPtr<CTFontRef> createDesignSystemUIFont(ClientUse, const CascadeListParameters&);
+ RetainPtr<CTFontRef> createSystemDesignFont(SystemFontKind, const CascadeListParameters&);
RetainPtr<CTFontRef> createTextStyleFont(const CascadeListParameters&);
static RetainPtr<CTFontRef> createFontByApplyingWeightItalicsAndFallbackBehavior(CTFontRef, CGFloat weight, bool italic, float size, AllowUserInstalledFonts, CFStringRef design = nullptr);
static RetainPtr<CTFontDescriptorRef> removeCascadeList(CTFontDescriptorRef);
static Vector<RetainPtr<CTFontDescriptorRef>> computeCascadeList(CTFontRef, CFStringRef locale);
- static CascadeListParameters systemFontParameters(const FontDescription&, const AtomString& familyName, ClientUse, AllowUserInstalledFonts);
+ static CascadeListParameters systemFontParameters(const FontDescription&, const AtomString& familyName, SystemFontKind, AllowUserInstalledFonts);
HashMap<CascadeListParameters, Vector<RetainPtr<CTFontDescriptorRef>>, CascadeListParameters::CascadeListParametersHash, SimpleClassHashTraits<CascadeListParameters>> m_systemFontCache;