Bug 1187144 (part 2) - Replace nsBaseHashtable::Enumerate() calls in layout/ with iterators. r=dholbert.

--HG--
extra : rebase_source : e8535e8cf9d215d3ee6dafccae22bd19983d2c5f
This commit is contained in:
Nicholas Nethercote 2015-11-22 21:08:22 -08:00
parent f14cc10a3d
commit c6fc31d161

View File

@ -662,21 +662,6 @@ FontFaceSet::StartLoad(gfxUserFontEntry* aUserFontEntry,
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
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
// where multiple faces match the requested style, perhaps with overlapping
// 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
// 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
// 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
// set has changed (even if the new set was built entirely by migrating old