Bug 1398661 - Convert target element to the parent if the target element is pseudo in EffectCompositor::PreTraverseInSubtree/PreTraverse. r?emilio draft
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Thu, 14 Sep 2017 06:22:40 +0900
changeset 664297 e2fe06847d7967ff1c3d4dcd64c3509a0199d1a9
parent 664064 e5f80a639bfe68b68693a5be610f9d36b6c5ad00
child 731427 faf6510cda5873e34044892a18321f50fdc01372
push id79678
push userhikezoe@mozilla.com
push dateWed, 13 Sep 2017 21:28:53 +0000
reviewersemilio
bugs1398661
milestone57.0a1
Bug 1398661 - Convert target element to the parent if the target element is pseudo in EffectCompositor::PreTraverseInSubtree/PreTraverse. r?emilio MozReview-Commit-ID: Dl2gvkLpo4k
dom/animation/EffectCompositor.cpp
--- 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 =