2012-05-21 12:12:37 +01: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/. */
|
2003-03-06 23:59:18 +00:00
|
|
|
|
2010-07-14 18:53:11 -07:00
|
|
|
#ifndef nsXBLDocumentInfo_h__
|
|
|
|
#define nsXBLDocumentInfo_h__
|
|
|
|
|
2013-05-29 13:43:41 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2001-11-02 01:53:13 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2007-08-09 15:30:30 -07:00
|
|
|
#include "nsAutoPtr.h"
|
2001-11-02 01:53:13 +00:00
|
|
|
#include "nsWeakReference.h"
|
|
|
|
#include "nsIDocument.h"
|
2007-01-04 22:31:26 +00:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2001-11-02 01:53:13 +00:00
|
|
|
|
2003-03-06 23:59:18 +00:00
|
|
|
class nsXBLPrototypeBinding;
|
2007-08-09 15:30:30 -07:00
|
|
|
class nsXBLDocGlobalObject;
|
2001-11-02 01:53:13 +00:00
|
|
|
|
2015-03-21 12:28:04 -04:00
|
|
|
class nsXBLDocumentInfo final : public nsSupportsWeakReference
|
2001-11-02 01:53:13 +00:00
|
|
|
{
|
|
|
|
public:
|
2007-01-04 22:31:26 +00:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
2004-02-09 22:48:53 +00:00
|
|
|
|
2014-09-01 20:49:25 -04:00
|
|
|
explicit nsXBLDocumentInfo(nsIDocument* aDocument);
|
2004-02-09 22:48:53 +00:00
|
|
|
|
2010-07-14 18:55:54 -07:00
|
|
|
already_AddRefed<nsIDocument> GetDocument()
|
2011-09-16 16:22:44 -04:00
|
|
|
{ nsCOMPtr<nsIDocument> copy = mDocument; return copy.forget(); }
|
2004-02-09 22:48:53 +00:00
|
|
|
|
2013-12-13 08:54:04 -08:00
|
|
|
bool GetScriptAccess() const { return mScriptAccess; }
|
2001-11-02 01:53:13 +00:00
|
|
|
|
2010-07-14 18:55:54 -07:00
|
|
|
nsIURI* DocumentURI() { return mDocument->GetDocumentURI(); }
|
2001-11-02 01:53:13 +00:00
|
|
|
|
2010-07-14 18:55:54 -07:00
|
|
|
nsXBLPrototypeBinding* GetPrototypeBinding(const nsACString& aRef);
|
|
|
|
nsresult SetPrototypeBinding(const nsACString& aRef,
|
|
|
|
nsXBLPrototypeBinding* aBinding);
|
2001-11-02 01:53:13 +00:00
|
|
|
|
2011-11-03 16:39:08 -04:00
|
|
|
// This removes the binding without deleting it
|
|
|
|
void RemovePrototypeBinding(const nsACString& aRef);
|
|
|
|
|
|
|
|
nsresult WritePrototypeBindings();
|
|
|
|
|
2010-07-14 18:55:54 -07:00
|
|
|
void SetFirstPrototypeBinding(nsXBLPrototypeBinding* aBinding);
|
2014-02-25 20:32:48 -08:00
|
|
|
|
2010-07-14 18:55:54 -07:00
|
|
|
void FlushSkinStylesheets();
|
2001-12-17 22:51:39 +00:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsChrome() { return mIsChrome; }
|
2005-08-21 22:20:36 +00:00
|
|
|
|
2012-08-22 11:56:38 -04:00
|
|
|
void MarkInCCGeneration(uint32_t aGeneration);
|
2011-12-29 16:34:05 +02:00
|
|
|
|
2011-11-03 16:39:08 -04:00
|
|
|
static nsresult ReadPrototypeBindings(nsIURI* aURI, nsXBLDocumentInfo** aDocInfo);
|
|
|
|
|
2013-08-09 09:25:14 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsXBLDocumentInfo)
|
2007-01-04 22:31:26 +00:00
|
|
|
|
2001-11-02 01:53:13 +00:00
|
|
|
private:
|
2014-06-23 15:56:07 -04:00
|
|
|
virtual ~nsXBLDocumentInfo();
|
|
|
|
|
2001-11-02 01:53:13 +00:00
|
|
|
nsCOMPtr<nsIDocument> mDocument;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mScriptAccess;
|
|
|
|
bool mIsChrome;
|
2003-03-06 23:59:18 +00:00
|
|
|
// the binding table owns each nsXBLPrototypeBinding
|
2014-02-25 20:32:48 -08:00
|
|
|
nsAutoPtr<nsClassHashtable<nsCStringHashKey, nsXBLPrototypeBinding>> mBindingTable;
|
|
|
|
|
2007-02-24 16:27:51 +00:00
|
|
|
// non-owning pointer to the first binding in the table
|
|
|
|
nsXBLPrototypeBinding* mFirstBinding;
|
2001-11-02 01:53:13 +00:00
|
|
|
};
|
2010-07-14 18:53:11 -07:00
|
|
|
|
2013-08-09 09:25:12 -07:00
|
|
|
#ifdef DEBUG
|
|
|
|
void AssertInCompilationScope();
|
|
|
|
#else
|
|
|
|
inline void AssertInCompilationScope() {}
|
|
|
|
#endif
|
|
|
|
|
2010-07-14 18:53:11 -07:00
|
|
|
#endif
|