2015-05-03 12:32:37 -07: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 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
|
|
|
|
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"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsCOMPtr.h"
|
2007-08-09 15:30:30 -07:00
|
|
|
#include "nsAutoPtr.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
#include "nsWeakReference.h"
|
|
|
|
#include "nsIDocument.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
|
|
|
|
class nsXBLPrototypeBinding;
|
|
|
|
|
2015-03-21 09:28:04 -07:00
|
|
|
class nsXBLDocumentInfo final : public nsSupportsWeakReference
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
|
2014-09-01 17:49:25 -07:00
|
|
|
explicit nsXBLDocumentInfo(nsIDocument* aDocument);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-07-14 18:55:54 -07:00
|
|
|
already_AddRefed<nsIDocument> GetDocument()
|
2011-09-16 13:22:44 -07:00
|
|
|
{ nsCOMPtr<nsIDocument> copy = mDocument; return copy.forget(); }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2013-12-13 08:54:04 -08:00
|
|
|
bool GetScriptAccess() const { return mScriptAccess; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-07-14 18:55:54 -07:00
|
|
|
nsIURI* DocumentURI() { return mDocument->GetDocumentURI(); }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2010-07-14 18:55:54 -07:00
|
|
|
nsXBLPrototypeBinding* GetPrototypeBinding(const nsACString& aRef);
|
|
|
|
nsresult SetPrototypeBinding(const nsACString& aRef,
|
|
|
|
nsXBLPrototypeBinding* aBinding);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-11-03 13:39:08 -07: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();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsChrome() { return mIsChrome; }
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
void MarkInCCGeneration(uint32_t aGeneration);
|
2011-12-29 06:34:05 -08:00
|
|
|
|
2011-11-03 13:39:08 -07: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-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
private:
|
2014-06-23 12:56:07 -07:00
|
|
|
virtual ~nsXBLDocumentInfo();
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsIDocument> mDocument;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mScriptAccess;
|
|
|
|
bool mIsChrome;
|
2007-03-22 10:30:00 -07:00
|
|
|
// the binding table owns each nsXBLPrototypeBinding
|
2014-02-25 20:32:48 -08:00
|
|
|
nsAutoPtr<nsClassHashtable<nsCStringHashKey, nsXBLPrototypeBinding>> mBindingTable;
|
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
// non-owning pointer to the first binding in the table
|
|
|
|
nsXBLPrototypeBinding* mFirstBinding;
|
|
|
|
};
|
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
|