Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / layout / style / nsICSSStyleSheet.h
blob5d71493a5c77b165c1c197df1daea883d9f19bfe
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* ***** BEGIN LICENSE BLOCK *****
3 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
5 * The contents of this file are subject to the Mozilla Public License Version
6 * 1.1 (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 * http://www.mozilla.org/MPL/
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
15 * The Original Code is mozilla.org code.
17 * The Initial Developer of the Original Code is
18 * Netscape Communications Corporation.
19 * Portions created by the Initial Developer are Copyright (C) 1998
20 * the Initial Developer. All Rights Reserved.
22 * Contributor(s):
24 * Alternatively, the contents of this file may be used under the terms of
25 * either of the GNU General Public License Version 2 or later (the "GPL"),
26 * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27 * in which case the provisions of the GPL or the LGPL are applicable instead
28 * of those above. If you wish to allow use of your version of this file only
29 * under the terms of either the GPL or the LGPL, and not to allow others to
30 * use your version of this file under the terms of the MPL, indicate your
31 * decision by deleting the provisions above and replace them with the notice
32 * and other provisions required by the GPL or the LGPL. If you do not delete
33 * the provisions above, a recipient may use your version of this file under
34 * the terms of any one of the MPL, the GPL or the LGPL.
36 * ***** END LICENSE BLOCK ***** */
38 /* representation of a CSS style sheet */
40 #ifndef nsICSSStyleSheet_h___
41 #define nsICSSStyleSheet_h___
43 #include "nsIStyleSheet.h"
44 #include "nsString.h"
46 class nsICSSRule;
47 class nsIDOMNode;
48 class nsXMLNameSpaceMap;
49 class nsCSSRuleProcessor;
50 class nsMediaList;
51 class nsICSSGroupRule;
52 class nsICSSImportRule;
53 class nsIPrincipal;
55 // IID for the nsICSSStyleSheet interface
56 // ee0270c7-5581-4165-92a5-a83ff691f60d
57 #define NS_ICSS_STYLE_SHEET_IID \
58 { 0xee0270c7, 0x5581, 0x4165, \
59 { 0x92, 0xa5, 0xa8, 0x3f, 0xf6, 0x91, 0xf6, 0x0d } }
61 class nsICSSStyleSheet : public nsIStyleSheet {
62 public:
63 NS_DECLARE_STATIC_IID_ACCESSOR(NS_ICSS_STYLE_SHEET_IID)
65 NS_IMETHOD AppendStyleSheet(nsICSSStyleSheet* aSheet) = 0;
66 NS_IMETHOD InsertStyleSheetAt(nsICSSStyleSheet* aSheet, PRInt32 aIndex) = 0;
68 // XXX do these belong here or are they generic?
69 NS_IMETHOD PrependStyleRule(nsICSSRule* aRule) = 0;
70 NS_IMETHOD AppendStyleRule(nsICSSRule* aRule) = 0;
71 NS_IMETHOD ReplaceStyleRule(nsICSSRule* aOld, nsICSSRule* aNew) = 0;
73 NS_IMETHOD StyleRuleCount(PRInt32& aCount) const = 0;
74 NS_IMETHOD GetStyleRuleAt(PRInt32 aIndex, nsICSSRule*& aRule) const = 0;
76 NS_IMETHOD DeleteRuleFromGroup(nsICSSGroupRule* aGroup, PRUint32 aIndex) = 0;
77 NS_IMETHOD InsertRuleIntoGroup(const nsAString & aRule, nsICSSGroupRule* aGroup, PRUint32 aIndex, PRUint32* _retval) = 0;
78 NS_IMETHOD ReplaceRuleInGroup(nsICSSGroupRule* aGroup, nsICSSRule* aOld, nsICSSRule* aNew) = 0;
80 NS_IMETHOD StyleSheetCount(PRInt32& aCount) const = 0;
81 NS_IMETHOD GetStyleSheetAt(PRInt32 aIndex, nsICSSStyleSheet*& aSheet) const = 0;
83 /**
84 * SetURIs must be called on all sheets before parsing into them.
85 * SetURIs may only be called while the sheet is 1) incomplete and 2)
86 * has no rules in it
88 NS_IMETHOD SetURIs(nsIURI* aSheetURI, nsIURI* aOriginalSheetURI,
89 nsIURI* aBaseURI) = 0;
91 /**
92 * SetPrincipal should be called on all sheets before parsing into them.
93 * This can only be called once with a non-null principal. Calling this with
94 * a null pointer is allowed and is treated as a no-op.
96 virtual NS_HIDDEN_(void) SetPrincipal(nsIPrincipal* aPrincipal) = 0;
98 // Principal() never returns a null pointer.
99 virtual NS_HIDDEN_(nsIPrincipal*) Principal() const = 0;
101 NS_IMETHOD SetTitle(const nsAString& aTitle) = 0;
102 NS_IMETHOD SetMedia(nsMediaList* aMedia) = 0;
103 NS_IMETHOD SetOwningNode(nsIDOMNode* aOwningNode) = 0;
105 NS_IMETHOD SetOwnerRule(nsICSSImportRule* aOwnerRule) = 0;
106 NS_IMETHOD GetOwnerRule(nsICSSImportRule** aOwnerRule) = 0;
108 // get namespace map for sheet
109 virtual NS_HIDDEN_(nsXMLNameSpaceMap*) GetNameSpaceMap() const = 0;
111 NS_IMETHOD Clone(nsICSSStyleSheet* aCloneParent,
112 nsICSSImportRule* aCloneOwnerRule,
113 nsIDocument* aCloneDocument,
114 nsIDOMNode* aCloneOwningNode,
115 nsICSSStyleSheet** aClone) const = 0;
117 NS_IMETHOD IsModified(PRBool* aModified) const = 0; // returns the mDirty status of the sheet
118 NS_IMETHOD SetModified(PRBool aModified) = 0;
120 NS_IMETHOD AddRuleProcessor(nsCSSRuleProcessor* aProcessor) = 0;
121 NS_IMETHOD DropRuleProcessor(nsCSSRuleProcessor* aProcessor) = 0;
124 * Like the DOM insertRule() method, but doesn't do any security checks
126 NS_IMETHOD InsertRuleInternal(const nsAString& aRule,
127 PRUint32 aIndex, PRUint32* aReturn) = 0;
130 NS_DEFINE_STATIC_IID_ACCESSOR(nsICSSStyleSheet, NS_ICSS_STYLE_SHEET_IID)
132 nsresult
133 NS_NewCSSStyleSheet(nsICSSStyleSheet** aInstancePtrResult);
135 #endif /* nsICSSStyleSheet_h___ */