Bug 1401317 - Disable lazy pseudo caching when the originating element's primary style was reused via the rule node. r=emilio

MozReview-Commit-ID: IkBa39E1bR1
This commit is contained in:
Bobby Holley
2017-09-19 21:43:31 -07:00
parent 1a3ca2a62b
commit 1f8e1325c1
2 changed files with 15 additions and 2 deletions

View File

@@ -548,6 +548,16 @@ ServoStyleSet::ResolveStyleForPlaceholder()
return computedValues.forget();
}
static inline bool
LazyPseudoIsCacheable(CSSPseudoElementType aType,
Element* aOriginatingElement,
ServoStyleContext* aParentContext)
{
return aParentContext &&
!nsCSSPseudoElements::IsEagerlyCascadedInServo(aType) &&
!Servo_Element_IsPrimaryStyleReusedViaRuleNode(aOriginatingElement);
}
already_AddRefed<ServoStyleContext>
ServoStyleSet::ResolvePseudoElementStyle(Element* aOriginatingElement,
CSSPseudoElementType aType,
@@ -566,7 +576,7 @@ ServoStyleSet::ResolvePseudoElementStyle(Element* aOriginatingElement,
Servo_ResolveStyle(aPseudoElement, mRawSet.get()).Consume();
} else {
bool cacheable =
!nsCSSPseudoElements::IsEagerlyCascadedInServo(aType) && aParentContext;
LazyPseudoIsCacheable(aType, aOriginatingElement, aParentContext);
computedValues =
cacheable ? aParentContext->GetCachedLazyPseudoStyle(aType) : nullptr;
@@ -895,7 +905,7 @@ ServoStyleSet::ProbePseudoElementStyle(Element* aOriginatingElement,
MOZ_ASSERT(aType < CSSPseudoElementType::Count);
bool cacheable =
!nsCSSPseudoElements::IsEagerlyCascadedInServo(aType) && aParentContext;
LazyPseudoIsCacheable(aType, aOriginatingElement, aParentContext);
RefPtr<ServoStyleContext> computedValues =
cacheable ? aParentContext->GetCachedLazyPseudoStyle(aType) : nullptr;