2015-05-03 19:32:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00: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-15 01:53:11 +00:00
|
|
|
#ifndef nsXBLDocumentInfo_h__
|
|
|
|
#define nsXBLDocumentInfo_h__
|
|
|
|
|
2013-05-29 20:43:41 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2001-11-02 01:53:13 +00:00
|
|
|
#include "nsCOMPtr.h"
|
2007-08-09 22:30:30 +00: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;
|
2001-11-02 01:53:13 +00:00
|
|
|
|
2015-03-21 16:28:04 +00: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-02 00:49:25 +00:00
|
|
|
explicit nsXBLDocumentInfo(nsIDocument* aDocument);
|
2004-02-09 22:48:53 +00:00
|
|
|
|
2010-07-15 01:55:54 +00:00
|
|
|
already_AddRefed<nsIDocument> GetDocument()
|
2011-09-16 20:22:44 +00:00
|
|
|
{ nsCOMPtr<nsIDocument> copy = mDocument; return copy.forget(); }
|
2004-02-09 22:48:53 +00:00
|
|
|
|
2013-12-13 16:54:04 +00:00
|
|
|
bool GetScriptAccess() const { return mScriptAccess; }
|
2001-11-02 01:53:13 +00:00
|
|
|
|
2010-07-15 01:55:54 +00:00
|
|
|
nsIURI* DocumentURI() { return mDocument->GetDocumentURI(); }
|
2001-11-02 01:53:13 +00:00
|
|
|
|
2010-07-15 01:55:54 +00:00
|
|
|
nsXBLPrototypeBinding* GetPrototypeBinding(const nsACString& aRef);
|
|
|
|
nsresult SetPrototypeBinding(const nsACString& aRef,
|
|
|
|
nsXBLPrototypeBinding* aBinding);
|
2001-11-02 01:53:13 +00:00
|
|
|
|
2011-11-03 20:39:08 +00:00
|
|
|
// This removes the binding without deleting it
|
|
|
|
void RemovePrototypeBinding(const nsACString& aRef);
|
|
|
|
|
|
|
|
nsresult WritePrototypeBindings();
|
|
|
|
|
2010-07-15 01:55:54 +00:00
|
|
|
void SetFirstPrototypeBinding(nsXBLPrototypeBinding* aBinding);
|
2014-02-26 04:32:48 +00:00
|
|
|
|
2010-07-15 01:55:54 +00:00
|
|
|
void FlushSkinStylesheets();
|
2001-12-17 22:51:39 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool IsChrome() { return mIsChrome; }
|
2005-08-21 22:20:36 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
void MarkInCCGeneration(uint32_t aGeneration);
|
2011-12-29 14:34:05 +00:00
|
|
|
|
2011-11-03 20:39:08 +00:00
|
|
|
static nsresult ReadPrototypeBindings(nsIURI* aURI, nsXBLDocumentInfo** aDocInfo);
|
|
|
|
|
2013-08-09 16:25:14 +00: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 19:56:07 +00:00
|
|
|
virtual ~nsXBLDocumentInfo();
|
|
|
|
|
2001-11-02 01:53:13 +00:00
|
|
|
nsCOMPtr<nsIDocument> mDocument;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool mScriptAccess;
|
|
|
|
bool mIsChrome;
|
2003-03-06 23:59:18 +00:00
|
|
|
// the binding table owns each nsXBLPrototypeBinding
|
2014-02-26 04:32:48 +00: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-15 01:53:11 +00:00
|
|
|
|
2013-08-09 16:25:12 +00:00
|
|
|
#ifdef DEBUG
|
|
|
|
void AssertInCompilationScope();
|
|
|
|
#else
|
|
|
|
inline void AssertInCompilationScope() {}
|
|
|
|
#endif
|
|
|
|
|
2010-07-15 01:53:11 +00:00
|
|
|
#endif
|