michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: #ifndef nsIStyleSheetLinkingElement_h__ michael@0: #define nsIStyleSheetLinkingElement_h__ michael@0: michael@0: michael@0: #include "nsISupports.h" michael@0: michael@0: class nsICSSLoaderObserver; michael@0: class nsIURI; michael@0: michael@0: #define NS_ISTYLESHEETLINKINGELEMENT_IID \ michael@0: { 0xd753c84a, 0x17fd, 0x4d5f, \ michael@0: { 0xb2, 0xe9, 0x63, 0x52, 0x8c, 0x87, 0x99, 0x7a } } michael@0: michael@0: class nsIStyleSheet; michael@0: class nsCSSStyleSheet; michael@0: michael@0: class nsIStyleSheetLinkingElement : public nsISupports { michael@0: public: michael@0: NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISTYLESHEETLINKINGELEMENT_IID) michael@0: michael@0: /** michael@0: * Used to make the association between a style sheet and michael@0: * the element that linked it to the document. michael@0: * michael@0: * @param aStyleSheet the style sheet associated with this michael@0: * element. michael@0: */ michael@0: NS_IMETHOD SetStyleSheet(nsCSSStyleSheet* aStyleSheet) = 0; michael@0: michael@0: /** michael@0: * Used to obtain the style sheet linked in by this element. michael@0: * michael@0: * @param aStyleSheet out parameter that returns the style michael@0: * sheet associated with this element. michael@0: */ michael@0: NS_IMETHOD GetStyleSheet(nsIStyleSheet*& aStyleSheet) = 0; michael@0: michael@0: /** michael@0: * Initialize the stylesheet linking element. If aDontLoadStyle is michael@0: * true the element will ignore the first modification to the michael@0: * element that would cause a stylesheet to be loaded. Subsequent michael@0: * modifications to the element will not be ignored. michael@0: */ michael@0: NS_IMETHOD InitStyleLinkElement(bool aDontLoadStyle) = 0; michael@0: michael@0: /** michael@0: * Tells this element to update the stylesheet. michael@0: * michael@0: * @param aObserver observer to notify once the stylesheet is loaded. michael@0: * This will be passed to the CSSLoader michael@0: * @param [out] aWillNotify whether aObserver will be notified when the sheet michael@0: * loads. If this is false, then either we didn't michael@0: * start the sheet load at all, the load failed, or michael@0: * this was an inline sheet that completely finished michael@0: * loading. In the case when the load failed the michael@0: * failure code will be returned. michael@0: * @param [out] whether the sheet is an alternate sheet. This value is only michael@0: * meaningful if aWillNotify is true. michael@0: */ michael@0: NS_IMETHOD UpdateStyleSheet(nsICSSLoaderObserver* aObserver, michael@0: bool *aWillNotify, michael@0: bool *aIsAlternate) = 0; michael@0: michael@0: /** michael@0: * Tells this element whether to update the stylesheet when the michael@0: * element's properties change. michael@0: * michael@0: * @param aEnableUpdates update on changes or not. michael@0: */ michael@0: NS_IMETHOD SetEnableUpdates(bool aEnableUpdates) = 0; michael@0: michael@0: /** michael@0: * Gets the charset that the element claims the style sheet is in michael@0: * michael@0: * @param aCharset the charset michael@0: */ michael@0: NS_IMETHOD GetCharset(nsAString& aCharset) = 0; michael@0: michael@0: /** michael@0: * Tells this element to use a different base URI. This is used for michael@0: * proper loading of xml-stylesheet processing instructions in XUL overlays michael@0: * and is only currently used by nsXMLStylesheetPI. michael@0: * michael@0: * @param aNewBaseURI the new base URI, nullptr to use the default base URI. michael@0: */ michael@0: virtual void OverrideBaseURI(nsIURI* aNewBaseURI) = 0; michael@0: michael@0: // This doesn't entirely belong here since they only make sense for michael@0: // some types of linking elements, but it's a better place than michael@0: // anywhere else. michael@0: virtual void SetLineNumber(uint32_t aLineNumber) = 0; michael@0: }; michael@0: michael@0: NS_DEFINE_STATIC_IID_ACCESSOR(nsIStyleSheetLinkingElement, michael@0: NS_ISTYLESHEETLINKINGELEMENT_IID) michael@0: michael@0: #endif // nsILinkingElement_h__