Bug 1364412: Convert pseudo-elements to an enum. r?hiro,xidorn
This allows us to access metadata using `match` instead of comparison with
atoms, which makes it doable to get the pseudo-element flags in the future.
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
MozReview-Commit-ID: KgGjFePmhyS
Signed-off-by: Emilio Cobos Álvarez <emilio@crisal.io>
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -1011,53 +1011,49 @@ EffectCompositor::PreTraverseInSubtree(E
// about to restyle it.
iter.Remove();
}
}
return foundElementsNeedingRestyle;
}
bool
-EffectCompositor::PreTraverse(dom::Element* aElement, nsIAtom* aPseudoTagOrNull)
+EffectCompositor::PreTraverse(dom::Element* aElement,
+ CSSPseudoElementType aPseudoType)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mPresContext->RestyleManager()->IsServo());
bool found = false;
- if (aPseudoTagOrNull &&
- aPseudoTagOrNull != nsCSSPseudoElements::before &&
- aPseudoTagOrNull != nsCSSPseudoElements::after) {
+ if (aPseudoType != CSSPseudoElementType::NotPseudo &&
+ aPseudoType != CSSPseudoElementType::before &&
+ aPseudoType != CSSPseudoElementType::after) {
return found;
}
- CSSPseudoElementType pseudoType =
- nsCSSPseudoElements::GetPseudoType(aPseudoTagOrNull,
- CSSEnabledState::eForAllContent);
-
- PseudoElementHashEntry::KeyType key = { aElement, pseudoType };
-
+ PseudoElementHashEntry::KeyType key = { aElement, aPseudoType };
for (size_t i = 0; i < kCascadeLevelCount; ++i) {
CascadeLevel cascadeLevel = CascadeLevel(i);
auto& elementSet = mElementsToRestyle[cascadeLevel];
if (!elementSet.Get(key)) {
// Ignore throttled restyle and no restyle request.
continue;
}
mPresContext->RestyleManager()->AsServo()->
PostRestyleEventForAnimations(aElement,
cascadeLevel == CascadeLevel::Transitions
? eRestyle_CSSTransitions
: eRestyle_CSSAnimations);
- EffectSet* effects = EffectSet::GetEffectSet(aElement, pseudoType);
+ EffectSet* effects = EffectSet::GetEffectSet(aElement, aPseudoType);
if (effects) {
- MaybeUpdateCascadeResults(aElement, pseudoType);
+ MaybeUpdateCascadeResults(aElement, aPseudoType);
for (KeyframeEffectReadOnly* effect : *effects) {
effect->GetAnimation()->WillComposeStyle();
}
}
elementSet.Remove(key);
found = true;
--- a/dom/animation/EffectCompositor.h
+++ b/dom/animation/EffectCompositor.h
@@ -242,17 +242,17 @@ public:
// Do a bunch of stuff that we should avoid doing during the parallel
// traversal (e.g. changing member variables) for all elements that we expect
// to restyle on the next traversal.
// Returns true if there are elements needing a restyle for animation.
bool PreTraverse();
// Similar to the above but only for the (pseudo-)element.
- bool PreTraverse(dom::Element* aElement, nsIAtom* aPseudoTagOrNull);
+ bool PreTraverse(dom::Element* aElement, CSSPseudoElementType aPseudoType);
// Similar to the above but for all elements in the subtree rooted
// at aElement.
bool PreTraverseInSubtree(dom::Element* aElement);
private:
~EffectCompositor() = default;
--- a/dom/animation/KeyframeEffectReadOnly.cpp
+++ b/dom/animation/KeyframeEffectReadOnly.cpp
@@ -522,31 +522,28 @@ KeyframeEffectReadOnly::EnsureBaseStyles
nsPresContext* presContext =
nsContentUtils::GetContextForContent(mTarget->mElement);
MOZ_ASSERT(presContext,
"nsPresContext should not be nullptr since this EnsureBaseStyles "
"supposed to be called right after getting computed values with "
"a valid nsPresContext");
RefPtr<ServoComputedValues> baseComputedValues;
- nsIAtom* pseudoAtom = mTarget->mPseudoType < CSSPseudoElementType::Count
- ? nsCSSPseudoElements::GetPseudoAtom(mTarget->mPseudoType)
- : nullptr;
for (const AnimationProperty& property : aProperties) {
EnsureBaseStyle(property,
- pseudoAtom,
+ mTarget->mPseudoType,
presContext,
baseComputedValues);
}
}
void
KeyframeEffectReadOnly::EnsureBaseStyle(
const AnimationProperty& aProperty,
- nsIAtom* aPseudoAtom,
+ CSSPseudoElementType aPseudoType,
nsPresContext* aPresContext,
RefPtr<ServoComputedValues>& aBaseComputedValues)
{
bool hasAdditiveValues = false;
for (const AnimationPropertySegment& segment : aProperty.mSegments) {
if (!segment.HasReplaceableValues()) {
hasAdditiveValues = true;
@@ -556,17 +553,17 @@ KeyframeEffectReadOnly::EnsureBaseStyle(
if (!hasAdditiveValues) {
return;
}
if (!aBaseComputedValues) {
aBaseComputedValues =
aPresContext->StyleSet()->AsServo()->
- GetBaseComputedValuesForElement(mTarget->mElement, aPseudoAtom);
+ GetBaseComputedValuesForElement(mTarget->mElement, aPseudoType);
}
RefPtr<RawServoAnimationValue> baseValue =
Servo_ComputedValues_ExtractAnimationValue(aBaseComputedValues,
aProperty.mProperty).Consume();
mBaseStyleValuesForServo.Put(aProperty.mProperty, baseValue);
}
void
--- a/dom/animation/KeyframeEffectReadOnly.h
+++ b/dom/animation/KeyframeEffectReadOnly.h
@@ -375,17 +375,17 @@ protected:
// base style context will be resolved and stored in
// |aCachedBaseStyleContext|.
void EnsureBaseStyle(nsCSSPropertyID aProperty,
nsStyleContext* aStyleContext,
RefPtr<nsStyleContext>& aCachedBaseStyleContext);
// Stylo version of the above function that also first checks for an additive
// value in |aProperty|'s list of segments.
void EnsureBaseStyle(const AnimationProperty& aProperty,
- nsIAtom* aPseudoAtom,
+ CSSPseudoElementType aPseudoType,
nsPresContext* aPresContext,
RefPtr<ServoComputedValues>& aBaseComputedValues);
Maybe<OwningAnimationTarget> mTarget;
KeyframeEffectParams mEffectOptions;
// The specified keyframes.
--- a/dom/canvas/CanvasRenderingContext2D.cpp
+++ b/dom/canvas/CanvasRenderingContext2D.cpp
@@ -2869,17 +2869,19 @@ GetFontStyleForServo(Element* aElement,
// have to get a parent style context for inherit-like relative
// values (2em, bolder, etc.)
if (aElement && aElement->IsInUncomposedDoc()) {
// Inherit from the canvas element.
aPresShell->FlushPendingNotifications(FlushType::Style);
// We need to use ResolveTransientServoStyle, which involves traversal,
// instead of ResolveServoStyle() because we need up-to-date style even if
// the canvas element is display:none.
- parentStyle = styleSet->ResolveTransientServoStyle(aElement, nullptr);
+ parentStyle =
+ styleSet->ResolveTransientServoStyle(aElement,
+ CSSPseudoElementType::NotPseudo);
} else {
RefPtr<RawServoDeclarationBlock> declarations =
CreateFontDeclarationForServo(NS_LITERAL_STRING("10px sans-serif"),
aPresShell->GetDocument());
MOZ_ASSERT(declarations);
parentStyle = aPresShell->StyleSet()->AsServo()->
ResolveForDeclarations(nullptr, declarations);
--- a/layout/style/ServoBindingList.h
+++ b/layout/style/ServoBindingList.h
@@ -350,17 +350,17 @@ SERVO_BINDING_FUNC(Servo_CSSSupports2, b
const nsACString* name, const nsACString* value)
SERVO_BINDING_FUNC(Servo_CSSSupports, bool,
const nsACString* cond)
// Computed style data
SERVO_BINDING_FUNC(Servo_ComputedValues_GetForAnonymousBox,
ServoComputedValuesStrong,
ServoComputedValuesBorrowedOrNull parent_style_or_null,
- nsIAtom* pseudoTag, bool skip_display_fixup,
+ nsIAtom* pseudo_tag, bool skip_display_fixup,
RawServoStyleSetBorrowed set)
SERVO_BINDING_FUNC(Servo_ComputedValues_Inherit, ServoComputedValuesStrong,
RawServoStyleSetBorrowed set,
ServoComputedValuesBorrowedOrNull parent_style,
mozilla::InheritTarget target)
// Initialize Servo components. Should be called exactly once at startup.
SERVO_BINDING_FUNC(Servo_Initialize, void,
@@ -378,34 +378,35 @@ SERVO_BINDING_FUNC(Servo_Element_GetStyl
SERVO_BINDING_FUNC(Servo_NoteExplicitHints, void, RawGeckoElementBorrowed element,
nsRestyleHint restyle_hint, nsChangeHint change_hint)
SERVO_BINDING_FUNC(Servo_TakeChangeHint, nsChangeHint, RawGeckoElementBorrowed element)
SERVO_BINDING_FUNC(Servo_ResolveStyle, ServoComputedValuesStrong,
RawGeckoElementBorrowed element,
RawServoStyleSetBorrowed set,
bool allow_stale)
SERVO_BINDING_FUNC(Servo_ResolvePseudoStyle, ServoComputedValuesStrong,
- RawGeckoElementBorrowed element, nsIAtom* pseudo_tag,
+ RawGeckoElementBorrowed element,
+ mozilla::CSSPseudoElementType pseudo_type,
bool is_probe, RawServoStyleSetBorrowed set)
SERVO_BINDING_FUNC(Servo_HasAuthorSpecifiedRules, bool,
RawGeckoElementBorrowed element,
uint32_t rule_type_mask,
bool author_colors_allowed)
// Resolves style for an element or pseudo-element without processing pending
// restyles first. The Element and its ancestors may be unstyled, have pending
// restyles, or be in a display:none subtree. Styles are cached when possible,
// though caching is not possible within display:none subtrees, and the styles
// may be invalidated by already-scheduled restyles.
//
// The tree must be in a consistent state such that a normal traversal could be
// performed, and this function maintains that invariant.
SERVO_BINDING_FUNC(Servo_ResolveStyleLazily, ServoComputedValuesStrong,
RawGeckoElementBorrowed element,
- nsIAtom* pseudo_tag,
+ mozilla::CSSPseudoElementType pseudo_type,
const mozilla::ServoElementSnapshotTable* snapshots,
RawServoStyleSetBorrowed set)
// Use ServoStyleSet::PrepareAndTraverseSubtree instead of calling this
// directly
SERVO_BINDING_FUNC(Servo_TraverseSubtree,
bool,
RawGeckoElementBorrowed root,
@@ -418,17 +419,17 @@ SERVO_BINDING_FUNC(Servo_TraverseSubtree
SERVO_BINDING_FUNC(Servo_AssertTreeIsClean, void, RawGeckoElementBorrowed root)
// Returns computed values for the given element without any animations rules.
SERVO_BINDING_FUNC(Servo_StyleSet_GetBaseComputedValuesForElement,
ServoComputedValuesStrong,
RawServoStyleSetBorrowed set,
RawGeckoElementBorrowed element,
const mozilla::ServoElementSnapshotTable* snapshots,
- nsIAtom* pseudo_tag)
+ mozilla::CSSPseudoElementType pseudo_type)
// Style-struct management.
#define STYLE_STRUCT(name, checkdata_cb) \
struct nsStyle##name; \
SERVO_BINDING_FUNC(Servo_GetStyle##name, const nsStyle##name*, \
ServoComputedValuesBorrowedOrNull computed_values)
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -309,23 +309,20 @@ Gecko_GetStyleContext(RawGeckoElementBor
nsCSSFrameConstructor* fc =
aElement->OwnerDoc()->GetShell()->GetPresContext()->FrameConstructor();
// NB: This is only called for CalcStyleDifference, and we handle correctly
// the display: none case since Servo still has the older style.
return fc->GetDisplayContentsStyleFor(aElement);
}
-nsIAtom*
+CSSPseudoElementType
Gecko_GetImplementedPseudo(RawGeckoElementBorrowed aElement)
{
- CSSPseudoElementType pseudo = aElement->GetPseudoElementType();
- if (pseudo == CSSPseudoElementType::NotPseudo)
- return nullptr;
- return nsCSSPseudoElements::GetPseudoAtom(pseudo);
+ return aElement->GetPseudoElementType();
}
nsChangeHint
Gecko_CalcStyleDifference(nsStyleContext* aOldStyleContext,
ServoComputedValuesBorrowed aComputedValues)
{
MOZ_ASSERT(aOldStyleContext);
MOZ_ASSERT(aComputedValues);
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -30,16 +30,17 @@
class nsIAtom;
class nsIPrincipal;
class nsIURI;
struct nsFont;
namespace mozilla {
class FontFamilyList;
enum FontFamilyType : uint32_t;
+ enum class CSSPseudoElementType : uint8_t;
struct Keyframe;
enum Side;
struct StyleTransition;
namespace css {
struct URLValue;
struct ImageValue;
};
enum class UpdateAnimationsTasks : uint8_t;
@@ -324,17 +325,17 @@ void Gecko_SetNodeFlags(RawGeckoNodeBorr
void Gecko_UnsetNodeFlags(RawGeckoNodeBorrowed node, uint32_t flags);
void Gecko_SetOwnerDocumentNeedsStyleFlush(RawGeckoElementBorrowed element);
// Incremental restyle.
// Also, we might want a ComputedValues to ComputedValues API for animations?
// Not if we do them in Gecko...
nsStyleContext* Gecko_GetStyleContext(RawGeckoElementBorrowed element,
nsIAtom* aPseudoTagOrNull);
-nsIAtom* Gecko_GetImplementedPseudo(RawGeckoElementBorrowed element);
+mozilla::CSSPseudoElementType Gecko_GetImplementedPseudo(RawGeckoElementBorrowed element);
nsChangeHint Gecko_CalcStyleDifference(nsStyleContext* oldstyle,
ServoComputedValuesBorrowed newstyle);
nsChangeHint Gecko_HintsHandledForDescendants(nsChangeHint aHint);
// Get an element snapshot for a given element from the table.
const ServoElementSnapshot*
Gecko_GetElementSnapshot(const mozilla::ServoElementSnapshotTable* table,
RawGeckoElementBorrowed element);
--- a/layout/style/ServoStyleSet.cpp
+++ b/layout/style/ServoStyleSet.cpp
@@ -194,17 +194,18 @@ ServoStyleSet::GetContext(nsIContent* aC
LazyComputeBehavior aMayCompute)
{
MOZ_ASSERT(aContent->IsElement());
Element* element = aContent->AsElement();
RefPtr<ServoComputedValues> computedValues;
if (aMayCompute == LazyComputeBehavior::Allow) {
PreTraverseSync();
- computedValues = ResolveStyleLazily(element, nullptr);
+ computedValues =
+ ResolveStyleLazily(element, CSSPseudoElementType::NotPseudo);
} else {
computedValues = ResolveServoStyle(element);
}
MOZ_ASSERT(computedValues);
return GetContext(computedValues.forget(), aParentContext, aPseudoTag, aPseudoType,
element);
}
@@ -437,59 +438,60 @@ ServoStyleSet::ResolvePseudoElementStyle
Element* aPseudoElement)
{
MaybeRebuildStylist();
// NB: We ignore aParentContext, on the assumption that pseudo element styles
// should just inherit from aOriginatingElement's primary style, which Servo
// already knows.
MOZ_ASSERT(aType < CSSPseudoElementType::Count);
- nsIAtom* pseudoTag = nsCSSPseudoElements::GetPseudoAtom(aType);
RefPtr<ServoComputedValues> computedValues;
if (aPseudoElement) {
MOZ_ASSERT(aType == aPseudoElement->GetPseudoElementType());
computedValues = Servo_ResolveStyle(aPseudoElement, mRawSet.get(),
mAllowResolveStaleStyles).Consume();
} else {
computedValues =
Servo_ResolvePseudoStyle(aOriginatingElement,
- pseudoTag,
+ aType,
/* is_probe = */ false,
mRawSet.get()).Consume();
}
MOZ_ASSERT(computedValues);
bool isBeforeOrAfter = aType == CSSPseudoElementType::before ||
aType == CSSPseudoElementType::after;
+
+ nsIAtom* pseudoTag = nsCSSPseudoElements::GetPseudoAtom(aType);
return GetContext(computedValues.forget(), aParentContext, pseudoTag, aType,
isBeforeOrAfter ? aOriginatingElement : nullptr);
}
already_AddRefed<nsStyleContext>
ServoStyleSet::ResolveTransientStyle(Element* aElement,
nsIAtom* aPseudoTag,
CSSPseudoElementType aPseudoType)
{
RefPtr<ServoComputedValues> computedValues =
- ResolveTransientServoStyle(aElement, aPseudoTag);
+ ResolveTransientServoStyle(aElement, aPseudoType);
return GetContext(computedValues.forget(),
nullptr,
aPseudoTag,
aPseudoType, nullptr);
}
already_AddRefed<ServoComputedValues>
ServoStyleSet::ResolveTransientServoStyle(Element* aElement,
- nsIAtom* aPseudoTag)
+ CSSPseudoElementType aPseudoType)
{
PreTraverseSync();
- return ResolveStyleLazily(aElement, aPseudoTag);
+ return ResolveStyleLazily(aElement, aPseudoType);
}
already_AddRefed<nsStyleContext>
ServoStyleSet::ResolveInheritingAnonymousBoxStyle(nsIAtom* aPseudoTag,
nsStyleContext* aParentContext)
{
MOZ_ASSERT(nsCSSAnonBoxes::IsAnonBox(aPseudoTag) &&
!nsCSSAnonBoxes::IsNonInheritingAnonBox(aPseudoTag));
@@ -766,40 +768,40 @@ ServoStyleSet::ProbePseudoElementStyle(E
nsStyleContext* aParentContext)
{
MaybeRebuildStylist();
// NB: We ignore aParentContext, on the assumption that pseudo element styles
// should just inherit from aOriginatingElement's primary style, which Servo
// already knows.
MOZ_ASSERT(aType < CSSPseudoElementType::Count);
- nsIAtom* pseudoTag = nsCSSPseudoElements::GetPseudoAtom(aType);
RefPtr<ServoComputedValues> computedValues =
- Servo_ResolvePseudoStyle(aOriginatingElement, pseudoTag,
+ Servo_ResolvePseudoStyle(aOriginatingElement, aType,
/* is_probe = */ true, mRawSet.get()).Consume();
if (!computedValues) {
return nullptr;
}
// For :before and :after pseudo-elements, having display: none or no
// 'content' property is equivalent to not having the pseudo-element
// at all.
- bool isBeforeOrAfter = pseudoTag == nsCSSPseudoElements::before ||
- pseudoTag == nsCSSPseudoElements::after;
+ bool isBeforeOrAfter = aType == CSSPseudoElementType::before ||
+ aType == CSSPseudoElementType::after;
if (isBeforeOrAfter) {
- const nsStyleDisplay *display = Servo_GetStyleDisplay(computedValues);
- const nsStyleContent *content = Servo_GetStyleContent(computedValues);
+ const nsStyleDisplay* display = Servo_GetStyleDisplay(computedValues);
+ const nsStyleContent* content = Servo_GetStyleContent(computedValues);
// XXXldb What is contentCount for |content: ""|?
if (display->mDisplay == StyleDisplay::None ||
content->ContentCount() == 0) {
return nullptr;
}
}
+ nsIAtom* pseudoTag = nsCSSPseudoElements::GetPseudoAtom(aType);
return GetContext(computedValues.forget(), aParentContext, pseudoTag, aType,
isBeforeOrAfter ? aOriginatingElement : nullptr);
}
already_AddRefed<nsStyleContext>
ServoStyleSet::ProbePseudoElementStyle(Element* aOriginatingElement,
CSSPseudoElementType aType,
nsStyleContext* aParentContext,
@@ -937,22 +939,22 @@ ServoStyleSet::GetComputedKeyframeValues
aServoValues.mParentStyle,
mRawSet.get(),
&result);
return result;
}
already_AddRefed<ServoComputedValues>
ServoStyleSet::GetBaseComputedValuesForElement(Element* aElement,
- nsIAtom* aPseudoTag)
+ CSSPseudoElementType aPseudoType)
{
return Servo_StyleSet_GetBaseComputedValuesForElement(mRawSet.get(),
aElement,
&Snapshots(),
- aPseudoTag).Consume();
+ aPseudoType).Consume();
}
already_AddRefed<RawServoAnimationValue>
ServoStyleSet::ComputeAnimationValue(
RawServoDeclarationBlock* aDeclarations,
const ServoComputedValuesWithParent& aComputedValues)
{
return Servo_AnimationValue_Compute(aDeclarations,
@@ -980,58 +982,59 @@ void
ServoStyleSet::ClearNonInheritingStyleContexts()
{
for (RefPtr<nsStyleContext>& ptr : mNonInheritingStyleContexts) {
ptr = nullptr;
}
}
already_AddRefed<ServoComputedValues>
-ServoStyleSet::ResolveStyleLazily(Element* aElement, nsIAtom* aPseudoTag)
+ServoStyleSet::ResolveStyleLazily(Element* aElement,
+ CSSPseudoElementType aPseudoType)
{
- mPresContext->EffectCompositor()->PreTraverse(aElement, aPseudoTag);
+ mPresContext->EffectCompositor()->PreTraverse(aElement, aPseudoType);
MOZ_ASSERT(!mStylistMayNeedRebuild);
AutoSetInServoTraversal guard(this);
/**
* NB: This is needed because we process animations and transitions on the
* pseudo-elements themselves, not on the parent's EagerPseudoStyles.
*
* That means that that style doesn't account for animations, and we can't do
* that easily from the traversal without doing wasted work.
*
* As such, we just lie here a bit, which is the entrypoint of
* getComputedStyle, the only API where this can be observed, to look at the
* style of the pseudo-element if it exists instead.
*/
Element* elementForStyleResolution = aElement;
- nsIAtom* pseudoTagForStyleResolution = aPseudoTag;
- if (aPseudoTag == nsCSSPseudoElements::before) {
+ CSSPseudoElementType pseudoTypeForStyleResolution = aPseudoType;
+ if (aPseudoType == CSSPseudoElementType::before) {
if (Element* pseudo = nsLayoutUtils::GetBeforePseudo(aElement)) {
elementForStyleResolution = pseudo;
- pseudoTagForStyleResolution = nullptr;
+ pseudoTypeForStyleResolution = CSSPseudoElementType::NotPseudo;
}
- } else if (aPseudoTag == nsCSSPseudoElements::after) {
+ } else if (aPseudoType == CSSPseudoElementType::after) {
if (Element* pseudo = nsLayoutUtils::GetAfterPseudo(aElement)) {
elementForStyleResolution = pseudo;
- pseudoTagForStyleResolution = nullptr;
+ pseudoTypeForStyleResolution = CSSPseudoElementType::NotPseudo;
}
}
RefPtr<ServoComputedValues> computedValues =
Servo_ResolveStyleLazily(elementForStyleResolution,
- pseudoTagForStyleResolution,
+ pseudoTypeForStyleResolution,
&Snapshots(),
mRawSet.get()).Consume();
- if (mPresContext->EffectCompositor()->PreTraverse(aElement, aPseudoTag)) {
+ if (mPresContext->EffectCompositor()->PreTraverse(aElement, aPseudoType)) {
computedValues =
Servo_ResolveStyleLazily(elementForStyleResolution,
- pseudoTagForStyleResolution,
+ pseudoTypeForStyleResolution,
&Snapshots(),
mRawSet.get()).Consume();
}
return computedValues.forget();
}
bool
--- a/layout/style/ServoStyleSet.h
+++ b/layout/style/ServoStyleSet.h
@@ -160,33 +160,34 @@ public:
// Get a style context for a pseudo-element. aParentElement must be
// non-null. aPseudoID is the CSSPseudoElementType for the
// pseudo-element. aPseudoElement must be non-null if the pseudo-element
// type is one that allows user action pseudo-classes after it or allows
// style attributes; otherwise, it is ignored.
already_AddRefed<nsStyleContext>
ResolvePseudoElementStyle(dom::Element* aOriginatingElement,
- mozilla::CSSPseudoElementType aType,
+ CSSPseudoElementType aType,
nsStyleContext* aParentContext,
dom::Element* aPseudoElement);
// Resolves style for a (possibly-pseudo) Element without assuming that the
// style has been resolved, and without worrying about setting the style
// context up to live in the style context tree (a null parent is used).
// |aPeudoTag| and |aPseudoType| must match.
already_AddRefed<nsStyleContext>
ResolveTransientStyle(dom::Element* aElement,
nsIAtom* aPseudoTag,
CSSPseudoElementType aPseudoType);
// Similar to ResolveTransientStyle() but returns ServoComputedValues.
// Unlike ResolveServoStyle() this function calls PreTraverseSync().
already_AddRefed<ServoComputedValues>
- ResolveTransientServoStyle(dom::Element* aElement, nsIAtom* aPseudoTag);
+ ResolveTransientServoStyle(dom::Element* aElement,
+ CSSPseudoElementType aPseudoTag);
// Get a style context for an anonymous box. aPseudoTag is the pseudo-tag to
// use and must be non-null. It must be an anon box, and must be one that
// inherits style from the given aParentContext.
already_AddRefed<nsStyleContext>
ResolveInheritingAnonymousBoxStyle(nsIAtom* aPseudoTag,
nsStyleContext* aParentContext);
@@ -302,17 +303,18 @@ public:
GetComputedKeyframeValuesFor(const nsTArray<Keyframe>& aKeyframes,
dom::Element* aElement,
const ServoComputedValuesWithParent&
aServoValues);
bool AppendFontFaceRules(nsTArray<nsFontFaceRuleContainer>& aArray);
already_AddRefed<ServoComputedValues>
- GetBaseComputedValuesForElement(dom::Element* aElement, nsIAtom* aPseudoTag);
+ GetBaseComputedValuesForElement(dom::Element* aElement,
+ CSSPseudoElementType aPseudoType);
/**
* Resolve style for a given declaration block with/without the parent style.
* If the parent style is not specified, the document default computed values
* is used.
*/
already_AddRefed<ServoComputedValues>
ResolveForDeclarations(ServoComputedValuesBorrowedOrNull aParentOrNull,
@@ -426,18 +428,18 @@ private:
*/
void MaybeRebuildStylist()
{
if (mStylistMayNeedRebuild) {
RebuildStylist();
}
}
- already_AddRefed<ServoComputedValues> ResolveStyleLazily(dom::Element* aElement,
- nsIAtom* aPseudoTag);
+ already_AddRefed<ServoComputedValues>
+ ResolveStyleLazily(dom::Element* aElement, CSSPseudoElementType aPseudoType);
void RunPostTraversalTasks();
void PrependSheetOfType(SheetType aType,
ServoStyleSheet* aSheet);
void AppendSheetOfType(SheetType aType,
ServoStyleSheet* aSheet);