Bug 1154150 - Only create a FontFaceSet if we find @font-face rules. r=jdaggett
authorCameron McCormack <cam@mcc.id.au>
Sat, 09 May 2015 14:47:09 +1000
changeset 274459 acfe0afcedee4ec594b72ced81c4bc545be51c62
parent 274458 22d300d1944542fa9d6e566ac7720776ffd6d59a
child 274460 c2315e5bc62d3abdac22abef69bbef48395ffa12
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjdaggett
bugs1154150
milestone40.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 1154150 - Only create a FontFaceSet if we find @font-face rules. r=jdaggett
layout/base/nsPresContext.cpp
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -2105,20 +2105,24 @@ nsPresContext::FlushUserFontSet()
 
   if (mFontFaceSetDirty) {
     if (gfxPlatform::GetPlatform()->DownloadableFontsEnabled()) {
       nsTArray<nsFontFaceRuleContainer> rules;
       if (!mShell->StyleSet()->AppendFontFaceRules(rules)) {
         return;
       }
 
-      if (!mFontFaceSet) {
+      bool changed = false;
+
+      if (!mFontFaceSet && !rules.IsEmpty()) {
         mFontFaceSet = new FontFaceSet(mDocument->GetInnerWindow(), this);
       }
-      bool changed = mFontFaceSet->UpdateRules(rules);
+      if (mFontFaceSet) {
+        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();
       }