mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-22 01:35:35 +00:00
Bug 1187144 (part 2) - Replace nsBaseHashtable::Enumerate() calls in layout/ with iterators. r=dholbert.
--HG-- extra : rebase_source : e8535e8cf9d215d3ee6dafccae22bd19983d2c5f
This commit is contained in:
parent
f14cc10a3d
commit
c6fc31d161
@ -662,21 +662,6 @@ FontFaceSet::StartLoad(gfxUserFontEntry* aUserFontEntry,
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static PLDHashOperator DetachFontEntries(const nsAString& aKey,
|
|
||||||
RefPtr<gfxUserFontFamily>& aFamily,
|
|
||||||
void* aUserArg)
|
|
||||||
{
|
|
||||||
aFamily->DetachFontEntries();
|
|
||||||
return PL_DHASH_NEXT;
|
|
||||||
}
|
|
||||||
|
|
||||||
static PLDHashOperator RemoveIfEmpty(const nsAString& aKey,
|
|
||||||
RefPtr<gfxUserFontFamily>& aFamily,
|
|
||||||
void* aUserArg)
|
|
||||||
{
|
|
||||||
return aFamily->GetFontList().Length() ? PL_DHASH_NEXT : PL_DHASH_REMOVE;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
FontFaceSet::UpdateRules(const nsTArray<nsFontFaceRuleContainer>& aRules)
|
FontFaceSet::UpdateRules(const nsTArray<nsFontFaceRuleContainer>& aRules)
|
||||||
{
|
{
|
||||||
@ -711,7 +696,9 @@ FontFaceSet::UpdateRules(const nsTArray<nsFontFaceRuleContainer>& aRules)
|
|||||||
// the same font entries as before. (The order can affect font selection
|
// the same font entries as before. (The order can affect font selection
|
||||||
// where multiple faces match the requested style, perhaps with overlapping
|
// where multiple faces match the requested style, perhaps with overlapping
|
||||||
// unicode-range coverage.)
|
// unicode-range coverage.)
|
||||||
mUserFontSet->mFontFamilies.Enumerate(DetachFontEntries, nullptr);
|
for (auto it = mUserFontSet->mFontFamilies.Iter(); !it.Done(); it.Next()) {
|
||||||
|
it.Data()->DetachFontEntries();
|
||||||
|
}
|
||||||
|
|
||||||
// Sometimes aRules has duplicate @font-face rules in it; we should make
|
// Sometimes aRules has duplicate @font-face rules in it; we should make
|
||||||
// that not happen, but in the meantime, don't try to insert the same
|
// that not happen, but in the meantime, don't try to insert the same
|
||||||
@ -743,7 +730,11 @@ FontFaceSet::UpdateRules(const nsTArray<nsFontFaceRuleContainer>& aRules)
|
|||||||
|
|
||||||
// Remove any residual families that have no font entries (i.e., they were
|
// Remove any residual families that have no font entries (i.e., they were
|
||||||
// not defined at all by the updated set of @font-face rules).
|
// not defined at all by the updated set of @font-face rules).
|
||||||
mUserFontSet->mFontFamilies.Enumerate(RemoveIfEmpty, nullptr);
|
for (auto it = mUserFontSet->mFontFamilies.Iter(); !it.Done(); it.Next()) {
|
||||||
|
if (it.Data()->GetFontList().IsEmpty()) {
|
||||||
|
it.Remove();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If any FontFace objects for rules are left in the old list, note that the
|
// If any FontFace objects for rules are left in the old list, note that the
|
||||||
// set has changed (even if the new set was built entirely by migrating old
|
// set has changed (even if the new set was built entirely by migrating old
|
||||||
|
Loading…
Reference in New Issue
Block a user