nsIStyleSheetService.idl (2621B)
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/. */ 5 6 /* interface for managing user and user-agent style sheets */ 7 8 #include "nsISupports.idl" 9 10 interface nsIPreloadedStyleSheet; 11 interface nsIURI; 12 13 /* 14 * nsIStyleSheetService allows extensions or embeddors to add to the 15 * built-in list of user or agent style sheets. 16 */ 17 18 [scriptable, uuid(4de68896-e8eb-41de-8237-a797b570ac4a)] 19 interface nsIStyleSheetService : nsISupports 20 { 21 const unsigned long AGENT_SHEET = 0; 22 const unsigned long USER_SHEET = 1; 23 const unsigned long AUTHOR_SHEET = 2; 24 25 /** 26 * Synchronously loads a style sheet from |sheetURI| and adds it to the list 27 * of user or agent style sheets. 28 * 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). 32 * 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). 35 * 36 * The relative ordering of two user or two agent sheets loaded via 37 * this API is undefined. 38 * 39 * Sheets added via this API take effect on all documents, including 40 * already-loaded ones, immediately. 41 */ 42 void loadAndRegisterSheet(in nsIURI sheetURI, in unsigned long type); 43 44 /** 45 * Returns true if a style sheet at |sheetURI| has previously been 46 * added to the list of style sheets specified by |type|. 47 */ 48 boolean sheetRegistered(in nsIURI sheetURI, in unsigned long type); 49 50 /** 51 * Synchronously loads a style sheet from |sheetURI| and returns the 52 * new style sheet object. Can be used with nsIDOMWindowUtils.addSheet. 53 */ 54 nsIPreloadedStyleSheet preloadSheet(in nsIURI sheetURI, 55 in unsigned long type); 56 57 /** 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. 61 */ 62 [implicit_jscontext] 63 jsval preloadSheetAsync(in nsIURI sheetURI, in unsigned long type); 64 65 /** 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. 69 */ 70 void unregisterSheet(in nsIURI sheetURI, in unsigned long type); 71 };