Bug 1420229 - Create a new components.css file and load it as a UA stylesheet;r=bz,Gijs
This provides a place for current XBL stylesheets to be loaded without using XBL <resources>, that load as a UA sheet instead of loading them as document sheets. This makes the styles apply more similarly to XBL, in that they are less specific than document styles. MozReview-Commit-ID: 3ewomJZMbrk
This commit is contained in:
@@ -2438,6 +2438,12 @@ nsDocumentViewer::CreateStyleSet(nsIDocument* aDocument)
|
||||
}
|
||||
|
||||
if (aDocument->LoadsFullXULStyleSheetUpFront()) {
|
||||
// This is the only place components.css gets loaded, unlike xul.css
|
||||
sheet = cache->XULComponentsSheet();
|
||||
if (sheet) {
|
||||
styleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
}
|
||||
|
||||
// nsXULElement::BindToTree loads xul.css on-demand if we don't load it
|
||||
// up-front here.
|
||||
sheet = cache->XULSheet();
|
||||
|
||||
@@ -156,6 +156,17 @@ nsLayoutStylesheetCache::XULSheet()
|
||||
return mXULSheet;
|
||||
}
|
||||
|
||||
StyleSheet*
|
||||
nsLayoutStylesheetCache::XULComponentsSheet()
|
||||
{
|
||||
if (!mXULComponentsSheet) {
|
||||
LoadSheetURL("chrome://global/content/components.css",
|
||||
&mXULComponentsSheet, eAgentSheetFeatures, eCrash);
|
||||
}
|
||||
|
||||
return mXULComponentsSheet;
|
||||
}
|
||||
|
||||
StyleSheet*
|
||||
nsLayoutStylesheetCache::QuirkSheet()
|
||||
{
|
||||
@@ -313,6 +324,7 @@ nsLayoutStylesheetCache::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf
|
||||
MEASURE(mUserChromeSheet);
|
||||
MEASURE(mUserContentSheet);
|
||||
MEASURE(mXULSheet);
|
||||
MEASURE(mXULComponentsSheet);
|
||||
|
||||
// Measurement of the following members may be added later if DMD finds it is
|
||||
// worthwhile:
|
||||
@@ -353,6 +365,7 @@ nsLayoutStylesheetCache::nsLayoutStylesheetCache(StyleBackendType aType)
|
||||
if (XRE_IsParentProcess()) {
|
||||
// We know we need xul.css for the UI, so load that now too:
|
||||
XULSheet();
|
||||
XULComponentsSheet();
|
||||
}
|
||||
|
||||
auto& userContentSheetURL = aType == StyleBackendType::Gecko ?
|
||||
|
||||
@@ -63,6 +63,7 @@ class nsLayoutStylesheetCache final
|
||||
mozilla::StyleSheet* HTMLSheet();
|
||||
mozilla::StyleSheet* MinimalXULSheet();
|
||||
mozilla::StyleSheet* XULSheet();
|
||||
mozilla::StyleSheet* XULComponentsSheet();
|
||||
mozilla::StyleSheet* QuirkSheet();
|
||||
mozilla::StyleSheet* SVGSheet();
|
||||
mozilla::StyleSheet* MathMLSheet();
|
||||
@@ -131,6 +132,7 @@ private:
|
||||
RefPtr<mozilla::StyleSheet> mUserChromeSheet;
|
||||
RefPtr<mozilla::StyleSheet> mUserContentSheet;
|
||||
RefPtr<mozilla::StyleSheet> mXULSheet;
|
||||
RefPtr<mozilla::StyleSheet> mXULComponentsSheet;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
9
toolkit/content/components.css
Normal file
9
toolkit/content/components.css
Normal file
@@ -0,0 +1,9 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* ===== components.css =================================================
|
||||
== Styles ported from XBL <resources>, loaded as UA styles in every XUL doc
|
||||
======================================================================= */
|
||||
|
||||
@import url("chrome://global/skin/menu.css");
|
||||
@@ -4,6 +4,7 @@ toolkit.jar:
|
||||
content/global/XPCNativeWrapper.js
|
||||
content/global/minimal-xul.css
|
||||
* content/global/xul.css
|
||||
content/global/components.css
|
||||
content/global/textbox.css
|
||||
content/global/menulist.css
|
||||
content/global/autocomplete.css
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
/* all localizable skin settings shall live here */
|
||||
@import url("chrome://global/locale/intl.css");
|
||||
@import url("chrome://global/skin/menu.css");
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
|
||||
/* all localizable skin settings shall live here */
|
||||
@import url("chrome://global/locale/intl.css");
|
||||
@import url("chrome://global/skin/menu.css");
|
||||
|
||||
%include shared.inc
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
/* all localizable skin settings shall live here */
|
||||
@import url("chrome://global/locale/intl.css");
|
||||
@import url("chrome://global/skin/menu.css");
|
||||
|
||||
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user