From 4b5a4691e57d421f4de3e58bc690b441731687ae Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Tue, 1 Dec 2015 09:39:37 +1100 Subject: [PATCH] Bug 1202940 part 1 - Move html.css and ua.css back to be loaded in constructor of nsLayoutStylesheetCache. r=dbaron DependentPrefChanged and InvalidateSheet are no longer used anywhere, but it is probably better to keep them as-is, since we may need them again in the future. --HG-- extra : source : 5e976ebbbba3b4ce8d83d40e4d071184ab52aaaa --- layout/style/nsLayoutStylesheetCache.cpp | 25 +++++++----------------- modules/libpref/init/all.js | 5 ----- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/layout/style/nsLayoutStylesheetCache.cpp b/layout/style/nsLayoutStylesheetCache.cpp index 90916c28b4be..70917fe47a21 100644 --- a/layout/style/nsLayoutStylesheetCache.cpp +++ b/layout/style/nsLayoutStylesheetCache.cpp @@ -128,12 +128,6 @@ CSSStyleSheet* nsLayoutStylesheetCache::UASheet() { EnsureGlobal(); - - if (!gStyleCache->mUASheet) { - LoadSheetURL("resource://gre-resources/ua.css", - gStyleCache->mUASheet, eAgentSheetFeatures); - } - return gStyleCache->mUASheet; } @@ -141,12 +135,6 @@ CSSStyleSheet* nsLayoutStylesheetCache::HTMLSheet() { EnsureGlobal(); - - if (!gStyleCache->mHTMLSheet) { - LoadSheetURL("resource://gre-resources/html.css", - gStyleCache->mHTMLSheet, eAgentSheetFeatures); - } - return gStyleCache->mHTMLSheet; } @@ -363,12 +351,16 @@ nsLayoutStylesheetCache::nsLayoutStylesheetCache() // per-profile, since they're profile-invariant. LoadSheetURL("resource://gre-resources/counterstyles.css", mCounterStylesSheet, eAgentSheetFeatures); + LoadSheetURL("resource://gre-resources/html.css", + mHTMLSheet, eAgentSheetFeatures); LoadSheetURL("chrome://global/content/minimal-xul.css", mMinimalXULSheet, eAgentSheetFeatures); LoadSheetURL("resource://gre-resources/quirk.css", mQuirkSheet, eAgentSheetFeatures); LoadSheetURL("resource://gre/res/svg.css", mSVGSheet, eAgentSheetFeatures); + LoadSheetURL("resource://gre-resources/ua.css", + mUASheet, eAgentSheetFeatures); LoadSheetURL("chrome://global/content/xul.css", mXULSheet, eAgentSheetFeatures); @@ -407,8 +399,8 @@ nsLayoutStylesheetCache::EnsureGlobal() // on (such as a pref that enables a property that a UA style sheet uses), // register DependentPrefChanged as a callback to ensure that the relevant // style sheets will be re-parsed. - Preferences::RegisterCallback(&DependentPrefChanged, - "layout.css.ruby.enabled"); + // Preferences::RegisterCallback(&DependentPrefChanged, + // "layout.css.example-pref.enabled"); } void @@ -811,10 +803,7 @@ nsLayoutStylesheetCache::DependentPrefChanged(const char* aPref, void* aData) // to be re-parsed by dropping the sheet from gCSSLoader's cache then // setting our cached sheet pointer to null. This will only work for sheets // that are loaded lazily. - - // for layout.css.ruby.enabled - InvalidateSheet(gStyleCache->mUASheet); - InvalidateSheet(gStyleCache->mHTMLSheet); + // InvalidateSheet(gStyleCache->mSomeLazilyLoadedSheet); } /* static */ void diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 04496031ce92..35ae02b07745 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -2385,11 +2385,6 @@ pref("layout.css.grid-template-subgrid-value.enabled", false); pref("layout.css.contain.enabled", false); // Is support for CSS Ruby enabled? -// -// When this pref is removed, make sure that the pref callback registration -// in nsLayoutStylesheetCache::EnsureGlobal and the invalidation of -// mUASheet in nsLayoutStylesheetCache::DependentPrefChanged (if it's not -// otherwise needed) are removed. pref("layout.css.ruby.enabled", true); // Is support for CSS display:contents enabled?