WebKit Bugzilla
Attachment 349223 Details for
Bug 189446
: system-ui doesn't obey user-installed font setting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
WIP
bug-189446-20180907180201.patch (text/plain), 6.21 KB, created by
Myles C. Maxfield
on 2018-09-07 18:02:01 PDT
(
hide
)
Description:
WIP
Filename:
MIME Type:
Creator:
Myles C. Maxfield
Created:
2018-09-07 18:02:01 PDT
Size:
6.21 KB
patch
obsolete
>Subversion Revision: 235819 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index e04317f91822177b8e922410d72145d4fbf94993..594f14862da05a9a3efba332f1d451ae290af46f 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,23 @@ >+2018-09-07 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ system-ui doesn't obey user-installed font setting >+ https://bugs.webkit.org/show_bug.cgi?id=189446 >+ <rdar://problem/44229849> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ No new tests (OOPS!). >+ >+ * platform/graphics/cocoa/FontDescriptionCocoa.cpp: >+ (WebCore::SystemFontDatabase::singleton): >+ (WebCore::SystemFontDatabase::singletonAllowingUserInstalledFonts): >+ (WebCore::SystemFontDatabase::singletonDisallowingUserInstalledFonts): >+ (WebCore::SystemFontDatabase::SystemFontDatabase): >+ (WebCore::SystemFontDatabase::removeCascadeList): >+ (WebCore::SystemFontDatabase::computeCascadeList): >+ (WebCore::FontDescription::invalidateCaches): >+ (WebCore::systemFontCascadeList): >+ > 2018-09-07 Youenn Fablet <youenn@apple.com> > > RTCRtpReceiver::track should return a MediaStreamTrack reference >diff --git a/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp b/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp >index 42afa48c55cec91bec29da1625b63cb1425d44f3..029290fa7334d500af43e93175748bd5d7fab57f 100644 >--- a/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp >+++ b/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp >@@ -102,11 +102,33 @@ public: > bool italic { false }; > }; > >+#if !CAN_DISALLOW_USER_INSTALLED_FONTS > static SystemFontDatabase& singleton() > { >- static NeverDestroyed<SystemFontDatabase> database = SystemFontDatabase(); >+ static NeverDestroyed<SystemFontDatabase> database = SystemFontDatabase(AllowUserInstalledFonts::Yes); > return database.get(); > } >+#endif >+ >+ static SystemFontDatabase& singletonAllowingUserInstalledFonts() >+ { >+#if CAN_DISALLOW_USER_INSTALLED_FONTS >+ static NeverDestroyed<SystemFontDatabase> database = SystemFontDatabase(AllowUserInstalledFonts::Yes); >+ return database.get(); >+#else >+ return singleton(); >+#endif >+ } >+ >+ static SystemFontDatabase& singletonDisallowingUserInstalledFonts() >+ { >+#if CAN_DISALLOW_USER_INSTALLED_FONTS >+ static NeverDestroyed<SystemFontDatabase> database = SystemFontDatabase(AllowUserInstalledFonts::No); >+ return database.get(); >+#else >+ return singleton(); >+#endif >+ } > > enum class ClientUse { ForSystemUI, ForTextStyle }; > >@@ -146,7 +168,8 @@ public: > } > > private: >- SystemFontDatabase() >+ SystemFontDatabase(AllowUserInstalledFonts allowUserInstalledFonts) >+ : m_allowUserInstalledFonts(allowUserInstalledFonts) > { > } > >@@ -166,17 +189,17 @@ private: > return adoptCF(CTFontCreateCopyWithAttributes(font, size, nullptr, modification.get())); > } > >- static RetainPtr<CTFontDescriptorRef> removeCascadeList(CTFontDescriptorRef fontDescriptor) >+ RetainPtr<CTFontDescriptorRef> removeCascadeList(CTFontDescriptorRef fontDescriptor) > { >+ auto attributes = adoptCF(CFDictionaryCreateMutable(kCFAllocatorDefault, 0, &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); > auto emptyArray = adoptCF(CFArrayCreate(kCFAllocatorDefault, nullptr, 0, &kCFTypeArrayCallBacks)); >- CFTypeRef fallbackDictionaryKeys[] = { kCTFontCascadeListAttribute }; >- CFTypeRef fallbackDictionaryValues[] = { emptyArray.get() }; >- auto fallbackDictionary = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, fallbackDictionaryKeys, fallbackDictionaryValues, WTF_ARRAY_LENGTH(fallbackDictionaryKeys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); >- auto modifiedFontDescriptor = adoptCF(CTFontDescriptorCreateCopyWithAttributes(fontDescriptor, fallbackDictionary.get())); >+ CFDictionaryAddValue(attributes.get(), kCTFontCascadeListAttribute, emptyArray.get()); >+ addAttributesForInstalledFonts(attributes.get(), m_allowUserInstalledFonts); >+ auto modifiedFontDescriptor = adoptCF(CTFontDescriptorCreateCopyWithAttributes(fontDescriptor, attributes.get())); > return modifiedFontDescriptor; > } > >- static Vector<RetainPtr<CTFontDescriptorRef>> computeCascadeList(CTFontRef font, CFStringRef locale) >+ Vector<RetainPtr<CTFontDescriptorRef>> computeCascadeList(CTFontRef font, CFStringRef locale) > { > CFTypeRef arrayValues[] = { locale }; > auto localeArray = adoptCF(CFArrayCreate(kCFAllocatorDefault, arrayValues, WTF_ARRAY_LENGTH(arrayValues), &kCFTypeArrayCallBacks)); >@@ -193,6 +216,7 @@ private: > } > > HashMap<CoreTextCascadeListParameters, Vector<RetainPtr<CTFontDescriptorRef>>, CoreTextCascadeListParameters::CoreTextCascadeListParametersHash, SimpleClassHashTraits<CoreTextCascadeListParameters>> m_systemFontCache; >+ AllowUserInstalledFonts m_allowUserInstalledFonts; > }; > > static inline bool isSystemFontString(const AtomicString& string) >@@ -289,12 +313,14 @@ static inline SystemFontDatabase::CoreTextCascadeListParameters systemFontParame > > void FontDescription::invalidateCaches() > { >- SystemFontDatabase::singleton().clear(); >+ SystemFontDatabase::singletonAllowingUserInstalledFonts().clear(); >+ SystemFontDatabase::singletonDisallowingUserInstalledFonts().clear(); > } > > static inline Vector<RetainPtr<CTFontDescriptorRef>> systemFontCascadeList(const FontCascadeDescription& description, const AtomicString& cssFamily, SystemFontDatabase::ClientUse clientUse, AllowUserInstalledFonts allowUserInstalledFonts) > { >- return SystemFontDatabase::singleton().systemFontCascadeList(systemFontParameters(description, cssFamily, clientUse, allowUserInstalledFonts), clientUse); >+ auto& systemFontDatabase = allowUserInstalledFonts == AllowUserInstalledFonts::Yes ? SystemFontDatabase::singletonAllowingUserInstalledFonts() : SystemFontDatabase::singletonDisallowingUserInstalledFonts(); >+ return systemFontDatabase.systemFontCascadeList(systemFontParameters(description, cssFamily, clientUse, allowUserInstalledFonts), clientUse); > } > > unsigned FontCascadeDescription::effectiveFamilyCount() const
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189446
:
349223