Bug 1028497 - Part 16: Don't destroy the user font set if there are no @font-face rules. r=jfkthame

We can no longer call FontFaceSet::DestroyUserFontSet (what used to be
nsUserFontSet::Destroy) in nsPresContext::FlushUserFontSet, since we
need to keep tracking FontFace objects even if the list of @font-face
rules is empty.
This commit is contained in:
Cameron McCormack 2014-10-02 12:32:08 +10:00
parent 31eedc22b4
commit e561bc26bf

View File

@ -2109,26 +2109,14 @@ nsPresContext::FlushUserFontSet()
if (gfxPlatform::GetPlatform()->DownloadableFontsEnabled()) {
nsTArray<nsFontFaceRuleContainer> rules;
if (!mShell->StyleSet()->AppendFontFaceRules(this, rules)) {
if (mFontFaceSet) {
mFontFaceSet->DestroyUserFontSet();
}
return;
}
bool changed = false;
if (rules.Length() == 0) {
if (mFontFaceSet) {
mFontFaceSet->DestroyUserFontSet();
changed = true;
}
} else {
if (!mFontFaceSet) {
mFontFaceSet = new FontFaceSet(mDocument->GetInnerWindow(), this);
}
mFontFaceSet->EnsureUserFontSet(this);
changed = mFontFaceSet->UpdateRules(rules);
if (!mFontFaceSet) {
mFontFaceSet = new FontFaceSet(mDocument->GetInnerWindow(), this);
}
mFontFaceSet->EnsureUserFontSet(this);
bool changed = mFontFaceSet->UpdateRules(rules);
// We need to enqueue a style change reflow (for later) to
// reflect that we're modifying @font-face rules. (However,