2004-01-08 01:30:53 +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/. */
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2006-03-25 08:47:31 +03:00
|
|
|
/*
|
|
|
|
* the container for the style sheets that apply to a presentation, and
|
|
|
|
* the internal API that the style system exposes for creating (and
|
|
|
|
* potentially re-creating) style contexts
|
|
|
|
*/
|
|
|
|
|
2004-01-08 01:30:53 +03:00
|
|
|
#ifndef nsStyleSet_h_
|
|
|
|
#define nsStyleSet_h_
|
|
|
|
|
2011-12-16 23:42:07 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2016-09-26 15:03:25 +03:00
|
|
|
#include "mozilla/StyleSheetInlines.h"
|
2015-10-20 02:16:20 +03:00
|
|
|
#include "mozilla/EnumeratedArray.h"
|
2016-03-25 04:40:40 +03:00
|
|
|
#include "mozilla/LinkedList.h"
|
2013-06-23 16:03:39 +04:00
|
|
|
#include "mozilla/MemoryReporting.h"
|
2016-11-02 09:11:24 +03:00
|
|
|
#include "mozilla/ServoTypes.h"
|
2015-10-20 02:16:20 +03:00
|
|
|
#include "mozilla/SheetType.h"
|
2011-12-16 23:42:07 +04:00
|
|
|
|
2004-01-08 01:30:53 +03:00
|
|
|
#include "nsIStyleRuleProcessor.h"
|
2007-02-17 02:02:08 +03:00
|
|
|
#include "nsBindingManager.h"
|
2004-01-08 01:30:53 +03:00
|
|
|
#include "nsRuleNode.h"
|
2007-07-25 21:14:13 +04:00
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsCOMArray.h"
|
2008-12-12 21:59:03 +03:00
|
|
|
#include "nsIStyleRule.h"
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2014-05-09 19:23:14 +04:00
|
|
|
class gfxFontFeatureValueSet;
|
2011-04-12 10:18:43 +04:00
|
|
|
class nsCSSKeyframesRule;
|
2013-05-20 06:59:20 +04:00
|
|
|
class nsCSSFontFeatureValuesRule;
|
2012-09-01 01:21:28 +04:00
|
|
|
class nsCSSPageRule;
|
2014-06-12 05:10:00 +04:00
|
|
|
class nsCSSCounterStyleRule;
|
2015-04-22 09:29:22 +03:00
|
|
|
class nsICSSPseudoComparator;
|
2009-08-01 19:53:40 +04:00
|
|
|
class nsRuleWalker;
|
2012-11-14 23:09:01 +04:00
|
|
|
struct ElementDependentRuleProcessorData;
|
2015-04-22 09:29:22 +03:00
|
|
|
struct nsFontFaceRuleContainer;
|
2011-03-29 21:29:21 +04:00
|
|
|
struct TreeMatchContext;
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2014-04-03 08:18:36 +04:00
|
|
|
namespace mozilla {
|
2015-11-17 09:04:09 +03:00
|
|
|
class CSSStyleSheet;
|
2014-04-03 08:18:36 +04:00
|
|
|
class EventStates;
|
2016-02-17 23:37:00 +03:00
|
|
|
enum class CSSPseudoElementType : uint8_t;
|
2014-04-03 08:18:36 +04:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsEmptyStyleRule final : public nsIStyleRule
|
2008-12-12 21:59:03 +03:00
|
|
|
{
|
2014-06-24 02:40:01 +04:00
|
|
|
private:
|
|
|
|
~nsEmptyStyleRule() {}
|
|
|
|
|
|
|
|
public:
|
2008-12-12 21:59:03 +03:00
|
|
|
NS_DECL_ISUPPORTS
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
|
2015-11-17 07:09:55 +03:00
|
|
|
virtual bool MightMapInheritedStyleData() override;
|
2016-08-17 04:37:48 +03:00
|
|
|
virtual bool GetDiscretelyAnimatedCSSValue(nsCSSPropertyID aProperty,
|
2016-08-16 08:29:21 +03:00
|
|
|
nsCSSValue* aValue) override;
|
2008-12-12 21:59:03 +03:00
|
|
|
#ifdef DEBUG
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
2008-12-12 21:59:03 +03:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsInitialStyleRule final : public nsIStyleRule
|
2011-08-23 03:34:12 +04:00
|
|
|
{
|
2014-06-24 02:40:01 +04:00
|
|
|
private:
|
|
|
|
~nsInitialStyleRule() {}
|
|
|
|
|
|
|
|
public:
|
2011-08-23 03:34:12 +04:00
|
|
|
NS_DECL_ISUPPORTS
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
|
2015-11-17 07:09:55 +03:00
|
|
|
virtual bool MightMapInheritedStyleData() override;
|
2016-08-17 04:37:48 +03:00
|
|
|
virtual bool GetDiscretelyAnimatedCSSValue(nsCSSPropertyID aProperty,
|
2016-08-16 08:29:21 +03:00
|
|
|
nsCSSValue* aValue) override;
|
2011-08-23 03:34:12 +04:00
|
|
|
#ifdef DEBUG
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
2011-08-23 03:34:12 +04:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class nsDisableTextZoomStyleRule final : public nsIStyleRule
|
2013-06-29 07:28:50 +04:00
|
|
|
{
|
2014-06-24 02:40:01 +04:00
|
|
|
private:
|
|
|
|
~nsDisableTextZoomStyleRule() {}
|
|
|
|
|
|
|
|
public:
|
2013-06-29 07:28:50 +04:00
|
|
|
NS_DECL_ISUPPORTS
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
|
2015-11-17 07:09:55 +03:00
|
|
|
virtual bool MightMapInheritedStyleData() override;
|
2016-08-17 04:37:48 +03:00
|
|
|
virtual bool GetDiscretelyAnimatedCSSValue(nsCSSPropertyID aProperty,
|
2016-08-16 08:29:21 +03:00
|
|
|
nsCSSValue* aValue) override;
|
2013-06-29 07:28:50 +04:00
|
|
|
#ifdef DEBUG
|
2015-03-21 19:28:04 +03:00
|
|
|
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
|
2013-06-29 07:28:50 +04:00
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2004-01-08 22:23:12 +03:00
|
|
|
// The style set object is created by the document viewer and ownership is
|
|
|
|
// then handed off to the PresShell. Only the PresShell should delete a
|
|
|
|
// style set.
|
|
|
|
|
2015-06-26 06:49:58 +03:00
|
|
|
class nsStyleSet final
|
2004-01-08 01:30:53 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
nsStyleSet();
|
2015-06-26 06:49:58 +03:00
|
|
|
~nsStyleSet();
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2013-06-23 16:03:39 +04:00
|
|
|
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
|
2011-08-01 22:24:38 +04:00
|
|
|
|
2013-04-01 02:08:29 +04:00
|
|
|
void Init(nsPresContext *aPresContext);
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2009-01-30 07:39:23 +03:00
|
|
|
nsRuleNode* GetRuleTree() { return mRuleTree; }
|
|
|
|
|
2004-01-08 01:30:53 +03:00
|
|
|
// get a style context for a non-pseudo frame.
|
|
|
|
already_AddRefed<nsStyleContext>
|
2010-04-30 17:12:06 +04:00
|
|
|
ResolveStyleFor(mozilla::dom::Element* aElement,
|
|
|
|
nsStyleContext* aParentContext);
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2016-11-02 09:11:24 +03:00
|
|
|
already_AddRefed<nsStyleContext>
|
|
|
|
ResolveStyleFor(mozilla::dom::Element* aElement,
|
|
|
|
nsStyleContext* aParentContext,
|
|
|
|
mozilla::LazyComputeBehavior)
|
|
|
|
{
|
|
|
|
return ResolveStyleFor(aElement, aParentContext);
|
|
|
|
}
|
|
|
|
|
2011-03-29 21:29:21 +04:00
|
|
|
already_AddRefed<nsStyleContext>
|
|
|
|
ResolveStyleFor(mozilla::dom::Element* aElement,
|
|
|
|
nsStyleContext* aParentContext,
|
|
|
|
TreeMatchContext& aTreeMatchContext);
|
|
|
|
|
2016-11-02 09:11:24 +03:00
|
|
|
already_AddRefed<nsStyleContext>
|
|
|
|
ResolveStyleFor(mozilla::dom::Element* aElement,
|
|
|
|
nsStyleContext* aParentContext,
|
|
|
|
mozilla::LazyComputeBehavior aMayCompute,
|
|
|
|
TreeMatchContext& aTreeMatchContext)
|
|
|
|
{
|
|
|
|
return ResolveStyleFor(aElement, aParentContext, aTreeMatchContext);
|
|
|
|
}
|
|
|
|
|
2010-04-03 05:58:25 +04:00
|
|
|
// Get a style context (with the given parent) for the
|
|
|
|
// sequence of style rules in the |aRules| array.
|
2007-07-25 22:21:34 +04:00
|
|
|
already_AddRefed<nsStyleContext>
|
2009-08-11 02:52:29 +04:00
|
|
|
ResolveStyleForRules(nsStyleContext* aParentContext,
|
2012-10-18 01:01:56 +04:00
|
|
|
const nsTArray< nsCOMPtr<nsIStyleRule> > &aRules);
|
2007-07-25 22:21:34 +04:00
|
|
|
|
2010-04-03 05:58:25 +04:00
|
|
|
// Get a style context that represents aBaseContext, but as though
|
|
|
|
// it additionally matched the rules in the aRules array (in that
|
|
|
|
// order, as more specific than any other rules).
|
2014-11-17 22:39:14 +03:00
|
|
|
//
|
|
|
|
// One of the following must hold:
|
|
|
|
// 1. The resulting style context must be used only on a temporary
|
|
|
|
// basis, and it must never be put into the style context tree
|
|
|
|
// (and, in particular, we must never call
|
|
|
|
// ResolveStyleWithReplacement with it as the old context, which
|
|
|
|
// might happen if it is put in the style context tree), or
|
|
|
|
// 2. The additional rules must be appropriate for the transitions
|
|
|
|
// level of the cascade, which is the highest level of the cascade.
|
|
|
|
// (This is the case for one current caller, the cover rule used
|
|
|
|
// for CSS transitions.)
|
2010-04-03 05:58:25 +04:00
|
|
|
already_AddRefed<nsStyleContext>
|
|
|
|
ResolveStyleByAddingRules(nsStyleContext* aBaseContext,
|
|
|
|
const nsCOMArray<nsIStyleRule> &aRules);
|
|
|
|
|
2014-08-03 06:37:44 +04:00
|
|
|
// Resolve style by making replacements in the list of style rules as
|
|
|
|
// described by aReplacements, but otherwise maintaining the status
|
|
|
|
// quo.
|
2015-02-17 01:15:05 +03:00
|
|
|
// aPseudoElement must follow the same rules as for
|
|
|
|
// ResolvePseudoElementStyle, and be null for non-pseudo-element cases
|
2015-02-17 01:15:00 +03:00
|
|
|
enum { // flags for aFlags
|
|
|
|
// Skip starting CSS animations that result from the style.
|
|
|
|
eSkipStartingAnimations = (1<<0),
|
|
|
|
};
|
2014-08-03 06:37:43 +04:00
|
|
|
already_AddRefed<nsStyleContext>
|
|
|
|
ResolveStyleWithReplacement(mozilla::dom::Element* aElement,
|
2015-02-17 01:15:05 +03:00
|
|
|
mozilla::dom::Element* aPseudoElement,
|
2014-08-03 06:37:43 +04:00
|
|
|
nsStyleContext* aNewParentContext,
|
2014-08-03 06:37:44 +04:00
|
|
|
nsStyleContext* aOldStyleContext,
|
2015-02-17 01:15:00 +03:00
|
|
|
nsRestyleHint aReplacements,
|
|
|
|
uint32_t aFlags = 0);
|
2014-08-03 06:37:43 +04:00
|
|
|
|
2015-02-17 01:15:01 +03:00
|
|
|
// Resolve style by returning a style context with the specified
|
|
|
|
// animation data removed. It is allowable to remove all animation
|
2015-02-17 01:15:06 +03:00
|
|
|
// data with eRestyle_AllHintsWithAnimations, or by using any other
|
2015-02-17 01:15:01 +03:00
|
|
|
// hints that are allowed by ResolveStyleWithReplacement.
|
|
|
|
already_AddRefed<nsStyleContext>
|
2017-01-16 10:57:13 +03:00
|
|
|
ResolveStyleByRemovingAnimation(mozilla::dom::Element* aElement,
|
|
|
|
nsStyleContext* aStyleContext,
|
|
|
|
nsRestyleHint aWhichToRemove);
|
|
|
|
|
|
|
|
// Similar to the above, but resolving style without all animation data in
|
|
|
|
// the first place.
|
|
|
|
already_AddRefed<nsStyleContext>
|
|
|
|
ResolveStyleWithoutAnimation(mozilla::dom::Element* aTarget,
|
|
|
|
nsStyleContext* aParentContext);
|
2015-02-17 01:15:01 +03:00
|
|
|
|
2017-01-16 10:57:16 +03:00
|
|
|
// Pseudo-element version of the above, ResolveStyleWithoutAnimation.
|
|
|
|
already_AddRefed<nsStyleContext>
|
|
|
|
ResolvePseudoElementStyleWithoutAnimation(
|
|
|
|
mozilla::dom::Element* aParentElement,
|
|
|
|
mozilla::CSSPseudoElementType aType,
|
|
|
|
nsStyleContext* aParentContext,
|
|
|
|
mozilla::dom::Element* aPseudoElement);
|
|
|
|
|
2016-04-29 07:01:44 +03:00
|
|
|
// Get a style context for a text node (which no rules will match).
|
2005-09-12 03:17:28 +04:00
|
|
|
//
|
2016-04-29 07:01:44 +03:00
|
|
|
// The returned style context will have nsCSSAnonBoxes::mozText as its pseudo.
|
2016-04-22 02:18:41 +03:00
|
|
|
//
|
2016-04-29 07:01:44 +03:00
|
|
|
// (Perhaps mozText should go away and we shouldn't even create style
|
|
|
|
// contexts for such content nodes, when text-combine-upright is not
|
|
|
|
// present. However, not doing any rule matching for them is a first step.)
|
|
|
|
already_AddRefed<nsStyleContext>
|
|
|
|
ResolveStyleForText(nsIContent* aTextNode, nsStyleContext* aParentContext);
|
|
|
|
|
|
|
|
// Get a style context for a non-element (which no rules will match)
|
|
|
|
// other than a text node, such as placeholder frames, and the
|
|
|
|
// nsFirstLetterFrame for everything after the first letter.
|
|
|
|
//
|
|
|
|
// The returned style context will have nsCSSAnonBoxes::mozOtherNonElement as
|
|
|
|
// its pseudo.
|
|
|
|
//
|
|
|
|
// (Perhaps mozOtherNonElement should go away and we shouldn't even
|
2016-04-22 02:18:41 +03:00
|
|
|
// create style contexts for such content nodes. However, not doing
|
2016-04-29 07:01:44 +03:00
|
|
|
// any rule matching for them is a first step.)
|
2004-01-08 01:30:53 +03:00
|
|
|
already_AddRefed<nsStyleContext>
|
2016-04-29 07:01:44 +03:00
|
|
|
ResolveStyleForOtherNonElement(nsStyleContext* aParentContext);
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2010-04-30 17:12:06 +04:00
|
|
|
// Get a style context for a pseudo-element. aParentElement must be
|
2016-02-17 23:37:00 +03:00
|
|
|
// non-null. aPseudoID is the CSSPseudoElementType for the
|
2013-11-28 10:46:38 +04:00
|
|
|
// pseudo-element. aPseudoElement must be non-null if the pseudo-element
|
2015-02-17 01:15:05 +03:00
|
|
|
// type is one that allows user action pseudo-classes after it or allows
|
|
|
|
// style attributes; otherwise, it is ignored.
|
2009-12-11 10:37:40 +03:00
|
|
|
already_AddRefed<nsStyleContext>
|
2010-04-30 17:12:06 +04:00
|
|
|
ResolvePseudoElementStyle(mozilla::dom::Element* aParentElement,
|
2016-02-17 23:37:00 +03:00
|
|
|
mozilla::CSSPseudoElementType aType,
|
2013-07-10 02:25:27 +04:00
|
|
|
nsStyleContext* aParentContext,
|
2013-11-28 10:46:38 +04:00
|
|
|
mozilla::dom::Element* aPseudoElement);
|
2009-12-11 10:37:40 +03:00
|
|
|
|
|
|
|
// This functions just like ResolvePseudoElementStyle except that it will
|
2012-07-30 18:20:58 +04:00
|
|
|
// return nullptr if there are no explicit style rules for that
|
2009-12-11 10:37:40 +03:00
|
|
|
// pseudo element.
|
|
|
|
already_AddRefed<nsStyleContext>
|
2010-04-30 17:12:06 +04:00
|
|
|
ProbePseudoElementStyle(mozilla::dom::Element* aParentElement,
|
2016-02-17 23:37:00 +03:00
|
|
|
mozilla::CSSPseudoElementType aType,
|
2009-12-11 10:37:40 +03:00
|
|
|
nsStyleContext* aParentContext);
|
2011-03-29 21:29:21 +04:00
|
|
|
already_AddRefed<nsStyleContext>
|
|
|
|
ProbePseudoElementStyle(mozilla::dom::Element* aParentElement,
|
2016-02-17 23:37:00 +03:00
|
|
|
mozilla::CSSPseudoElementType aType,
|
2011-03-29 21:29:21 +04:00
|
|
|
nsStyleContext* aParentContext,
|
2013-07-10 02:25:27 +04:00
|
|
|
TreeMatchContext& aTreeMatchContext,
|
|
|
|
mozilla::dom::Element* aPseudoElement = nullptr);
|
2013-05-20 06:59:20 +04:00
|
|
|
|
2015-05-28 01:18:36 +03:00
|
|
|
/**
|
|
|
|
* Bit-flags that can be passed to ResolveAnonymousBoxStyle and GetContext
|
|
|
|
* in their parameter 'aFlags'.
|
|
|
|
*/
|
|
|
|
enum {
|
|
|
|
eNoFlags = 0,
|
|
|
|
eIsLink = 1 << 0,
|
|
|
|
eIsVisitedLink = 1 << 1,
|
|
|
|
eDoAnimation = 1 << 2,
|
|
|
|
|
|
|
|
// Indicates that we should skip the flex/grid item specific chunk of
|
|
|
|
// ApplyStyleFixups(). This is useful if our parent has "display: flex"
|
|
|
|
// or "display: grid" but we can tell we're not going to honor that (e.g. if
|
|
|
|
// it's the outer frame of a button widget, and we're the inline frame for
|
|
|
|
// the button's label).
|
|
|
|
eSkipParentDisplayBasedStyleFixup = 1 << 3
|
|
|
|
};
|
|
|
|
|
2009-12-11 10:37:40 +03:00
|
|
|
// Get a style context for an anonymous box. aPseudoTag is the
|
2015-05-28 01:18:36 +03:00
|
|
|
// pseudo-tag to use and must be non-null. aFlags will be forwarded
|
|
|
|
// to a GetContext call internally.
|
2009-12-11 10:37:40 +03:00
|
|
|
already_AddRefed<nsStyleContext>
|
2015-05-28 01:18:36 +03:00
|
|
|
ResolveAnonymousBoxStyle(nsIAtom* aPseudoTag, nsStyleContext* aParentContext,
|
|
|
|
uint32_t aFlags = eNoFlags);
|
2009-12-11 10:37:40 +03:00
|
|
|
|
|
|
|
#ifdef MOZ_XUL
|
|
|
|
// Get a style context for a XUL tree pseudo. aPseudoTag is the
|
|
|
|
// pseudo-tag to use and must be non-null. aParentContent must be
|
|
|
|
// non-null. aComparator must be non-null.
|
|
|
|
already_AddRefed<nsStyleContext>
|
2010-04-30 17:12:06 +04:00
|
|
|
ResolveXULTreePseudoStyle(mozilla::dom::Element* aParentElement,
|
2009-12-11 10:37:40 +03:00
|
|
|
nsIAtom* aPseudoTag,
|
|
|
|
nsStyleContext* aParentContext,
|
2009-12-11 10:37:40 +03:00
|
|
|
nsICSSPseudoComparator* aComparator);
|
2009-12-11 10:37:40 +03:00
|
|
|
#endif
|
|
|
|
|
2008-11-26 02:22:38 +03:00
|
|
|
// Append all the currently-active font face rules to aArray. Return
|
|
|
|
// true for success and false for failure.
|
2015-04-17 04:09:59 +03:00
|
|
|
bool AppendFontFaceRules(nsTArray<nsFontFaceRuleContainer>& aArray);
|
2008-11-26 02:22:38 +03:00
|
|
|
|
2013-08-15 08:58:37 +04:00
|
|
|
// Return the winning (in the cascade) @keyframes rule for the given name.
|
2015-04-17 04:09:59 +03:00
|
|
|
nsCSSKeyframesRule* KeyframesRuleForName(const nsString& aName);
|
2011-04-12 10:18:43 +04:00
|
|
|
|
2014-06-12 05:10:00 +04:00
|
|
|
// Return the winning (in the cascade) @counter-style rule for the given name.
|
2015-04-17 04:09:59 +03:00
|
|
|
nsCSSCounterStyleRule* CounterStyleRuleForName(const nsAString& aName);
|
2014-06-12 05:10:00 +04:00
|
|
|
|
2013-05-20 06:59:20 +04:00
|
|
|
// Fetch object for looking up font feature values
|
|
|
|
already_AddRefed<gfxFontFeatureValueSet> GetFontFeatureValuesLookup();
|
|
|
|
|
|
|
|
// Append all the currently-active font feature values rules to aArray.
|
|
|
|
// Return true for success and false for failure.
|
2015-04-17 04:09:59 +03:00
|
|
|
bool AppendFontFeatureValuesRules(
|
2013-05-20 06:59:20 +04:00
|
|
|
nsTArray<nsCSSFontFeatureValuesRule*>& aArray);
|
|
|
|
|
2012-09-01 01:21:28 +04:00
|
|
|
// Append all the currently-active page rules to aArray. Return
|
|
|
|
// true for success and false for failure.
|
2015-04-17 04:09:59 +03:00
|
|
|
bool AppendPageRules(nsTArray<nsCSSPageRule*>& aArray);
|
2012-09-01 01:21:28 +04:00
|
|
|
|
2004-01-08 01:30:53 +03:00
|
|
|
// Begin ignoring style context destruction, to avoid lots of unnecessary
|
|
|
|
// work on document teardown.
|
2015-04-17 04:09:59 +03:00
|
|
|
void BeginShutdown();
|
2004-01-08 01:30:53 +03:00
|
|
|
|
|
|
|
// Free all of the data associated with this style set.
|
2015-04-17 04:09:59 +03:00
|
|
|
void Shutdown();
|
2004-01-08 01:30:53 +03:00
|
|
|
|
|
|
|
// Get a new style context that lives in a different parent
|
|
|
|
// The new context will be the same as the old if the new parent is the
|
|
|
|
// same as the old parent.
|
2010-06-23 08:46:27 +04:00
|
|
|
// aElement should be non-null if this is a style context for an
|
|
|
|
// element or pseudo-element; in the latter case it should be the
|
|
|
|
// real element the pseudo-element is for.
|
2004-01-08 01:30:53 +03:00
|
|
|
already_AddRefed<nsStyleContext>
|
2010-04-02 10:07:42 +04:00
|
|
|
ReparentStyleContext(nsStyleContext* aStyleContext,
|
2010-06-23 08:46:27 +04:00
|
|
|
nsStyleContext* aNewParentContext,
|
2015-02-17 01:15:05 +03:00
|
|
|
mozilla::dom::Element* aElement);
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2010-03-17 20:10:57 +03:00
|
|
|
// Test if style is dependent on a document state.
|
2015-04-17 04:09:59 +03:00
|
|
|
bool HasDocumentStateDependentStyle(nsIContent* aContent,
|
2014-04-03 08:18:36 +04:00
|
|
|
mozilla::EventStates aStateMask);
|
2010-03-17 20:10:57 +03:00
|
|
|
|
2004-01-08 01:30:53 +03:00
|
|
|
// Test if style is dependent on content state
|
2015-04-17 04:09:59 +03:00
|
|
|
nsRestyleHint HasStateDependentStyle(mozilla::dom::Element* aElement,
|
2014-04-03 08:18:36 +04:00
|
|
|
mozilla::EventStates aStateMask);
|
2015-04-17 04:09:59 +03:00
|
|
|
nsRestyleHint HasStateDependentStyle(mozilla::dom::Element* aElement,
|
2016-02-17 23:37:00 +03:00
|
|
|
mozilla::CSSPseudoElementType aPseudoType,
|
2013-11-28 10:46:39 +04:00
|
|
|
mozilla::dom::Element* aPseudoElement,
|
2014-04-03 08:18:36 +04:00
|
|
|
mozilla::EventStates aStateMask);
|
2004-01-08 01:30:53 +03:00
|
|
|
|
|
|
|
// Test if style is dependent on the presence of an attribute.
|
2015-04-17 04:09:59 +03:00
|
|
|
nsRestyleHint HasAttributeDependentStyle(mozilla::dom::Element* aElement,
|
2015-12-05 09:09:13 +03:00
|
|
|
int32_t aNameSpaceID,
|
2007-07-13 00:05:45 +04:00
|
|
|
nsIAtom* aAttribute,
|
2012-08-22 19:56:38 +04:00
|
|
|
int32_t aModType,
|
2015-07-22 06:54:07 +03:00
|
|
|
bool aAttrHasChanged,
|
2015-08-05 15:42:21 +03:00
|
|
|
const nsAttrValue* aOtherValue,
|
|
|
|
mozilla::RestyleHintData&
|
|
|
|
aRestyleHintDataResult);
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2008-07-26 20:14:48 +04:00
|
|
|
/*
|
|
|
|
* Do any processing that needs to happen as a result of a change in
|
|
|
|
* the characteristics of the medium, and return whether style rules
|
|
|
|
* may have changed as a result.
|
|
|
|
*/
|
2015-04-17 04:09:59 +03:00
|
|
|
bool MediumFeaturesChanged();
|
2008-07-26 20:14:48 +04:00
|
|
|
|
2004-01-08 01:30:53 +03:00
|
|
|
// APIs for registering objects that can supply additional
|
|
|
|
// rules during processing.
|
2007-02-17 02:02:08 +03:00
|
|
|
void SetBindingManager(nsBindingManager* aBindingManager)
|
2004-01-08 01:30:53 +03:00
|
|
|
{
|
2007-02-17 02:02:08 +03:00
|
|
|
mBindingManager = aBindingManager;
|
2004-01-08 01:30:53 +03:00
|
|
|
}
|
|
|
|
|
2005-08-20 05:24:00 +04:00
|
|
|
// APIs to manipulate the style sheet lists. The sheets in each
|
|
|
|
// list are stored with the most significant sheet last.
|
2015-11-17 09:04:09 +03:00
|
|
|
nsresult AppendStyleSheet(mozilla::SheetType aType,
|
|
|
|
mozilla::CSSStyleSheet* aSheet);
|
|
|
|
nsresult PrependStyleSheet(mozilla::SheetType aType,
|
|
|
|
mozilla::CSSStyleSheet* aSheet);
|
|
|
|
nsresult RemoveStyleSheet(mozilla::SheetType aType,
|
|
|
|
mozilla::CSSStyleSheet* aSheet);
|
2015-10-20 02:16:20 +03:00
|
|
|
nsresult ReplaceSheets(mozilla::SheetType aType,
|
2015-11-17 09:04:09 +03:00
|
|
|
const nsTArray<RefPtr<mozilla::CSSStyleSheet>>& aNewSheets);
|
2015-10-20 02:16:20 +03:00
|
|
|
nsresult InsertStyleSheetBefore(mozilla::SheetType aType,
|
2015-11-17 09:04:09 +03:00
|
|
|
mozilla::CSSStyleSheet* aNewSheet,
|
|
|
|
mozilla::CSSStyleSheet* aReferenceSheet);
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2013-01-09 03:25:47 +04:00
|
|
|
// Enable/Disable entire author style level (Doc, ScopedDoc & PresHint levels)
|
2016-01-21 08:21:23 +03:00
|
|
|
bool GetAuthorStyleDisabled() const;
|
2011-09-29 10:19:26 +04:00
|
|
|
nsresult SetAuthorStyleDisabled(bool aStyleDisabled);
|
2004-08-05 15:38:42 +04:00
|
|
|
|
2015-10-20 02:16:20 +03:00
|
|
|
int32_t SheetCount(mozilla::SheetType aType) const {
|
2015-11-17 09:04:09 +03:00
|
|
|
return mSheets[aType].Length();
|
2004-01-08 01:30:53 +03:00
|
|
|
}
|
|
|
|
|
2015-11-17 09:04:09 +03:00
|
|
|
mozilla::CSSStyleSheet* StyleSheetAt(mozilla::SheetType aType,
|
|
|
|
int32_t aIndex) const {
|
|
|
|
return mSheets[aType][aIndex];
|
2004-01-08 01:30:53 +03:00
|
|
|
}
|
|
|
|
|
2016-02-24 10:01:12 +03:00
|
|
|
void AppendAllXBLStyleSheets(nsTArray<mozilla::CSSStyleSheet*>& aArray) const;
|
2015-08-12 15:43:39 +03:00
|
|
|
|
2015-11-17 09:04:09 +03:00
|
|
|
nsresult RemoveDocStyleSheet(mozilla::CSSStyleSheet* aSheet);
|
|
|
|
nsresult AddDocStyleSheet(mozilla::CSSStyleSheet* aSheet,
|
|
|
|
nsIDocument* aDocument);
|
2004-01-08 01:30:53 +03:00
|
|
|
|
|
|
|
void BeginUpdate();
|
|
|
|
nsresult EndUpdate();
|
|
|
|
|
2007-07-25 21:14:13 +04:00
|
|
|
// Methods for reconstructing the tree; BeginReconstruct basically moves the
|
|
|
|
// old rule tree root and style context roots out of the way,
|
|
|
|
// and EndReconstruct destroys the old rule tree when we're done
|
|
|
|
nsresult BeginReconstruct();
|
|
|
|
// Note: EndReconstruct should not be called if BeginReconstruct fails
|
|
|
|
void EndReconstruct();
|
|
|
|
|
2014-08-04 00:11:55 +04:00
|
|
|
bool IsInRuleTreeReconstruct() const {
|
|
|
|
return mInReconstruct;
|
|
|
|
}
|
|
|
|
|
2016-03-25 04:40:40 +03:00
|
|
|
void RootStyleContextAdded() {
|
|
|
|
++mRootStyleContextCount;
|
|
|
|
}
|
|
|
|
void RootStyleContextRemoved() {
|
|
|
|
MOZ_ASSERT(mRootStyleContextCount > 0);
|
|
|
|
--mRootStyleContextCount;
|
|
|
|
}
|
|
|
|
|
2008-12-29 18:07:36 +03:00
|
|
|
// Return whether the rule tree has cached data such that we need to
|
|
|
|
// do dynamic change handling for changes that change the results of
|
|
|
|
// media queries or require rebuilding all style data.
|
|
|
|
// We don't care whether we have cached rule processors or whether
|
|
|
|
// they have cached rule cascades; getting the rule cascades again in
|
|
|
|
// order to do rule matching will get the correct rule cascade.
|
2011-09-29 10:19:26 +04:00
|
|
|
bool HasCachedStyleData() const {
|
2016-03-25 04:40:40 +03:00
|
|
|
return (mRuleTree && mRuleTree->TreeHasCachedData()) || mRootStyleContextCount > 0;
|
2008-12-29 18:07:36 +03:00
|
|
|
}
|
2009-09-24 21:59:43 +04:00
|
|
|
|
|
|
|
// Notify the style set that a rulenode is no longer in use, or was
|
|
|
|
// just created and is not in use yet.
|
2016-03-25 04:40:40 +03:00
|
|
|
static const uint32_t kGCInterval = 300;
|
|
|
|
void RuleNodeUnused(nsRuleNode* aNode, bool aMayGC) {
|
2009-09-24 21:59:43 +04:00
|
|
|
++mUnusedRuleNodeCount;
|
2016-03-25 04:40:40 +03:00
|
|
|
mUnusedRuleNodeList.insertBack(aNode);
|
|
|
|
if (aMayGC && mUnusedRuleNodeCount >= kGCInterval && !mInGC && !mInReconstruct) {
|
|
|
|
GCRuleTrees();
|
|
|
|
}
|
2009-09-24 21:59:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
// Notify the style set that a rulenode that wasn't in use now is
|
2016-03-25 04:40:40 +03:00
|
|
|
void RuleNodeInUse(nsRuleNode* aNode) {
|
|
|
|
MOZ_ASSERT(mUnusedRuleNodeCount > 0);
|
2009-09-24 21:59:43 +04:00
|
|
|
--mUnusedRuleNodeCount;
|
2016-03-25 04:40:40 +03:00
|
|
|
aNode->removeFrom(mUnusedRuleNodeList);
|
2009-09-24 21:59:43 +04:00
|
|
|
}
|
2009-12-31 18:56:33 +03:00
|
|
|
|
2015-06-26 06:49:58 +03:00
|
|
|
// Returns true if a restyle of the document is needed due to cloning
|
|
|
|
// sheet inners.
|
|
|
|
bool EnsureUniqueInnerOnCSSSheets();
|
|
|
|
|
|
|
|
// Called by CSSStyleSheet::EnsureUniqueInner to let us know it cloned
|
|
|
|
// its inner.
|
|
|
|
void SetNeedsRestyleAfterEnsureUniqueInner() {
|
|
|
|
mNeedsRestyleAfterEnsureUniqueInner = true;
|
|
|
|
}
|
2009-12-31 18:56:33 +03:00
|
|
|
|
2011-08-23 03:34:12 +04:00
|
|
|
nsIStyleRule* InitialStyleRule();
|
|
|
|
|
2015-10-20 02:16:20 +03:00
|
|
|
bool HasRuleProcessorUsedByMultipleStyleSets(mozilla::SheetType aSheetType);
|
2015-07-08 08:57:31 +03:00
|
|
|
|
2015-08-05 15:42:21 +03:00
|
|
|
// Tells the RestyleManager for the document using this style set
|
|
|
|
// to drop any nsCSSSelector pointers it has.
|
|
|
|
void ClearSelectors();
|
|
|
|
|
2016-02-26 04:51:01 +03:00
|
|
|
// Returns whether aSheetType represents a level of the cascade that uses
|
|
|
|
// CSSStyleSheets. See gCSSSheetTypes in nsStyleSet.cpp for the list
|
|
|
|
// of CSS sheet types.
|
|
|
|
static bool IsCSSSheetType(mozilla::SheetType aSheetType);
|
|
|
|
|
2015-11-05 10:24:22 +03:00
|
|
|
private:
|
2015-01-07 02:35:02 +03:00
|
|
|
nsStyleSet(const nsStyleSet& aCopy) = delete;
|
|
|
|
nsStyleSet& operator=(const nsStyleSet& aCopy) = delete;
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2016-03-25 04:40:40 +03:00
|
|
|
// Free all the rules with reference-count zero. This continues iterating
|
|
|
|
// over the free list until it is empty, which allows immediate collection
|
|
|
|
// of nodes whose reference-count drops to zero during the destruction of
|
|
|
|
// a child node. This allows the collection of entire trees at once, since
|
|
|
|
// children hold their parents alive.
|
2009-01-30 07:39:23 +03:00
|
|
|
void GCRuleTrees();
|
|
|
|
|
2015-11-05 10:24:22 +03:00
|
|
|
nsresult DirtyRuleProcessors(mozilla::SheetType aType);
|
|
|
|
|
2004-01-08 01:30:53 +03:00
|
|
|
// Update the rule processor list after a change to the style sheet list.
|
2015-10-20 02:16:20 +03:00
|
|
|
nsresult GatherRuleProcessors(mozilla::SheetType aType);
|
2004-01-08 01:30:53 +03:00
|
|
|
|
|
|
|
void AddImportantRules(nsRuleNode* aCurrLevelNode,
|
2009-10-03 01:06:42 +04:00
|
|
|
nsRuleNode* aLastPrevLevelNode,
|
|
|
|
nsRuleWalker* aRuleWalker);
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2009-10-03 01:06:42 +04:00
|
|
|
// Move aRuleWalker forward by the appropriate rule if we need to add
|
2008-12-12 21:59:03 +03:00
|
|
|
// a rule due to property restrictions on pseudo-elements.
|
2016-02-17 23:37:00 +03:00
|
|
|
void WalkRestrictionRule(mozilla::CSSPseudoElementType aPseudoType,
|
2009-10-03 01:06:42 +04:00
|
|
|
nsRuleWalker* aRuleWalker);
|
2008-12-12 21:59:03 +03:00
|
|
|
|
2013-06-29 07:28:50 +04:00
|
|
|
void WalkDisableTextZoomRule(mozilla::dom::Element* aElement,
|
|
|
|
nsRuleWalker* aRuleWalker);
|
|
|
|
|
2004-07-16 00:30:30 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
// Just like AddImportantRules except it doesn't actually add anything; it
|
|
|
|
// just asserts that there are no important rules between aCurrLevelNode and
|
|
|
|
// aLastPrevLevelNode.
|
|
|
|
void AssertNoImportantRules(nsRuleNode* aCurrLevelNode,
|
|
|
|
nsRuleNode* aLastPrevLevelNode);
|
2016-06-29 14:27:42 +03:00
|
|
|
|
2004-07-16 00:30:30 +04:00
|
|
|
// Just like AddImportantRules except it doesn't actually add anything; it
|
|
|
|
// just asserts that there are no CSS rules between aCurrLevelNode and
|
2011-01-15 05:14:41 +03:00
|
|
|
// aLastPrevLevelNode. Mostly useful for the preshint level.
|
2004-07-16 00:30:30 +04:00
|
|
|
void AssertNoCSSRules(nsRuleNode* aCurrLevelNode,
|
|
|
|
nsRuleNode* aLastPrevLevelNode);
|
|
|
|
#endif
|
2016-06-29 14:27:42 +03:00
|
|
|
|
2004-01-08 01:30:53 +03:00
|
|
|
// Enumerate the rules in a way that cares about the order of the
|
|
|
|
// rules.
|
2013-01-09 03:25:47 +04:00
|
|
|
// aElement is the element the rules are for. It might be null. aData
|
2009-12-11 10:37:40 +03:00
|
|
|
// is the closure to pass to aCollectorFunc. If aContent is not null,
|
|
|
|
// aData must be a RuleProcessorData*
|
2004-01-08 01:30:53 +03:00
|
|
|
void FileRules(nsIStyleRuleProcessor::EnumFunc aCollectorFunc,
|
2013-01-09 03:25:47 +04:00
|
|
|
RuleProcessorData* aData, mozilla::dom::Element* aElement,
|
2012-11-14 23:09:01 +04:00
|
|
|
nsRuleWalker* aRuleWalker);
|
2004-01-08 01:30:53 +03:00
|
|
|
|
|
|
|
// Enumerate all the rules in a way that doesn't care about the order
|
|
|
|
// of the rules and break out if the enumeration is halted.
|
|
|
|
void WalkRuleProcessors(nsIStyleRuleProcessor::EnumFunc aFunc,
|
2012-11-14 23:09:01 +04:00
|
|
|
ElementDependentRuleProcessorData* aData,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aWalkAllXBLStylesheets);
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2014-08-03 06:37:44 +04:00
|
|
|
// Helper for ResolveStyleWithReplacement
|
2015-02-17 01:15:05 +03:00
|
|
|
// aPseudoElement must follow the same rules as for
|
|
|
|
// ResolvePseudoElementStyle, and be null for non-pseudo-element cases
|
2014-08-03 06:37:44 +04:00
|
|
|
nsRuleNode* RuleNodeWithReplacement(mozilla::dom::Element* aElement,
|
2015-02-17 01:15:05 +03:00
|
|
|
mozilla::dom::Element* aPseudoElement,
|
2014-08-03 06:37:44 +04:00
|
|
|
nsRuleNode* aOldRuleNode,
|
2016-02-17 23:37:00 +03:00
|
|
|
mozilla::CSSPseudoElementType aPseudoType,
|
2014-08-03 06:37:44 +04:00
|
|
|
nsRestyleHint aReplacements);
|
|
|
|
|
2010-04-02 10:07:42 +04:00
|
|
|
already_AddRefed<nsStyleContext>
|
|
|
|
GetContext(nsStyleContext* aParentContext,
|
|
|
|
nsRuleNode* aRuleNode,
|
2010-04-03 05:58:27 +04:00
|
|
|
nsRuleNode* aVisitedRuleNode,
|
2010-04-02 10:07:42 +04:00
|
|
|
nsIAtom* aPseudoTag,
|
2016-02-17 23:37:00 +03:00
|
|
|
mozilla::CSSPseudoElementType aPseudoType,
|
2013-02-01 20:02:29 +04:00
|
|
|
mozilla::dom::Element* aElementForAnimation,
|
|
|
|
uint32_t aFlags);
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2017-01-16 10:57:13 +03:00
|
|
|
enum AnimationFlag {
|
|
|
|
eWithAnimation,
|
|
|
|
eWithoutAnimation,
|
|
|
|
};
|
|
|
|
already_AddRefed<nsStyleContext>
|
|
|
|
ResolveStyleForInternal(mozilla::dom::Element* aElement,
|
|
|
|
nsStyleContext* aParentContext,
|
|
|
|
TreeMatchContext& aTreeMatchContext,
|
|
|
|
AnimationFlag aAnimationFlag);
|
|
|
|
|
2017-01-16 10:57:16 +03:00
|
|
|
already_AddRefed<nsStyleContext>
|
|
|
|
ResolvePseudoElementStyleInternal(mozilla::dom::Element* aParentElement,
|
|
|
|
mozilla::CSSPseudoElementType aType,
|
|
|
|
nsStyleContext* aParentContext,
|
|
|
|
mozilla::dom::Element* aPseudoElement,
|
|
|
|
AnimationFlag aAnimationFlag);
|
|
|
|
|
2013-02-17 01:04:54 +04:00
|
|
|
nsPresContext* PresContext() { return mRuleTree->PresContext(); }
|
2004-01-28 03:18:22 +03:00
|
|
|
|
2006-06-08 18:32:20 +04:00
|
|
|
// The sheets in each array in mSheets are stored with the most significant
|
|
|
|
// sheet last.
|
2013-06-14 09:34:37 +04:00
|
|
|
// The arrays for ePresHintSheet, eStyleAttrSheet, eTransitionSheet,
|
2015-06-26 06:49:58 +03:00
|
|
|
// eAnimationSheet and eSVGAttrAnimationSheet are always empty.
|
|
|
|
// (FIXME: We should reduce the storage needed for them.)
|
2015-10-20 02:16:20 +03:00
|
|
|
mozilla::EnumeratedArray<mozilla::SheetType, mozilla::SheetType::Count,
|
2015-11-17 09:04:09 +03:00
|
|
|
nsTArray<RefPtr<mozilla::CSSStyleSheet>>> mSheets;
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2013-01-09 03:25:47 +04:00
|
|
|
// mRuleProcessors[eScopedDocSheet] is always null; rule processors
|
|
|
|
// for scoped style sheets are stored in mScopedDocSheetRuleProcessors.
|
2015-10-20 02:16:20 +03:00
|
|
|
mozilla::EnumeratedArray<mozilla::SheetType, mozilla::SheetType::Count,
|
|
|
|
nsCOMPtr<nsIStyleRuleProcessor>> mRuleProcessors;
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2013-01-09 03:25:47 +04:00
|
|
|
// Rule processors for HTML5 scoped style sheets, one per scope.
|
|
|
|
nsTArray<nsCOMPtr<nsIStyleRuleProcessor> > mScopedDocSheetRuleProcessors;
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsBindingManager> mBindingManager;
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2016-03-25 04:40:40 +03:00
|
|
|
RefPtr<nsRuleNode> mRuleTree; // This is the root of our rule tree. It is a
|
|
|
|
// lexicographic tree of matched rules that style
|
|
|
|
// contexts use to look up properties.
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
uint16_t mBatching;
|
2012-04-17 23:22:49 +04:00
|
|
|
|
|
|
|
unsigned mInShutdown : 1;
|
2016-03-25 04:40:40 +03:00
|
|
|
unsigned mInGC : 1;
|
2012-04-17 23:22:49 +04:00
|
|
|
unsigned mAuthorStyleDisabled: 1;
|
|
|
|
unsigned mInReconstruct : 1;
|
2013-05-20 06:59:20 +04:00
|
|
|
unsigned mInitFontFeatureValuesLookup : 1;
|
2015-06-26 06:49:58 +03:00
|
|
|
unsigned mNeedsRestyleAfterEnsureUniqueInner : 1;
|
2015-10-20 02:16:20 +03:00
|
|
|
unsigned mDirty : int(mozilla::SheetType::Count); // one bit per sheet type
|
2012-04-17 23:22:49 +04:00
|
|
|
|
2016-03-25 04:40:40 +03:00
|
|
|
uint32_t mRootStyleContextCount;
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
// In debug builds, we stash a weak pointer here to the old root during
|
|
|
|
// reconstruction. During GC, we check for this pointer, and null it out
|
|
|
|
// when we encounter it. This allows us to assert that the old root (and
|
|
|
|
// thus all of its subtree) was GCed after reconstruction, which implies
|
|
|
|
// that there are no style contexts holding on to old rule nodes.
|
|
|
|
nsRuleNode* mOldRootNode;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// Track our rule nodes with zero refcount. When this hits a threshold, we
|
|
|
|
// sweep and free. Keeping unused rule nodes around for a bit allows us to
|
|
|
|
// reuse them in many cases.
|
|
|
|
mozilla::LinkedList<nsRuleNode> mUnusedRuleNodeList;
|
|
|
|
uint32_t mUnusedRuleNodeCount;
|
2004-01-08 01:30:53 +03:00
|
|
|
|
2008-12-12 21:59:03 +03:00
|
|
|
// Empty style rules to force things that restrict which properties
|
|
|
|
// apply into different branches of the rule tree.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsEmptyStyleRule> mFirstLineRule, mFirstLetterRule, mPlaceholderRule;
|
2008-12-12 21:59:03 +03:00
|
|
|
|
2011-08-23 03:34:12 +04:00
|
|
|
// Style rule which sets all properties to their initial values for
|
|
|
|
// determining when context-sensitive values are in use.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsInitialStyleRule> mInitialStyleRule;
|
2011-08-23 03:34:12 +04:00
|
|
|
|
2013-06-29 07:28:50 +04:00
|
|
|
// Style rule that sets the internal -x-text-zoom property on
|
|
|
|
// <svg:text> elements to disable the effect of text zooming.
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<nsDisableTextZoomStyleRule> mDisableTextZoomStyleRule;
|
2013-06-29 07:28:50 +04:00
|
|
|
|
2013-05-20 06:59:20 +04:00
|
|
|
// whether font feature values lookup object needs initialization
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<gfxFontFeatureValueSet> mFontFeatureValuesLookup;
|
2004-01-08 01:30:53 +03:00
|
|
|
};
|
|
|
|
|
2013-03-16 08:31:38 +04:00
|
|
|
#ifdef MOZILLA_INTERNAL_API
|
2009-09-24 21:59:43 +04:00
|
|
|
inline
|
2010-04-07 01:52:17 +04:00
|
|
|
void nsRuleNode::AddRef()
|
2009-09-24 21:59:43 +04:00
|
|
|
{
|
2016-03-25 04:40:40 +03:00
|
|
|
if (mRefCnt++ == 0) {
|
2016-02-24 10:01:11 +03:00
|
|
|
MOZ_ASSERT(mPresContext->StyleSet()->IsGecko(),
|
|
|
|
"ServoStyleSets should not have rule nodes");
|
2016-03-25 04:40:40 +03:00
|
|
|
mPresContext->StyleSet()->AsGecko()->RuleNodeInUse(this);
|
2009-09-24 21:59:43 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
inline
|
2010-04-07 01:52:17 +04:00
|
|
|
void nsRuleNode::Release()
|
2009-09-24 21:59:43 +04:00
|
|
|
{
|
2016-03-25 04:40:40 +03:00
|
|
|
if (--mRefCnt == 0) {
|
2016-02-24 10:01:11 +03:00
|
|
|
MOZ_ASSERT(mPresContext->StyleSet()->IsGecko(),
|
|
|
|
"ServoStyleSets should not have rule nodes");
|
2016-03-25 04:40:40 +03:00
|
|
|
mPresContext->StyleSet()->AsGecko()->RuleNodeUnused(this, /* aMayGC = */ true);
|
2009-09-24 21:59:43 +04:00
|
|
|
}
|
|
|
|
}
|
2004-01-08 01:30:53 +03:00
|
|
|
#endif
|
2010-04-19 19:41:39 +04:00
|
|
|
|
|
|
|
#endif
|