2017-10-27 17:33:53 +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/. */
|
2009-12-31 15:56:32 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* style sheet and style rule processor representing style attributes
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsHTMLCSSStyleSheet_h_
|
|
|
|
#define nsHTMLCSSStyleSheet_h_
|
|
|
|
|
2011-12-16 19:42:07 +00:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-06-23 12:03:39 +00:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2011-12-16 19:42:07 +00:00
|
|
|
|
2013-03-22 00:05:20 +00:00
|
|
|
#include "nsDataHashtable.h"
|
2009-12-31 15:56:32 +00:00
|
|
|
#include "nsIStyleRuleProcessor.h"
|
|
|
|
|
2014-09-13 13:17:36 +00:00
|
|
|
class nsRuleWalker;
|
2012-09-30 16:40:24 +00:00
|
|
|
struct MiscContainer;
|
|
|
|
|
2014-09-13 13:17:36 +00:00
|
|
|
namespace mozilla {
|
2016-02-17 20:37:00 +00:00
|
|
|
enum class CSSPseudoElementType : uint8_t;
|
2014-09-13 13:17:36 +00:00
|
|
|
namespace dom {
|
|
|
|
class Element;
|
2015-07-13 15:25:42 +00:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2014-09-13 13:17:36 +00:00
|
|
|
|
2015-03-21 16:28:04 +00:00
|
|
|
class nsHTMLCSSStyleSheet final : public nsIStyleRuleProcessor
|
2013-05-05 07:03:20 +00:00
|
|
|
{
|
2009-12-31 15:56:32 +00:00
|
|
|
public:
|
2013-06-14 05:34:37 +00:00
|
|
|
nsHTMLCSSStyleSheet();
|
2009-12-31 15:56:32 +00:00
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
2009-12-31 15:56:33 +00:00
|
|
|
// nsIStyleRuleProcessor
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void RulesMatching(ElementRuleProcessorData* aData) override;
|
|
|
|
virtual void RulesMatching(PseudoElementRuleProcessorData* aData) override;
|
|
|
|
virtual void RulesMatching(AnonBoxRuleProcessorData* aData) override;
|
2009-12-31 15:56:32 +00:00
|
|
|
#ifdef MOZ_XUL
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual void RulesMatching(XULTreeRuleProcessorData* aData) override;
|
2009-12-31 15:56:32 +00:00
|
|
|
#endif
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual nsRestyleHint HasStateDependentStyle(StateRuleProcessorData* aData) override;
|
|
|
|
virtual nsRestyleHint HasStateDependentStyle(PseudoElementStateRuleProcessorData* aData) override;
|
|
|
|
virtual bool HasDocumentStateDependentStyle(StateRuleProcessorData* aData) override;
|
2010-04-01 00:43:32 +00:00
|
|
|
virtual nsRestyleHint
|
2015-08-05 12:42:21 +00:00
|
|
|
HasAttributeDependentStyle(AttributeRuleProcessorData* aData,
|
|
|
|
mozilla::RestyleHintData& aRestyleHintDataResult) override;
|
2015-03-21 16:28:04 +00:00
|
|
|
virtual bool MediumFeaturesChanged(nsPresContext* aPresContext) override;
|
2013-06-23 12:03:39 +00:00
|
|
|
virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
2015-03-21 16:28:04 +00:00
|
|
|
const MOZ_MUST_OVERRIDE override;
|
2013-06-23 12:03:39 +00:00
|
|
|
virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf)
|
2015-03-21 16:28:04 +00:00
|
|
|
const MOZ_MUST_OVERRIDE override;
|
2009-12-31 15:56:32 +00:00
|
|
|
|
2015-02-16 22:15:05 +00:00
|
|
|
// Variants of RulesMatching method above that is specific to this
|
2014-09-13 13:17:36 +00:00
|
|
|
// rule processor.
|
|
|
|
void ElementRulesMatching(nsPresContext* aPresContext,
|
|
|
|
mozilla::dom::Element* aElement,
|
|
|
|
nsRuleWalker* aRuleWalker);
|
2015-02-16 22:15:05 +00:00
|
|
|
// aPseudoElement here is the content node for the pseudo-element, not
|
|
|
|
// its corresponding real element.
|
|
|
|
void PseudoElementRulesMatching(mozilla::dom::Element* aPseudoElement,
|
2016-02-17 20:37:00 +00:00
|
|
|
mozilla::CSSPseudoElementType aPseudoType,
|
2015-02-16 22:15:05 +00:00
|
|
|
nsRuleWalker* aRuleWalker);
|
2014-09-13 13:17:36 +00:00
|
|
|
|
2012-09-30 16:40:24 +00:00
|
|
|
void CacheStyleAttr(const nsAString& aSerialized, MiscContainer* aValue);
|
|
|
|
void EvictStyleAttr(const nsAString& aSerialized, MiscContainer* aValue);
|
|
|
|
MiscContainer* LookupStyleAttr(const nsAString& aSerialized);
|
|
|
|
|
2017-07-06 12:00:35 +00:00
|
|
|
private:
|
2014-06-23 22:40:01 +00:00
|
|
|
~nsHTMLCSSStyleSheet();
|
|
|
|
|
2015-01-06 23:35:02 +00:00
|
|
|
nsHTMLCSSStyleSheet(const nsHTMLCSSStyleSheet& aCopy) = delete;
|
|
|
|
nsHTMLCSSStyleSheet& operator=(const nsHTMLCSSStyleSheet& aCopy) = delete;
|
2009-12-31 15:56:32 +00:00
|
|
|
|
|
|
|
protected:
|
2012-09-30 16:40:24 +00:00
|
|
|
nsDataHashtable<nsStringHashKey, MiscContainer*> mCachedStyleAttrs;
|
2009-12-31 15:56:32 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* !defined(nsHTMLCSSStyleSheet_h_) */
|