Bug 1533428 - patch 6 - Consistently use the gfxPlatformFontList::PrefFontList type instead of repeatedly spelling out the array declaration. r=jwatt

Differential Revision: https://phabricator.services.mozilla.com/D22930

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jonathan Kew 2019-04-01 14:33:16 +00:00
Родитель 27e809db53
Коммит 5f45afb7ec
3 изменённых файлов: 20 добавлений и 17 удалений

Просмотреть файл

@ -889,7 +889,7 @@ void gfxPlatformFontList::RemoveCmap(const gfxCharacterMap* aCharMap) {
void gfxPlatformFontList::ResolveGenericFontNames(
FontFamilyType aGenericType, eFontPrefLang aPrefLang,
nsTArray<RefPtr<gfxFontFamily>>* aGenericFamilies) {
PrefFontList* aGenericFamilies) {
const char* langGroupStr = GetPrefLangName(aPrefLang);
const char* generic = GetGenericName(aGenericType);
@ -924,7 +924,7 @@ void gfxPlatformFontList::ResolveGenericFontNames(
}
void gfxPlatformFontList::ResolveEmojiFontNames(
nsTArray<RefPtr<gfxFontFamily>>* aGenericFamilies) {
PrefFontList* aGenericFamilies) {
// emoji preference has no lang name
AutoTArray<nsCString, 4> genericFamilies;
@ -937,7 +937,7 @@ void gfxPlatformFontList::ResolveEmojiFontNames(
void gfxPlatformFontList::GetFontFamiliesFromGenericFamilies(
nsTArray<nsCString>& aGenericNameFamilies, nsAtom* aLangGroup,
nsTArray<RefPtr<gfxFontFamily>>* aGenericFamilies) {
PrefFontList* aGenericFamilies) {
// lookup and add platform fonts uniquely
for (const nsCString& genericFamily : aGenericNameFamilies) {
gfxFontStyle style;
@ -953,7 +953,7 @@ void gfxPlatformFontList::GetFontFamiliesFromGenericFamilies(
}
}
nsTArray<RefPtr<gfxFontFamily>>* gfxPlatformFontList::GetPrefFontsLangGroup(
gfxPlatformFontList::PrefFontList* gfxPlatformFontList::GetPrefFontsLangGroup(
mozilla::FontFamilyType aGenericType, eFontPrefLang aPrefLang) {
// treat -moz-fixed as monospace
if (aGenericType == eFamily_moz_fixed) {
@ -990,8 +990,7 @@ void gfxPlatformFontList::AddGenericFonts(
eFontPrefLang prefLang = GetFontPrefLangFor(langGroup);
// lookup pref fonts
nsTArray<RefPtr<gfxFontFamily>>* prefFonts =
GetPrefFontsLangGroup(aGenericType, prefLang);
PrefFontList* prefFonts = GetPrefFontsLangGroup(aGenericType, prefLang);
if (!prefFonts->IsEmpty()) {
aFamilyList.SetCapacity(aFamilyList.Length() + prefFonts->Length());

Просмотреть файл

@ -97,6 +97,11 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
typedef mozilla::WeightRange WeightRange;
typedef mozilla::unicode::Script Script;
// For font family lists loaded from user preferences (prefs such as
// font.name-list.<generic>.<langGroup>) that map CSS generics to
// platform-specific font families.
typedef nsTArray<RefPtr<gfxFontFamily>> PrefFontList;
static gfxPlatformFontList* PlatformFontList() { return sPlatformFontList; }
static nsresult Init() {
@ -257,8 +262,8 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
nsAtom* aLanguage,
nsTArray<FamilyAndGeneric>& aFamilyList);
nsTArray<RefPtr<gfxFontFamily>>* GetPrefFontsLangGroup(
mozilla::FontFamilyType aGenericType, eFontPrefLang aPrefLang);
PrefFontList* GetPrefFontsLangGroup(mozilla::FontFamilyType aGenericType,
eFontPrefLang aPrefLang);
// in some situations, need to make decisions about ambiguous characters, may
// need to look at multiple pref langs
@ -481,15 +486,15 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
void RebuildLocalFonts();
void ResolveGenericFontNames(
mozilla::FontFamilyType aGenericType, eFontPrefLang aPrefLang,
nsTArray<RefPtr<gfxFontFamily>>* aGenericFamilies);
void ResolveGenericFontNames(mozilla::FontFamilyType aGenericType,
eFontPrefLang aPrefLang,
PrefFontList* aGenericFamilies);
void ResolveEmojiFontNames(nsTArray<RefPtr<gfxFontFamily>>* aGenericFamilies);
void ResolveEmojiFontNames(PrefFontList* aGenericFamilies);
void GetFontFamiliesFromGenericFamilies(
nsTArray<nsCString>& aGenericFamilies, nsAtom* aLangGroup,
nsTArray<RefPtr<gfxFontFamily>>* aFontFamilies);
void GetFontFamiliesFromGenericFamilies(nsTArray<nsCString>& aGenericFamilies,
nsAtom* aLangGroup,
PrefFontList* aFontFamilies);
virtual nsresult InitFontListForPlatform() = 0;
@ -547,7 +552,6 @@ class gfxPlatformFontList : public gfxFontInfoLoader {
// localized family names missed when face name loading takes a long time
mozilla::UniquePtr<nsTHashtable<nsCStringHashKey>> mOtherNamesMissed;
typedef nsTArray<RefPtr<gfxFontFamily>> PrefFontList;
typedef mozilla::RangedArray<mozilla::UniquePtr<PrefFontList>,
mozilla::eFamily_generic_first,
mozilla::eFamily_generic_count>

Просмотреть файл

@ -3177,7 +3177,7 @@ gfxFont* gfxFontGroup::WhichPrefFontSupportsChar(uint32_t aCh,
eFontPrefLang currentLang = prefLangs[i];
mozilla::FontFamilyType defaultGeneric =
pfl->GetDefaultGeneric(currentLang);
nsTArray<RefPtr<gfxFontFamily>>* families =
gfxPlatformFontList::PrefFontList* families =
pfl->GetPrefFontsLangGroup(defaultGeneric, currentLang);
NS_ASSERTION(families, "no pref font families found");