Bug 1028497 - Part 16: Don't destroy the user font set if there are no @font-face rules. r=jfkthame
authorCameron McCormack <cam@mcc.id.au>
Thu, 02 Oct 2014 12:32:08 +1000
changeset 231544 173f651e00217dd15cc3f84fcffe954a90babb60
parent 231543 4a4859122698eaf366f56e252a75d45e44b23192
child 231545 90f3ab4d59c924ee47fc8e3602ea109b43328c25
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1028497
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -2104,36 +2104,24 @@ nsPresContext::FlushUserFontSet()
             // to not unset our mFontFaceSetDirty bit, so when someone really
             // does we'll create it.
   }
 
   if (mFontFaceSetDirty) {
     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,
       // without a reflow, nothing will happen to start any downloads
       // that are needed.)
       if (changed) {
         UserFontSetUpdated();
       }