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