Bug 1315874 - Drop animation styles if we re-use an existing style context in DoGetStyleContextNoFlush for non-animation style; r=heycam
MozReview-Commit-ID: GrB8A8bVLiX
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -601,16 +601,32 @@ nsComputedDOMStyle::DoGetStyleContextNoF
!aElement->IsHTMLElement(nsGkAtoms::area)) {
nsIFrame* frame = nsLayoutUtils::GetStyleFrame(aElement);
if (frame) {
nsStyleContext* result = frame->StyleContext();
// Don't use the style context if it was influenced by
// pseudo-elements, since then it's not the primary style
// for this element.
if (!result->HasPseudoElementData()) {
+ // The existing style context may have animation styles so check if we
+ // need to remove them.
+ if (aAnimationFlag == eWithoutAnimation) {
+ nsPresContext* presContext = presShell->GetPresContext();
+ MOZ_ASSERT(presContext, "Should have a prescontext if we have a frame");
+ MOZ_ASSERT(presContext->StyleSet()->IsGecko(),
+ "stylo: Need ResolveStyleByRemovingAnimation for stylo");
+ if (presContext && presContext->StyleSet()->IsGecko()) {
+ nsStyleSet* styleSet = presContext->StyleSet()->AsGecko();
+ return styleSet->ResolveStyleByRemovingAnimation(
+ aElement, result, eRestyle_AllHintsWithAnimations);
+ } else {
+ return nullptr;
+ }
+ }
+
// this function returns an addrefed style context
RefPtr<nsStyleContext> ret = result;
return ret.forget();
}
}
}
// No frame has been created, or we have a pseudo, or we're looking