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

@@ -37,6 +37,9 @@ SERVO_BINDING_FUNC(Servo_Element_GetPseudoComputedValues,
SERVO_BINDING_FUNC(Servo_Element_IsDisplayNone, SERVO_BINDING_FUNC(Servo_Element_IsDisplayNone,
bool, bool,
RawGeckoElementBorrowed element) RawGeckoElementBorrowed element)
SERVO_BINDING_FUNC(Servo_Element_IsPrimaryStyleReusedViaRuleNode,
bool,
RawGeckoElementBorrowed element)
// Styleset and Stylesheet management // Styleset and Stylesheet management
SERVO_BINDING_FUNC(Servo_StyleSheet_FromUTF8Bytes, SERVO_BINDING_FUNC(Servo_StyleSheet_FromUTF8Bytes,

View File

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