2009-12-31 07:56:32 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
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/. */
|
2009-12-31 07:56:32 -08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* style sheet and style rule processor representing style attributes
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsHTMLCSSStyleSheet_h_
|
|
|
|
#define nsHTMLCSSStyleSheet_h_
|
|
|
|
|
2011-12-16 11:42:07 -08:00
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
|
2013-03-21 17:05:20 -07:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsDataHashtable.h"
|
2009-12-31 07:56:33 -08:00
|
|
|
#include "nsIStyleSheet.h"
|
2009-12-31 07:56:32 -08:00
|
|
|
#include "nsIStyleRuleProcessor.h"
|
|
|
|
|
2012-09-30 09:40:24 -07:00
|
|
|
struct MiscContainer;
|
|
|
|
|
2012-06-18 20:26:34 -07:00
|
|
|
class nsHTMLCSSStyleSheet MOZ_FINAL : public nsIStyleSheet,
|
|
|
|
public nsIStyleRuleProcessor {
|
2009-12-31 07:56:32 -08:00
|
|
|
public:
|
|
|
|
nsHTMLCSSStyleSheet();
|
2012-09-30 09:40:24 -07:00
|
|
|
~nsHTMLCSSStyleSheet();
|
2009-12-31 07:56:32 -08:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2009-12-31 07:56:33 -08:00
|
|
|
nsresult Init(nsIURI* aURL, nsIDocument* aDocument);
|
2010-05-17 21:00:39 -07:00
|
|
|
void Reset(nsIURI* aURL);
|
2009-12-31 07:56:33 -08:00
|
|
|
|
|
|
|
// nsIStyleSheet
|
2010-05-17 21:00:39 -07:00
|
|
|
virtual nsIURI* GetSheetURI() const;
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsIURI* GetBaseURI() const MOZ_OVERRIDE;
|
|
|
|
virtual void GetTitle(nsString& aTitle) const MOZ_OVERRIDE;
|
|
|
|
virtual void GetType(nsString& aType) const MOZ_OVERRIDE;
|
|
|
|
virtual bool HasRules() const MOZ_OVERRIDE;
|
|
|
|
virtual bool IsApplicable() const MOZ_OVERRIDE;
|
|
|
|
virtual void SetEnabled(bool aEnabled) MOZ_OVERRIDE;
|
|
|
|
virtual bool IsComplete() const MOZ_OVERRIDE;
|
|
|
|
virtual void SetComplete() MOZ_OVERRIDE;
|
|
|
|
virtual nsIStyleSheet* GetParentSheet() const MOZ_OVERRIDE; // will be null
|
|
|
|
virtual nsIDocument* GetOwningDocument() const MOZ_OVERRIDE;
|
|
|
|
virtual void SetOwningDocument(nsIDocument* aDocument) MOZ_OVERRIDE;
|
2009-12-31 07:56:33 -08:00
|
|
|
#ifdef DEBUG
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const MOZ_OVERRIDE;
|
2009-12-31 07:56:33 -08:00
|
|
|
#endif
|
2009-12-31 07:56:32 -08:00
|
|
|
|
2009-12-31 07:56:33 -08:00
|
|
|
// nsIStyleRuleProcessor
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual void RulesMatching(ElementRuleProcessorData* aData) MOZ_OVERRIDE;
|
|
|
|
virtual void RulesMatching(PseudoElementRuleProcessorData* aData) MOZ_OVERRIDE;
|
|
|
|
virtual void RulesMatching(AnonBoxRuleProcessorData* aData) MOZ_OVERRIDE;
|
2009-12-31 07:56:32 -08:00
|
|
|
#ifdef MOZ_XUL
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual void RulesMatching(XULTreeRuleProcessorData* aData) MOZ_OVERRIDE;
|
2009-12-31 07:56:32 -08:00
|
|
|
#endif
|
2012-09-14 09:10:08 -07:00
|
|
|
virtual nsRestyleHint HasStateDependentStyle(StateRuleProcessorData* aData) MOZ_OVERRIDE;
|
|
|
|
virtual bool HasDocumentStateDependentStyle(StateRuleProcessorData* aData) MOZ_OVERRIDE;
|
2010-03-31 17:43:32 -07:00
|
|
|
virtual nsRestyleHint
|
2012-09-14 09:10:08 -07:00
|
|
|
HasAttributeDependentStyle(AttributeRuleProcessorData* aData) MOZ_OVERRIDE;
|
|
|
|
virtual bool MediumFeaturesChanged(nsPresContext* aPresContext) MOZ_OVERRIDE;
|
2013-03-23 19:14:43 -07:00
|
|
|
virtual size_t SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf)
|
|
|
|
const MOZ_MUST_OVERRIDE MOZ_OVERRIDE;
|
|
|
|
virtual size_t SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf)
|
|
|
|
const MOZ_MUST_OVERRIDE MOZ_OVERRIDE;
|
2009-12-31 07:56:32 -08:00
|
|
|
|
2012-09-30 09:40:24 -07:00
|
|
|
void CacheStyleAttr(const nsAString& aSerialized, MiscContainer* aValue);
|
|
|
|
void EvictStyleAttr(const nsAString& aSerialized, MiscContainer* aValue);
|
|
|
|
MiscContainer* LookupStyleAttr(const nsAString& aSerialized);
|
|
|
|
|
2009-12-31 07:56:32 -08:00
|
|
|
private:
|
2011-12-16 11:42:07 -08:00
|
|
|
nsHTMLCSSStyleSheet(const nsHTMLCSSStyleSheet& aCopy) MOZ_DELETE;
|
|
|
|
nsHTMLCSSStyleSheet& operator=(const nsHTMLCSSStyleSheet& aCopy) MOZ_DELETE;
|
2009-12-31 07:56:32 -08:00
|
|
|
|
|
|
|
protected:
|
2010-05-17 21:00:39 -07:00
|
|
|
nsCOMPtr<nsIURI> mURL;
|
|
|
|
nsIDocument* mDocument;
|
2012-09-30 09:40:24 -07:00
|
|
|
nsDataHashtable<nsStringHashKey, MiscContainer*> mCachedStyleAttrs;
|
2009-12-31 07:56:32 -08:00
|
|
|
};
|
|
|
|
|
2012-11-14 23:32:39 -08:00
|
|
|
inline nsISupports*
|
|
|
|
ToSupports(nsHTMLCSSStyleSheet* aPointer)
|
|
|
|
{
|
|
|
|
return static_cast<nsIStyleSheet*>(aPointer);
|
|
|
|
}
|
|
|
|
|
2009-12-31 07:56:32 -08:00
|
|
|
#endif /* !defined(nsHTMLCSSStyleSheet_h_) */
|