From e561bc26bf0156ab00620e332d0e1737f425930c Mon Sep 17 00:00:00 2001 From: Cameron McCormack Date: Thu, 2 Oct 2014 12:32:08 +1000 Subject: [PATCH] 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. --- layout/base/nsPresContext.cpp | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/layout/base/nsPresContext.cpp b/layout/base/nsPresContext.cpp index 6a0a9932a62..e8e941e08fa 100644 --- a/layout/base/nsPresContext.cpp +++ b/layout/base/nsPresContext.cpp @@ -2109,26 +2109,14 @@ nsPresContext::FlushUserFontSet() if (gfxPlatform::GetPlatform()->DownloadableFontsEnabled()) { nsTArray 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,