2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
#ifndef nsXBLPrototypeResources_h__
|
|
|
|
#define nsXBLPrototypeResources_h__
|
|
|
|
|
2013-03-21 17:05:20 -07:00
|
|
|
#include "nsAutoPtr.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsICSSLoaderObserver.h"
|
|
|
|
|
2014-06-19 00:02:56 -07:00
|
|
|
class nsCSSRuleProcessor;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsIAtom;
|
2014-06-19 00:02:56 -07:00
|
|
|
class nsIContent;
|
2007-03-22 10:30:00 -07:00
|
|
|
class nsXBLPrototypeBinding;
|
2014-06-19 00:02:56 -07:00
|
|
|
class nsXBLResourceLoader;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-06-20 03:32:49 -07:00
|
|
|
namespace mozilla {
|
|
|
|
class CSSStyleSheet;
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// *********************************************************************/
|
|
|
|
// The XBLPrototypeResources class
|
|
|
|
|
|
|
|
class nsXBLPrototypeResources
|
|
|
|
{
|
|
|
|
public:
|
2014-04-10 07:05:21 -07:00
|
|
|
nsXBLPrototypeResources(nsXBLPrototypeBinding* aBinding);
|
|
|
|
~nsXBLPrototypeResources();
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
void LoadResources(bool* aResult);
|
2007-03-22 10:30:00 -07:00
|
|
|
void AddResource(nsIAtom* aResourceType, const nsAString& aSrc);
|
|
|
|
void AddResourceListener(nsIContent* aElement);
|
|
|
|
nsresult FlushSkinSheets();
|
|
|
|
|
2011-11-03 13:39:08 -07:00
|
|
|
nsresult Write(nsIObjectOutputStream* aStream);
|
|
|
|
|
2014-04-10 07:05:21 -07:00
|
|
|
void Traverse(nsCycleCollectionTraversalCallback &cb) const;
|
|
|
|
|
|
|
|
void ClearLoader();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2014-06-20 03:32:49 -07:00
|
|
|
void AppendStyleSheet(mozilla::CSSStyleSheet* aSheet);
|
|
|
|
void RemoveStyleSheet(mozilla::CSSStyleSheet* aSheet);
|
|
|
|
void InsertStyleSheetAt(size_t aIndex, mozilla::CSSStyleSheet* aSheet);
|
|
|
|
mozilla::CSSStyleSheet* StyleSheetAt(size_t aIndex) const;
|
2014-06-19 00:02:56 -07:00
|
|
|
size_t SheetCount() const;
|
|
|
|
bool HasStyleSheets() const;
|
2014-06-20 03:32:49 -07:00
|
|
|
void AppendStyleSheetsTo(nsTArray<mozilla::CSSStyleSheet*>& aResult) const;
|
2014-04-10 07:05:21 -07:00
|
|
|
|
2014-06-19 00:02:56 -07:00
|
|
|
/**
|
|
|
|
* Recreates mRuleProcessor to represent the current list of style sheets
|
|
|
|
* stored in mStyleSheetList. (Named GatherRuleProcessor to parallel
|
|
|
|
* nsStyleSet::GatherRuleProcessors.)
|
|
|
|
*/
|
|
|
|
void GatherRuleProcessor();
|
|
|
|
|
|
|
|
nsCSSRuleProcessor* GetRuleProcessor() const { return mRuleProcessor; }
|
|
|
|
|
2014-04-10 07:05:21 -07:00
|
|
|
private:
|
|
|
|
// A loader object. Exists only long enough to load resources, and then it dies.
|
2014-04-10 07:05:21 -07:00
|
|
|
nsRefPtr<nsXBLResourceLoader> mLoader;
|
2014-04-10 07:05:21 -07:00
|
|
|
|
|
|
|
// A list of loaded stylesheets for this binding.
|
2014-06-20 03:32:49 -07:00
|
|
|
nsTArray<nsRefPtr<mozilla::CSSStyleSheet>> mStyleSheetList;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// The list of stylesheets converted to a rule processor.
|
2014-06-19 00:02:56 -07:00
|
|
|
nsRefPtr<nsCSSRuleProcessor> mRuleProcessor;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|