Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 : #ifndef nsIStyleSheetLinkingElement_h__
7 : #define nsIStyleSheetLinkingElement_h__
8 :
9 :
10 : #include "nsISupports.h"
11 : #include "mozilla/StyleSheet.h"
12 :
13 : class nsICSSLoaderObserver;
14 : class nsIURI;
15 :
16 : #define NS_ISTYLESHEETLINKINGELEMENT_IID \
17 : { 0xa8b79f3b, 0x9d18, 0x4f9c, \
18 : { 0xb1, 0xaa, 0x8c, 0x9b, 0x1b, 0xaa, 0xac, 0xad } }
19 :
20 11 : class nsIStyleSheetLinkingElement : public nsISupports {
21 : public:
22 : NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISTYLESHEETLINKINGELEMENT_IID)
23 :
24 : /**
25 : * Used to make the association between a style sheet and
26 : * the element that linked it to the document.
27 : *
28 : * @param aStyleSheet the style sheet associated with this
29 : * element.
30 : */
31 : NS_IMETHOD SetStyleSheet(mozilla::StyleSheet* aStyleSheet) = 0;
32 :
33 : /**
34 : * Used to obtain the style sheet linked in by this element.
35 : *
36 : * @return the style sheet associated with this element.
37 : */
38 : NS_IMETHOD_(mozilla::StyleSheet*) GetStyleSheet() = 0;
39 :
40 : /**
41 : * Initialize the stylesheet linking element. If aDontLoadStyle is
42 : * true the element will ignore the first modification to the
43 : * element that would cause a stylesheet to be loaded. Subsequent
44 : * modifications to the element will not be ignored.
45 : */
46 : NS_IMETHOD InitStyleLinkElement(bool aDontLoadStyle) = 0;
47 :
48 : /**
49 : * Tells this element to update the stylesheet.
50 : *
51 : * @param aObserver observer to notify once the stylesheet is loaded.
52 : * This will be passed to the CSSLoader
53 : * @param [out] aWillNotify whether aObserver will be notified when the sheet
54 : * loads. If this is false, then either we didn't
55 : * start the sheet load at all, the load failed, or
56 : * this was an inline sheet that completely finished
57 : * loading. In the case when the load failed the
58 : * failure code will be returned.
59 : * @param [out] whether the sheet is an alternate sheet. This value is only
60 : * meaningful if aWillNotify is true.
61 : * @param aForceUpdate whether we wand to force the update, flushing the
62 : * cached version if any.
63 : */
64 : NS_IMETHOD UpdateStyleSheet(nsICSSLoaderObserver* aObserver,
65 : bool *aWillNotify,
66 : bool *aIsAlternate,
67 : bool aForceUpdate = false) = 0;
68 :
69 : /**
70 : * Tells this element whether to update the stylesheet when the
71 : * element's properties change.
72 : *
73 : * @param aEnableUpdates update on changes or not.
74 : */
75 : NS_IMETHOD SetEnableUpdates(bool aEnableUpdates) = 0;
76 :
77 : /**
78 : * Gets the charset that the element claims the style sheet is in
79 : *
80 : * @param aCharset the charset
81 : */
82 : NS_IMETHOD GetCharset(nsAString& aCharset) = 0;
83 :
84 : /**
85 : * Tells this element to use a different base URI. This is used for
86 : * proper loading of xml-stylesheet processing instructions in XUL overlays
87 : * and is only currently used by nsXMLStylesheetPI.
88 : *
89 : * @param aNewBaseURI the new base URI, nullptr to use the default base URI.
90 : */
91 : virtual void OverrideBaseURI(nsIURI* aNewBaseURI) = 0;
92 :
93 : // This doesn't entirely belong here since they only make sense for
94 : // some types of linking elements, but it's a better place than
95 : // anywhere else.
96 : virtual void SetLineNumber(uint32_t aLineNumber) = 0;
97 :
98 : /**
99 : * Get the line number, as previously set by SetLineNumber.
100 : *
101 : * @return the line number of this element; or 1 if no line number
102 : * was set
103 : */
104 : virtual uint32_t GetLineNumber() = 0;
105 : };
106 :
107 : NS_DEFINE_STATIC_IID_ACCESSOR(nsIStyleSheetLinkingElement,
108 : NS_ISTYLESHEETLINKINGELEMENT_IID)
109 :
110 : #endif // nsILinkingElement_h__
|