Bug 1398661 - Convert target element to the parent if the target element is pseudo in EffectCompositor::PreTraverseInSubtree/PreTraverse. r?emilio
MozReview-Commit-ID: Dl2gvkLpo4k
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -977,16 +977,26 @@ EffectCompositor::PreTraverseInSubtree(S
Element* aRoot)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(mPresContext->RestyleManager()->IsServo());
MOZ_ASSERT(!aRoot || nsComputedDOMStyle::GetPresShellForContent(aRoot),
"Traversal root, if provided, should be bound to a display "
"document");
+ // Convert the root element to the parent element if the root element is
+ // pseudo since we check each element in mElementsToRestyle is in the subtree
+ // of the root element later in this function, but for pseudo elements the
+ // element in mElementsToRestyle is the parent of the pseudo.
+ if (aRoot &&
+ (aRoot->IsGeneratedContentContainerForBefore() ||
+ aRoot->IsGeneratedContentContainerForAfter())) {
+ aRoot = aRoot->GetParentElement();
+ }
+
AutoRestore<bool> guard(mIsInPreTraverse);
mIsInPreTraverse = true;
// We need to force flush all throttled animations if we also have
// non-animation restyles (since we'll want the up-to-date animation style
// when we go to process them so we can trigger transitions correctly), and
// if we are currently flushing all throttled animation restyles.
bool flushThrottledRestyles =