nsIStyleSheetService.idl 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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. /* interface for managing user and user-agent style sheets */
  6. #include "nsISupports.idl"
  7. interface nsIURI;
  8. interface nsIDOMStyleSheet;
  9. /*
  10. * nsIStyleSheetService allows extensions or embeddors to add to the
  11. * built-in list of user or agent style sheets.
  12. */
  13. [scriptable, uuid(4de68896-e8eb-41de-8237-a797b570ac4a)]
  14. interface nsIStyleSheetService : nsISupports
  15. {
  16. const unsigned long AGENT_SHEET = 0;
  17. const unsigned long USER_SHEET = 1;
  18. const unsigned long AUTHOR_SHEET = 2;
  19. /**
  20. * Synchronously loads a style sheet from |sheetURI| and adds it to the list
  21. * of user or agent style sheets.
  22. *
  23. * A user sheet loaded via this API will come before userContent.css and
  24. * userChrome.css in the cascade (so the rules in it will have lower
  25. * precedence than rules in those sheets).
  26. *
  27. * An agent sheet loaded via this API will come after ua.css in the cascade
  28. * (so the rules in it will have higher precedence than rules in ua.css).
  29. *
  30. * The relative ordering of two user or two agent sheets loaded via
  31. * this API is undefined.
  32. *
  33. * Sheets added via this API take effect on all documents, including
  34. * already-loaded ones, immediately.
  35. */
  36. void loadAndRegisterSheet(in nsIURI sheetURI, in unsigned long type);
  37. /**
  38. * Returns true if a style sheet at |sheetURI| has previously been
  39. * added to the list of style sheets specified by |type|.
  40. */
  41. boolean sheetRegistered(in nsIURI sheetURI, in unsigned long type);
  42. /**
  43. * Synchronously loads a style sheet from |sheetURI| and returns the
  44. * new style sheet object. Can be used with nsIDOMWindowUtils.addSheet.
  45. */
  46. nsIDOMStyleSheet preloadSheet(in nsIURI sheetURI, in unsigned long type);
  47. /**
  48. * Remove the style sheet at |sheetURI| from the list of style sheets
  49. * specified by |type|. The removal takes effect immediately, even for
  50. * already-loaded documents.
  51. */
  52. void unregisterSheet(in nsIURI sheetURI, in unsigned long type);
  53. };