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/. */
6 #ifndef nsXBLPrototypeResources_h__
7 #define nsXBLPrototypeResources_h__
10 #include "nsICSSLoaderObserver.h"
12 class nsCSSRuleProcessor
;
15 class nsXBLPrototypeBinding
;
16 class nsXBLResourceLoader
;
20 } // namespace mozilla
22 // *********************************************************************/
23 // The XBLPrototypeResources class
25 class nsXBLPrototypeResources
28 explicit nsXBLPrototypeResources(nsXBLPrototypeBinding
* aBinding
);
29 ~nsXBLPrototypeResources();
31 void LoadResources(bool* aResult
);
32 void AddResource(nsIAtom
* aResourceType
, const nsAString
& aSrc
);
33 void AddResourceListener(nsIContent
* aElement
);
34 nsresult
FlushSkinSheets();
36 nsresult
Write(nsIObjectOutputStream
* aStream
);
38 void Traverse(nsCycleCollectionTraversalCallback
&cb
);
43 void AppendStyleSheet(mozilla::CSSStyleSheet
* aSheet
);
44 void RemoveStyleSheet(mozilla::CSSStyleSheet
* aSheet
);
45 void InsertStyleSheetAt(size_t aIndex
, mozilla::CSSStyleSheet
* aSheet
);
46 mozilla::CSSStyleSheet
* StyleSheetAt(size_t aIndex
) const;
47 size_t SheetCount() const;
48 bool HasStyleSheets() const;
49 void AppendStyleSheetsTo(nsTArray
<mozilla::CSSStyleSheet
*>& aResult
) const;
52 * Recreates mRuleProcessor to represent the current list of style sheets
53 * stored in mStyleSheetList. (Named GatherRuleProcessor to parallel
54 * nsStyleSet::GatherRuleProcessors.)
56 void GatherRuleProcessor();
58 nsCSSRuleProcessor
* GetRuleProcessor() const { return mRuleProcessor
; }
61 // A loader object. Exists only long enough to load resources, and then it dies.
62 nsRefPtr
<nsXBLResourceLoader
> mLoader
;
64 // A list of loaded stylesheets for this binding.
65 nsTArray
<nsRefPtr
<mozilla::CSSStyleSheet
>> mStyleSheetList
;
67 // The list of stylesheets converted to a rule processor.
68 nsRefPtr
<nsCSSRuleProcessor
> mRuleProcessor
;