2001-11-11 04:15:22 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2012-05-21 15:12:37 +04: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/. */
|
2001-11-11 04:15:22 +03:00
|
|
|
|
2003-03-07 02:59:18 +03:00
|
|
|
#ifndef nsXBLPrototypeResources_h__
|
|
|
|
#define nsXBLPrototypeResources_h__
|
|
|
|
|
2013-03-22 04:05:20 +04:00
|
|
|
#include "nsAutoPtr.h"
|
2001-11-11 04:15:22 +03:00
|
|
|
#include "nsICSSLoaderObserver.h"
|
|
|
|
|
2014-06-19 11:02:56 +04:00
|
|
|
class nsCSSRuleProcessor;
|
2001-11-11 04:15:22 +03:00
|
|
|
class nsIAtom;
|
2014-06-19 11:02:56 +04:00
|
|
|
class nsIContent;
|
2003-03-07 02:59:18 +03:00
|
|
|
class nsXBLPrototypeBinding;
|
2014-06-19 11:02:56 +04:00
|
|
|
class nsXBLResourceLoader;
|
2001-11-11 04:15:22 +03:00
|
|
|
|
2014-06-20 14:32:49 +04:00
|
|
|
namespace mozilla {
|
|
|
|
class CSSStyleSheet;
|
|
|
|
} // namespace mozilla
|
|
|
|
|
2001-11-11 04:15:22 +03:00
|
|
|
// *********************************************************************/
|
|
|
|
// The XBLPrototypeResources class
|
|
|
|
|
|
|
|
class nsXBLPrototypeResources
|
|
|
|
{
|
|
|
|
public:
|
2014-04-10 18:05:21 +04:00
|
|
|
nsXBLPrototypeResources(nsXBLPrototypeBinding* aBinding);
|
|
|
|
~nsXBLPrototypeResources();
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
void LoadResources(bool* aResult);
|
2002-03-24 01:46:13 +03:00
|
|
|
void AddResource(nsIAtom* aResourceType, const nsAString& aSrc);
|
2001-11-11 04:15:22 +03:00
|
|
|
void AddResourceListener(nsIContent* aElement);
|
2001-12-18 01:51:39 +03:00
|
|
|
nsresult FlushSkinSheets();
|
2001-11-11 04:15:22 +03:00
|
|
|
|
2011-11-04 00:39:08 +04:00
|
|
|
nsresult Write(nsIObjectOutputStream* aStream);
|
|
|
|
|
2014-06-24 06:09:36 +04:00
|
|
|
void Traverse(nsCycleCollectionTraversalCallback &cb);
|
|
|
|
void Unlink();
|
2014-04-10 18:05:21 +04:00
|
|
|
|
|
|
|
void ClearLoader();
|
2001-11-11 04:15:22 +03:00
|
|
|
|
2014-06-20 14:32:49 +04: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 11:02:56 +04:00
|
|
|
size_t SheetCount() const;
|
|
|
|
bool HasStyleSheets() const;
|
2014-06-20 14:32:49 +04:00
|
|
|
void AppendStyleSheetsTo(nsTArray<mozilla::CSSStyleSheet*>& aResult) const;
|
2014-04-10 18:05:21 +04:00
|
|
|
|
2014-06-19 11:02:56 +04: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 18:05:21 +04:00
|
|
|
private:
|
|
|
|
// A loader object. Exists only long enough to load resources, and then it dies.
|
2014-04-10 18:05:21 +04:00
|
|
|
nsRefPtr<nsXBLResourceLoader> mLoader;
|
2014-04-10 18:05:21 +04:00
|
|
|
|
|
|
|
// A list of loaded stylesheets for this binding.
|
2014-06-20 14:32:49 +04:00
|
|
|
nsTArray<nsRefPtr<mozilla::CSSStyleSheet>> mStyleSheetList;
|
2004-07-28 11:08:41 +04:00
|
|
|
|
|
|
|
// The list of stylesheets converted to a rule processor.
|
2014-06-19 11:02:56 +04:00
|
|
|
nsRefPtr<nsCSSRuleProcessor> mRuleProcessor;
|
2001-11-11 04:15:22 +03:00
|
|
|
};
|
|
|
|
|
2003-03-07 02:59:18 +03:00
|
|
|
#endif
|