|
1 /* -*- Mode: C++; 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 #ifndef nsIStyleSheetLinkingElement_h__ |
|
6 #define nsIStyleSheetLinkingElement_h__ |
|
7 |
|
8 |
|
9 #include "nsISupports.h" |
|
10 |
|
11 class nsICSSLoaderObserver; |
|
12 class nsIURI; |
|
13 |
|
14 #define NS_ISTYLESHEETLINKINGELEMENT_IID \ |
|
15 { 0xd753c84a, 0x17fd, 0x4d5f, \ |
|
16 { 0xb2, 0xe9, 0x63, 0x52, 0x8c, 0x87, 0x99, 0x7a } } |
|
17 |
|
18 class nsIStyleSheet; |
|
19 class nsCSSStyleSheet; |
|
20 |
|
21 class nsIStyleSheetLinkingElement : public nsISupports { |
|
22 public: |
|
23 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISTYLESHEETLINKINGELEMENT_IID) |
|
24 |
|
25 /** |
|
26 * Used to make the association between a style sheet and |
|
27 * the element that linked it to the document. |
|
28 * |
|
29 * @param aStyleSheet the style sheet associated with this |
|
30 * element. |
|
31 */ |
|
32 NS_IMETHOD SetStyleSheet(nsCSSStyleSheet* aStyleSheet) = 0; |
|
33 |
|
34 /** |
|
35 * Used to obtain the style sheet linked in by this element. |
|
36 * |
|
37 * @param aStyleSheet out parameter that returns the style |
|
38 * sheet associated with this element. |
|
39 */ |
|
40 NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aStyleSheet) = 0; |
|
41 |
|
42 /** |
|
43 * Initialize the stylesheet linking element. If aDontLoadStyle is |
|
44 * true the element will ignore the first modification to the |
|
45 * element that would cause a stylesheet to be loaded. Subsequent |
|
46 * modifications to the element will not be ignored. |
|
47 */ |
|
48 NS_IMETHOD InitStyleLinkElement(bool aDontLoadStyle) = 0; |
|
49 |
|
50 /** |
|
51 * Tells this element to update the stylesheet. |
|
52 * |
|
53 * @param aObserver observer to notify once the stylesheet is loaded. |
|
54 * This will be passed to the CSSLoader |
|
55 * @param [out] aWillNotify whether aObserver will be notified when the sheet |
|
56 * loads. If this is false, then either we didn't |
|
57 * start the sheet load at all, the load failed, or |
|
58 * this was an inline sheet that completely finished |
|
59 * loading. In the case when the load failed the |
|
60 * failure code will be returned. |
|
61 * @param [out] whether the sheet is an alternate sheet. This value is only |
|
62 * meaningful if aWillNotify is true. |
|
63 */ |
|
64 NS_IMETHOD UpdateStyleSheet(nsICSSLoaderObserver* aObserver, |
|
65 bool *aWillNotify, |
|
66 bool *aIsAlternate) = 0; |
|
67 |
|
68 /** |
|
69 * Tells this element whether to update the stylesheet when the |
|
70 * element's properties change. |
|
71 * |
|
72 * @param aEnableUpdates update on changes or not. |
|
73 */ |
|
74 NS_IMETHOD SetEnableUpdates(bool aEnableUpdates) = 0; |
|
75 |
|
76 /** |
|
77 * Gets the charset that the element claims the style sheet is in |
|
78 * |
|
79 * @param aCharset the charset |
|
80 */ |
|
81 NS_IMETHOD GetCharset(nsAString& aCharset) = 0; |
|
82 |
|
83 /** |
|
84 * Tells this element to use a different base URI. This is used for |
|
85 * proper loading of xml-stylesheet processing instructions in XUL overlays |
|
86 * and is only currently used by nsXMLStylesheetPI. |
|
87 * |
|
88 * @param aNewBaseURI the new base URI, nullptr to use the default base URI. |
|
89 */ |
|
90 virtual void OverrideBaseURI(nsIURI* aNewBaseURI) = 0; |
|
91 |
|
92 // This doesn't entirely belong here since they only make sense for |
|
93 // some types of linking elements, but it's a better place than |
|
94 // anywhere else. |
|
95 virtual void SetLineNumber(uint32_t aLineNumber) = 0; |
|
96 }; |
|
97 |
|
98 NS_DEFINE_STATIC_IID_ACCESSOR(nsIStyleSheetLinkingElement, |
|
99 NS_ISTYLESHEETLINKINGELEMENT_IID) |
|
100 |
|
101 #endif // nsILinkingElement_h__ |