Bug 1259889 Part 2 - Load html.css lazily for pref changes. r=heycam

We need to re-evaluate html.css whenever "dom.details_element.enabled"
is changed to make the disclosure triangle for summary elements show up.
Reftests for details and summary will need the a live pref to work.

MozReview-Commit-ID: 9SN1fQBuwA7

--HG--
extra : rebase_source : c8eafde9d3a97908c44099219603f76087d484b9
This commit is contained in:
Ting-Yu Lin 2016-04-01 21:11:11 +08:00
Родитель 219e330768
Коммит 7b794c38a3
2 изменённых файлов: 16 добавлений и 8 удалений

Просмотреть файл

@ -134,6 +134,11 @@ nsLayoutStylesheetCache::UASheet()
StyleSheetHandle
nsLayoutStylesheetCache::HTMLSheet()
{
if (!mHTMLSheet) {
LoadSheetURL("resource://gre-resources/html.css",
mHTMLSheet, eAgentSheetFeatures);
}
return mHTMLSheet;
}
@ -319,8 +324,6 @@ nsLayoutStylesheetCache::nsLayoutStylesheetCache(StyleBackendType aType)
// 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",
@ -375,6 +378,8 @@ nsLayoutStylesheetCache::For(StyleBackendType aType)
// "layout.css.example-pref.enabled");
Preferences::RegisterCallback(&DependentPrefChanged,
"layout.css.grid.enabled");
Preferences::RegisterCallback(&DependentPrefChanged,
"dom.details_element.enabled");
}
return cache;
@ -818,6 +823,7 @@ nsLayoutStylesheetCache::DependentPrefChanged(const char* aPref, void* aData)
gStyleCache_Servo ? &gStyleCache_Servo->sheet_ : nullptr);
INVALIDATE(mUASheet); // for layout.css.grid.enabled
INVALIDATE(mHTMLSheet); // for dom.details_element.enabled
#undef INVALIDATE
}

Просмотреть файл

@ -771,13 +771,15 @@ video > .caption-box {
}
/* details & summary */
/* Need to revert Bug 1259889 Part 2 when removing details preference. */
@supports -moz-bool-pref("dom.details_element.enabled") {
details > summary::-moz-list-bullet {
list-style-type: disclosure-closed;
}
details > summary::-moz-list-bullet {
list-style-type: disclosure-closed;
}
details[open] > summary::-moz-list-bullet {
list-style-type: disclosure-open;
details[open] > summary::-moz-list-bullet {
list-style-type: disclosure-open;
}
}
/* emulation of non-standard HTML <marquee> tag */