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/. */
|
2001-11-11 04:15:22 +03:00
|
|
|
|
2013-11-20 20:29:04 +04:00
|
|
|
#ifndef nsXBLResourceLoader_h
|
|
|
|
#define nsXBLResourceLoader_h
|
|
|
|
|
2013-05-30 00:43:41 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2001-11-11 04:15:22 +03:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsICSSLoaderObserver.h"
|
2007-03-11 14:56:09 +03:00
|
|
|
#include "nsCOMArray.h"
|
2007-03-08 14:17:16 +03:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2001-11-11 04:15:22 +03:00
|
|
|
|
|
|
|
class nsIContent;
|
|
|
|
class nsIAtom;
|
|
|
|
class nsXBLPrototypeResources;
|
2003-03-07 02:59:18 +03:00
|
|
|
class nsXBLPrototypeBinding;
|
2013-02-01 14:56:02 +04:00
|
|
|
struct nsXBLResource;
|
2013-08-24 06:42:40 +04:00
|
|
|
class nsIObjectOutputStream;
|
2017-06-05 08:06:52 +03:00
|
|
|
class nsIDocument;
|
2001-11-11 04:15:22 +03:00
|
|
|
|
|
|
|
// *********************************************************************/
|
|
|
|
// The XBLResourceLoader class
|
|
|
|
|
|
|
|
class nsXBLResourceLoader : public nsICSSLoaderObserver
|
|
|
|
{
|
|
|
|
public:
|
2007-03-08 14:17:16 +03:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS(nsXBLResourceLoader)
|
2001-11-11 04:15:22 +03:00
|
|
|
|
|
|
|
// nsICSSLoaderObserver
|
2016-09-26 15:03:25 +03:00
|
|
|
NS_IMETHOD StyleSheetLoaded(mozilla::StyleSheet* aSheet,
|
2014-06-20 14:32:49 +04:00
|
|
|
bool aWasAlternate,
|
2015-03-21 19:28:04 +03:00
|
|
|
nsresult aStatus) override;
|
2001-11-11 04:15:22 +03:00
|
|
|
|
2017-06-05 09:30:52 +03:00
|
|
|
bool LoadResources(nsIContent* aBoundElement);
|
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);
|
|
|
|
|
2003-03-07 02:59:18 +03:00
|
|
|
nsXBLResourceLoader(nsXBLPrototypeBinding* aBinding,
|
|
|
|
nsXBLPrototypeResources* aResources);
|
2001-11-11 04:15:22 +03:00
|
|
|
|
|
|
|
void NotifyBoundElements();
|
|
|
|
|
2011-11-04 00:39:08 +04:00
|
|
|
nsresult Write(nsIObjectOutputStream* aStream);
|
|
|
|
|
2001-11-11 04:15:22 +03:00
|
|
|
// MEMBER VARIABLES
|
2003-03-07 02:59:18 +03:00
|
|
|
nsXBLPrototypeBinding* mBinding; // A pointer back to our binding.
|
2004-01-06 02:46:00 +03:00
|
|
|
nsXBLPrototypeResources* mResources; // A pointer back to our resources
|
|
|
|
// information. May be null if the
|
|
|
|
// resources have already been
|
|
|
|
// destroyed.
|
2017-05-10 06:45:11 +03:00
|
|
|
|
2001-11-11 04:15:22 +03:00
|
|
|
nsXBLResource* mResourceList; // The list of resources we need to load.
|
|
|
|
nsXBLResource* mLastResource;
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mLoadingResources;
|
2005-09-12 22:41:15 +04:00
|
|
|
// We need mInLoadResourcesFunc because we do a mixture of sync and
|
|
|
|
// async loads.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mInLoadResourcesFunc;
|
2012-08-22 19:56:38 +04:00
|
|
|
int16_t mPendingSheets; // The number of stylesheets that have yet to load.
|
2007-03-11 14:56:09 +03:00
|
|
|
|
|
|
|
// Bound elements that are waiting on the stylesheets and scripts.
|
|
|
|
nsCOMArray<nsIContent> mBoundElements;
|
2014-06-23 23:56:07 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual ~nsXBLResourceLoader();
|
2017-06-05 08:06:52 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
// The bound document is needed in StyleSheetLoaded() for servo style
|
|
|
|
// backend, which will be set in LoadResources().
|
|
|
|
nsIDocument* MOZ_NON_OWNING_REF mBoundDocument;
|
2001-11-11 04:15:22 +03:00
|
|
|
};
|
|
|
|
|
2013-11-20 20:29:04 +04:00
|
|
|
#endif
|