1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 /* interface for managing user and user-agent style sheets */
8 #include
"nsISupports.idl"
10 interface nsIPreloadedStyleSheet
;
14 * nsIStyleSheetService allows extensions or embeddors to add to the
15 * built-in list of user or agent style sheets.
18 [scriptable
, uuid(4de68896
-e8eb
-41de
-8237-a797b570ac4a
)]
19 interface nsIStyleSheetService
: nsISupports
21 const unsigned long AGENT_SHEET
= 0;
22 const unsigned long USER_SHEET
= 1;
23 const unsigned long AUTHOR_SHEET
= 2;
26 * Synchronously loads a style sheet from |sheetURI| and adds it to the list
27 * of user or agent style sheets.
29 * A user sheet loaded via this API will come before userContent.css and
30 * userChrome.css in the cascade (so the rules in it will have lower
31 * precedence than rules in those sheets).
33 * An agent sheet loaded via this API will come after ua.css in the cascade
34 * (so the rules in it will have higher precedence than rules in ua.css).
36 * The relative ordering of two user or two agent sheets loaded via
37 * this API is undefined.
39 * Sheets added via this API take effect on all documents, including
40 * already-loaded ones, immediately.
42 void loadAndRegisterSheet
(in nsIURI sheetURI
, in unsigned long type
);
45 * Returns true if a style sheet at |sheetURI| has previously been
46 * added to the list of style sheets specified by |type|.
48 boolean sheetRegistered
(in nsIURI sheetURI
, in unsigned long type
);
51 * Synchronously loads a style sheet from |sheetURI| and returns the
52 * new style sheet object. Can be used with nsIDOMWindowUtils.addSheet.
54 nsIPreloadedStyleSheet preloadSheet
(in nsIURI sheetURI
,
55 in unsigned long type
);
58 * Asynchronously loads a style sheet from |sheetURI| and returns a Promise
59 * which resolves to the new style sheet object, which can be used with
60 * nsIDOMWindowUtils.addSheet, when it has completed loading.
63 jsval preloadSheetAsync
(in nsIURI sheetURI
, in unsigned long type
);
66 * Remove the style sheet at |sheetURI| from the list of style sheets
67 * specified by |type|. The removal takes effect immediately, even for
68 * already-loaded documents.
70 void unregisterSheet
(in nsIURI sheetURI
, in unsigned long type
);