Bumping gaia.json for 2 gaia revision(s) a=gaia-bump
[gecko.git] / dom / xbl / nsXBLPrototypeResources.h
blob23d266ffcb6154dcf65b34a2f8046985e9ee98e7
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__
9 #include "nsAutoPtr.h"
10 #include "nsICSSLoaderObserver.h"
12 class nsCSSRuleProcessor;
13 class nsIAtom;
14 class nsIContent;
15 class nsXBLPrototypeBinding;
16 class nsXBLResourceLoader;
18 namespace mozilla {
19 class CSSStyleSheet;
20 } // namespace mozilla
22 // *********************************************************************/
23 // The XBLPrototypeResources class
25 class nsXBLPrototypeResources
27 public:
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);
39 void Unlink();
41 void ClearLoader();
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;
51 /**
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; }
60 private:
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;
71 #endif