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
This commit is contained in:
Xidorn Quan 2015-12-01 09:39:37 +11:00
parent 28f2c8f11d
commit 4b5a4691e5
2 changed files with 7 additions and 23 deletions

View File

@ -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

View File

@ -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?