WebKit Bugzilla
Attachment 360610 Details for
Bug 187723
: [Cocoa] Ask platform for generic font family mappings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-187723-20190130133310.patch (text/plain), 21.85 KB, created by
Myles C. Maxfield
on 2019-01-30 13:33:11 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Myles C. Maxfield
Created:
2019-01-30 13:33:11 PST
Size:
21.85 KB
patch
obsolete
>Subversion Revision: 240602 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index dad7450a94448006eb972a12262a27fec00c400f..0004588c3d9968bc4fcce7050f2d2b34b1036ec4 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,53 @@ >+2019-01-29 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ [Cocoa] Ask platform for generic font family mappings >+ https://bugs.webkit.org/show_bug.cgi?id=187723 >+ <rdar://problem/41892438> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ WebKit API allows setting the generic font families for the USCRIPT_COMMON script. >+ When trying to style a character with a generic font family, we first look to see if >+ we have a mapping for the particular script the character is rendered with, and if we >+ don't find a match, we then check USCRIPT_COMMON. >+ >+ In the Cocoa ports, the only way families get set for non-USCRIPT_COMMON scripts (aka >+ the only scripts which won't use the API families) is in >+ SettingsBase::initializeDefaultFontFamilies(). That function only sets the families >+ for the CJK scripts. >+ >+ Because these hardcoded names in SettingsBase::initializeDefaultFontFamilies() are >+ incorrect, and because these scripts are the only ones which won't consult with the >+ API families, these scripts are the ones that can use CTFontDescriptorCreateForCSSFamily(). >+ CTFontDescriptorCreateForCSSFamily() won't return any user-installed fonts, and will >+ return better results than our hardcoded names. >+ >+ Test: fast/text/jp-sans-serif.html >+ >+ * css/CSSComputedStyleDeclaration.cpp: >+ * css/CSSFontSelector.cpp: >+ (WebCore::resolveGenericFamily): >+ * css/parser/CSSPropertyParser.cpp: >+ (WebCore::consumeFontFamily): >+ * page/cocoa/SettingsBaseCocoa.mm: >+ (WebCore::SettingsBase::initializeDefaultFontFamilies): >+ (WebCore::sansSerifTraditionalHanFontFamily): Deleted. >+ (WebCore::sansSerifSimplifiedHanFontFamily): Deleted. >+ (WebCore::osakaMonoIsInstalled): Deleted. >+ * platform/graphics/FontDescription.cpp: >+ (WebCore::FontDescription::platformResolveGenericFamily): >+ * platform/graphics/FontDescription.h: >+ * platform/graphics/cocoa/FontDescriptionCocoa.cpp: >+ (WebCore::FontDescription::platformResolveGenericFamily): >+ * platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp: >+ (WebCore::SystemFontDatabaseCoreText::clear): >+ (WebCore::SystemFontDatabaseCoreText::serifFamily): >+ (WebCore::SystemFontDatabaseCoreText::sansSerifFamily): >+ (WebCore::SystemFontDatabaseCoreText::cursiveFamily): >+ (WebCore::SystemFontDatabaseCoreText::fantasyFamily): >+ (WebCore::SystemFontDatabaseCoreText::monospaceFamily): >+ * platform/graphics/cocoa/SystemFontDatabaseCoreText.h: >+ > 2019-01-28 Antoine Quint <graouts@apple.com> > > Limit user-agent interactions based on the touch-action property on iOS >diff --git a/Source/WebCore/PAL/ChangeLog b/Source/WebCore/PAL/ChangeLog >index 83c5c2600f1e27dcae11256005fb623d245c5f3f..01c0e5414d0bd0be272f13e8e9b96758fe683b9a 100644 >--- a/Source/WebCore/PAL/ChangeLog >+++ b/Source/WebCore/PAL/ChangeLog >@@ -1,3 +1,12 @@ >+2019-01-29 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ [Cocoa] Ask platform for generic font family mappings >+ https://bugs.webkit.org/show_bug.cgi?id=187723 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * pal/spi/cocoa/CoreTextSPI.h: >+ > 2019-01-27 Chris Fleizach <cfleizach@apple.com> > > AX: Introduce isolated accessibility tree >diff --git a/Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h b/Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h >index 09af37dfd2295aaa33f82b01e3bd3cd0d40c9000..d62bb25d013017f9cbef8d83376733aaa6d12c38 100644 >--- a/Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h >+++ b/Source/WebCore/PAL/pal/spi/cocoa/CoreTextSPI.h >@@ -79,6 +79,13 @@ extern const CFStringRef kCTFontPostScriptNameAttribute; > extern const CFStringRef kCTFontUserInstalledAttribute; > extern const CFStringRef kCTFontFallbackOptionAttribute; > >+extern const CFStringRef kCTFontCSSFamilySerif; >+extern const CFStringRef kCTFontCSSFamilySansSerif; >+extern const CFStringRef kCTFontCSSFamilyCursive; >+extern const CFStringRef kCTFontCSSFamilyFantasy; >+extern const CFStringRef kCTFontCSSFamilyMonospace; >+extern const CFStringRef kCTFontCSSFamilySystemUI; >+ > bool CTFontTransformGlyphs(CTFontRef, CGGlyph glyphs[], CGSize advances[], CFIndex count, CTFontTransformOptions); > > CGSize CTRunGetInitialAdvance(CTRunRef); >@@ -87,6 +94,7 @@ void CTRunGetBaseAdvancesAndOrigins(CTRunRef, CFRange, CGSize baseAdvances[], CG > CTTypesetterRef CTTypesetterCreateWithUniCharProviderAndOptions(CTUniCharProviderCallback, CTUniCharDisposeCallback, void* refCon, CFDictionaryRef options); > bool CTFontGetVerticalGlyphsForCharacters(CTFontRef, const UniChar characters[], CGGlyph glyphs[], CFIndex count); > void CTFontGetUnsummedAdvancesForGlyphsAndStyle(CTFontRef, CTFontOrientation, CGFontRenderingStyle, const CGGlyph[], CGSize advances[], CFIndex count); >+CTFontDescriptorRef CTFontDescriptorCreateForCSSFamily(CFStringRef cssFamily, CFStringRef language); > > CTFontDescriptorRef CTFontDescriptorCreateForUIType(CTFontUIFontType, CGFloat size, CFStringRef language); > CTFontDescriptorRef CTFontDescriptorCreateWithTextStyle(CFStringRef style, CFStringRef size, CFStringRef language); >diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >index 5aaae72fe550249bd0f6bd73580638f67da28a38..977eca3a41e17c7163c9f17af7c71476edceb89a 100644 >--- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >@@ -1720,7 +1720,6 @@ bool ComputedStyleExtractor::useFixedFontDefaultSize() > return style->fontDescription().useFixedDefaultSize(); > } > >- > static CSSValueID identifierForFamily(const AtomicString& family) > { > if (family == cursiveFamily) >diff --git a/Source/WebCore/css/CSSFontSelector.cpp b/Source/WebCore/css/CSSFontSelector.cpp >index d55127bec949a99571c4eec9557f8e62926ccd07..4afb42eb8fe8cc0cfa728bd0a4e30c93255729ea 100644 >--- a/Source/WebCore/css/CSSFontSelector.cpp >+++ b/Source/WebCore/css/CSSFontSelector.cpp >@@ -274,8 +274,12 @@ void CSSFontSelector::fontCacheInvalidated() > dispatchInvalidationCallbacks(); > } > >-static const AtomicString& resolveGenericFamily(Document* document, const FontDescription& fontDescription, const AtomicString& familyName) >+static AtomicString resolveGenericFamily(Document* document, const FontDescription& fontDescription, const AtomicString& familyName) > { >+ auto platformResult = FontDescription::platformResolveGenericFamily(fontDescription.script(), fontDescription.locale(), familyName); >+ if (!platformResult.isNull()) >+ return platformResult; >+ > if (!document) > return familyName; > >diff --git a/Source/WebCore/css/parser/CSSPropertyParser.cpp b/Source/WebCore/css/parser/CSSPropertyParser.cpp >index 1ddaabdf370fdedaf627a69e09e0afa25cdf4d87..fdb442ca327b6cf9d3bf7d48c04be592a655b3a5 100644 >--- a/Source/WebCore/css/parser/CSSPropertyParser.cpp >+++ b/Source/WebCore/css/parser/CSSPropertyParser.cpp >@@ -1070,16 +1070,13 @@ static RefPtr<CSSValueList> consumeFontFamily(CSSParserTokenRange& range) > { > RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); > do { >- RefPtr<CSSValue> parsedValue = consumeGenericFamily(range); >- if (parsedValue) { >+ if (RefPtr<CSSValue> parsedValue = consumeGenericFamily(range)) > list->append(parsedValue.releaseNonNull()); >- } else { >- parsedValue = consumeFamilyName(range); >- if (parsedValue) { >+ else { >+ if (auto parsedValue = consumeFamilyName(range)) > list->append(parsedValue.releaseNonNull()); >- } else { >+ else > return nullptr; >- } > } > } while (consumeCommaIncludingWhitespace(range)); > return list; >diff --git a/Source/WebCore/page/cocoa/SettingsBaseCocoa.mm b/Source/WebCore/page/cocoa/SettingsBaseCocoa.mm >index 57f825df99559f0935738a38b36917bd8f9e28e7..89ca139b9ca6aead3928c9299bf45da40fff144b 100644 >--- a/Source/WebCore/page/cocoa/SettingsBaseCocoa.mm >+++ b/Source/WebCore/page/cocoa/SettingsBaseCocoa.mm >@@ -48,41 +48,12 @@ static inline const char* sansSerifSimplifiedHanFontFamily() > > #if PLATFORM(MAC) > >-static bool osakaMonoIsInstalled() >-{ >- int one = 1; >- RetainPtr<CFNumberRef> yes = adoptCF(CFNumberCreate(kCFAllocatorDefault, kCFNumberIntType, &one)); >- CFTypeRef keys[] = { kCTFontEnabledAttribute, kCTFontNameAttribute }; >- CFTypeRef values[] = { yes.get(), CFSTR("Osaka-Mono") }; >- RetainPtr<CFDictionaryRef> attributes = adoptCF(CFDictionaryCreate(kCFAllocatorDefault, keys, values, WTF_ARRAY_LENGTH(values), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks)); >- RetainPtr<CTFontDescriptorRef> descriptor = adoptCF(CTFontDescriptorCreateWithAttributes(attributes.get())); >- RetainPtr<CFSetRef> mandatoryAttributes = adoptCF(CFSetCreate(kCFAllocatorDefault, keys, WTF_ARRAY_LENGTH(keys), &kCFTypeSetCallBacks)); >- return adoptCF(CTFontDescriptorCreateMatchingFontDescriptor(descriptor.get(), mandatoryAttributes.get())); >-} >- > void SettingsBase::initializeDefaultFontFamilies() > { > setStandardFontFamily("Songti TC", USCRIPT_TRADITIONAL_HAN); >- setSerifFontFamily("Songti TC", USCRIPT_TRADITIONAL_HAN); >- setFixedFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN); >- setSansSerifFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN); >- setCursiveFontFamily("Kaiti TC", USCRIPT_TRADITIONAL_HAN); >- > setStandardFontFamily("Songti SC", USCRIPT_SIMPLIFIED_HAN); >- setSerifFontFamily("Songti SC", USCRIPT_SIMPLIFIED_HAN); >- setFixedFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN); >- setSansSerifFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN); >- setCursiveFontFamily("Kaiti SC", USCRIPT_SIMPLIFIED_HAN); >- > setStandardFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA); >- setFixedFontFamily(osakaMonoIsInstalled() ? "Osaka-Mono" : "Hiragino Sans", USCRIPT_KATAKANA_OR_HIRAGANA); >- setSerifFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA); >- setSansSerifFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA); >- > setStandardFontFamily("AppleMyungjo", USCRIPT_HANGUL); >- setSerifFontFamily("AppleMyungjo", USCRIPT_HANGUL); >- setFixedFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL); >- setSansSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL); > > setStandardFontFamily("Times", USCRIPT_COMMON); > setFixedFontFamily("Courier", USCRIPT_COMMON); >@@ -99,28 +70,10 @@ bool SettingsBase::platformDefaultMediaSourceEnabled() > > void SettingsBase::initializeDefaultFontFamilies() > { >- // There is no serif Chinese font in default iOS installation. > setStandardFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN); >- setSerifFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN); >- setFixedFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN); >- setSansSerifFontFamily(sansSerifTraditionalHanFontFamily(), USCRIPT_TRADITIONAL_HAN); >- >- // There is no serif Chinese font in default iOS installation. > setStandardFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN); >- setSerifFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN); >- setFixedFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN); >- setSansSerifFontFamily(sansSerifSimplifiedHanFontFamily(), USCRIPT_SIMPLIFIED_HAN); >- > setStandardFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA); >- setFixedFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA); >- setSerifFontFamily("Hiragino Mincho ProN", USCRIPT_KATAKANA_OR_HIRAGANA); >- setSansSerifFontFamily("Hiragino Kaku Gothic ProN", USCRIPT_KATAKANA_OR_HIRAGANA); >- >- // There is no serif Korean font in default iOS installation. > setStandardFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL); >- setSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL); >- setFixedFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL); >- setSansSerifFontFamily("Apple SD Gothic Neo", USCRIPT_HANGUL); > > setStandardFontFamily("Times", USCRIPT_COMMON); > setFixedFontFamily("Courier", USCRIPT_COMMON); >diff --git a/Source/WebCore/platform/graphics/FontDescription.cpp b/Source/WebCore/platform/graphics/FontDescription.cpp >index df590bb2c08c5463820c7558dbf609bbd7258522..b8b46e775cd91b1c6fee68c142298450ec2d60cf 100644 >--- a/Source/WebCore/platform/graphics/FontDescription.cpp >+++ b/Source/WebCore/platform/graphics/FontDescription.cpp >@@ -71,4 +71,11 @@ void FontDescription::setLocale(const AtomicString& locale) > m_script = localeToScriptCodeForFontSelection(m_locale); > } > >+#if !PLATFORM(COCOA) >+AtomicString FontDescription::platformResolveGenericFamily(UScriptCode, const AtomicString&, const AtomicString&) >+{ >+ return nullAtom(); >+} >+#endif >+ > } // namespace WebCore >diff --git a/Source/WebCore/platform/graphics/FontDescription.h b/Source/WebCore/platform/graphics/FontDescription.h >index 99bd407f5fa6c960bf8b9b649c89662d22f3912a..cb05cf5aeb9557851b4f309be6edb4ce6328d05f 100644 >--- a/Source/WebCore/platform/graphics/FontDescription.h >+++ b/Source/WebCore/platform/graphics/FontDescription.h >@@ -133,6 +133,8 @@ public: > void setFontStyleAxis(FontStyleAxis axis) { m_fontStyleAxis = axis == FontStyleAxis::ital; } > void setShouldAllowUserInstalledFonts(AllowUserInstalledFonts shouldAllowUserInstalledFonts) { m_shouldAllowUserInstalledFonts = static_cast<unsigned>(shouldAllowUserInstalledFonts); } > >+ static AtomicString platformResolveGenericFamily(UScriptCode, const AtomicString& locale, const AtomicString& familyName); >+ > private: > // FIXME: Investigate moving these into their own object on the heap (to save memory). > FontFeatureSettings m_featureSettings; >diff --git a/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp b/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp >index 8a3309dbee70de03f9c5493a1f9598434a254f01..b7007ae5d577504d9d8e491ae5d8897c3e843e91 100644 >--- a/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp >+++ b/Source/WebCore/platform/graphics/cocoa/FontDescriptionCocoa.cpp >@@ -138,6 +138,25 @@ FontFamilySpecification FontCascadeDescription::effectiveFamilyAt(unsigned index > return nullAtom(); > } > >+AtomicString FontDescription::platformResolveGenericFamily(UScriptCode script, const AtomicString& locale, const AtomicString& familyName) >+{ >+ if (script == USCRIPT_COMMON) >+ return nullAtom(); >+ >+ if (familyName == serifFamily) >+ return SystemFontDatabaseCoreText::singleton().serifFamily(locale); >+ if (familyName == sansSerifFamily) >+ return SystemFontDatabaseCoreText::singleton().sansSerifFamily(locale); >+ if (familyName == cursiveFamily) >+ return SystemFontDatabaseCoreText::singleton().cursiveFamily(locale); >+ if (familyName == fantasyFamily) >+ return SystemFontDatabaseCoreText::singleton().fantasyFamily(locale); >+ if (familyName == monospaceFamily) >+ return SystemFontDatabaseCoreText::singleton().monospaceFamily(locale); >+ >+ return nullAtom(); >+} >+ > } > > #endif >diff --git a/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp b/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp >index b4a396d058bd5937ac6569606dd4c420f6b4851c..4feef73a62f04d8e6b5c6cd9ffb39feecb84bd6c 100644 >--- a/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp >+++ b/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.cpp >@@ -80,6 +80,11 @@ Vector<RetainPtr<CTFontDescriptorRef>> SystemFontDatabaseCoreText::cascadeList(c > void SystemFontDatabaseCoreText::clear() > { > m_systemFontCache.clear(); >+ m_serifFamilies.clear(); >+ m_sansSeriferifFamilies.clear(); >+ m_cursiveFamilies.clear(); >+ m_fantasyFamilies.clear(); >+ m_monospaceFamilies.clear(); > } > > RetainPtr<CTFontRef> SystemFontDatabaseCoreText::applyWeightItalicsAndFallbackBehavior(CTFontRef font, CGFloat weight, bool italic, float size, AllowUserInstalledFonts allowUserInstalledFonts) >@@ -172,6 +177,46 @@ Vector<RetainPtr<CTFontDescriptorRef>> SystemFontDatabaseCoreText::cascadeList(c > return cascadeList(systemFontParameters(description, cssFamily, clientUse, allowUserInstalledFonts), clientUse); > } > >+AtomicString SystemFontDatabaseCoreText::serifFamily(const AtomicString& locale) >+{ >+ return m_serifFamilies.ensure(locale, [&] { >+ auto descriptor = adoptCF(CTFontDescriptorCreateForCSSFamily(kCTFontCSSFamilySerif, locale.string().createCFString().get())); >+ return adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(descriptor.get(), kCTFontFamilyNameAttribute))).get(); >+ }).iterator->value; >+} >+ >+AtomicString SystemFontDatabaseCoreText::sansSerifFamily(const AtomicString& locale) >+{ >+ return m_sansSeriferifFamilies.ensure(locale, [&] { >+ auto descriptor = adoptCF(CTFontDescriptorCreateForCSSFamily(kCTFontCSSFamilySansSerif, locale.string().createCFString().get())); >+ return adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(descriptor.get(), kCTFontFamilyNameAttribute))).get(); >+ }).iterator->value; >+} >+ >+AtomicString SystemFontDatabaseCoreText::cursiveFamily(const AtomicString& locale) >+{ >+ return m_cursiveFamilies.ensure(locale, [&] { >+ auto descriptor = adoptCF(CTFontDescriptorCreateForCSSFamily(kCTFontCSSFamilyCursive, locale.string().createCFString().get())); >+ return adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(descriptor.get(), kCTFontFamilyNameAttribute))).get(); >+ }).iterator->value; >+} >+ >+AtomicString SystemFontDatabaseCoreText::fantasyFamily(const AtomicString& locale) >+{ >+ return m_fantasyFamilies.ensure(locale, [&] { >+ auto descriptor = adoptCF(CTFontDescriptorCreateForCSSFamily(kCTFontCSSFamilyFantasy, locale.string().createCFString().get())); >+ return adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(descriptor.get(), kCTFontFamilyNameAttribute))).get(); >+ }).iterator->value; >+} >+ >+AtomicString SystemFontDatabaseCoreText::monospaceFamily(const AtomicString& locale) >+{ >+ return m_monospaceFamilies.ensure(locale, [&] { >+ auto descriptor = adoptCF(CTFontDescriptorCreateForCSSFamily(kCTFontCSSFamilyMonospace, locale.string().createCFString().get())); >+ return adoptCF(static_cast<CFStringRef>(CTFontDescriptorCopyAttribute(descriptor.get(), kCTFontFamilyNameAttribute))).get(); >+ }).iterator->value; >+} >+ > } > > #endif >diff --git a/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h b/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h >index 8359a4104aa50febb212fbc3209dfa873ce648d4..e11c8833a59784fcd179a5017119eb207eb94f8c 100644 >--- a/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h >+++ b/Source/WebCore/platform/graphics/cocoa/SystemFontDatabaseCoreText.h >@@ -101,6 +101,13 @@ public: > enum class ClientUse { ForSystemUI, ForTextStyle }; > > Vector<RetainPtr<CTFontDescriptorRef>> cascadeList(const FontCascadeDescription&, const AtomicString& cssFamily, ClientUse, AllowUserInstalledFonts); >+ >+ AtomicString serifFamily(const AtomicString& locale); >+ AtomicString sansSerifFamily(const AtomicString& locale); >+ AtomicString cursiveFamily(const AtomicString& locale); >+ AtomicString fantasyFamily(const AtomicString& locale); >+ AtomicString monospaceFamily(const AtomicString& locale); >+ > void clear(); > > private: >@@ -114,6 +121,12 @@ private: > static CascadeListParameters systemFontParameters(const FontCascadeDescription&, const AtomicString& familyName, ClientUse, AllowUserInstalledFonts); > > HashMap<CascadeListParameters, Vector<RetainPtr<CTFontDescriptorRef>>, CascadeListParameters::CascadeListParametersHash, SimpleClassHashTraits<CascadeListParameters>> m_systemFontCache; >+ >+ HashMap<AtomicString, AtomicString> m_serifFamilies; >+ HashMap<AtomicString, AtomicString> m_sansSeriferifFamilies; >+ HashMap<AtomicString, AtomicString> m_cursiveFamilies; >+ HashMap<AtomicString, AtomicString> m_fantasyFamilies; >+ HashMap<AtomicString, AtomicString> m_monospaceFamilies; > }; > > } >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 4dc94e86f7a6b197487fef703807dfcee2eac20d..86838069d2f73b5dc172efbe8cfa7f9cf546ffa2 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2019-01-29 Myles C. Maxfield <mmaxfield@apple.com> >+ >+ [Cocoa] Ask platform for generic font family mappings >+ https://bugs.webkit.org/show_bug.cgi?id=187723 >+ <rdar://problem/41892438> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * fast/text/jp-sans-serif-expected-mismatch.html: Added. >+ * fast/text/jp-sans-serif.html: Added. >+ > 2019-01-28 Antoine Quint <graouts@apple.com> > > Limit user-agent interactions based on the touch-action property on iOS >diff --git a/LayoutTests/fast/text/jp-sans-serif-expected-mismatch.html b/LayoutTests/fast/text/jp-sans-serif-expected-mismatch.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e6a8a44cce9635f726def042d02966b046f10a2e >--- /dev/null >+++ b/LayoutTests/fast/text/jp-sans-serif-expected-mismatch.html >@@ -0,0 +1,9 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<meta charset="utf-8"> >+</head> >+<body> >+<div lang="jp" style="font: 48px serif;">ãããããªã·</div> >+</body> >+</html> >diff --git a/LayoutTests/fast/text/jp-sans-serif.html b/LayoutTests/fast/text/jp-sans-serif.html >new file mode 100644 >index 0000000000000000000000000000000000000000..14eb9a044b66fb8c7547bd8aeb2692ed6c26bd13 >--- /dev/null >+++ b/LayoutTests/fast/text/jp-sans-serif.html >@@ -0,0 +1,9 @@ >+<!DOCTYPE html> >+<html> >+<head> >+<meta charset="utf-8"> >+</head> >+<body> >+<div lang="jp" style="font: 48px sans-serif;">ãããããªã·</div> >+</body> >+</html>
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 187723
:
345137
|
345200
|
345277
|
345301
|
346259
|
346260
|
346264
|
360532
|
360536
|
360538
|
360539
|
360540
|
360610
|
360624
|
360628
|
360631
|
360633
|
360654
|
360664
|
360665
|
360671
|
360679
|
360887
|
360901
|
360905
|
360909
|
360911
|
360917
|
360924
|
360932
|
360935
|
360968
|
360982
|
360985
|
360987
|
361078
|
361580
|
361737
|
361738