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