Open Bug 1977916 Opened 3 months ago Updated 2 months ago

[css-view-transitons] EffectCompositor::PreTraverseInSubtree doesn't deal with view-transition pseudo-elements

Categories

(Core :: CSS Transitions and Animations, defect)

defect

Tracking

()

People

(Reporter: emilio, Unassigned)

References

(Blocks 1 open bug)

Details

This was added in bug 1398661. We might be able to come up with a similar test-case (or figure out why it's not a problem?)

Came up while debugging bug 1977914. Proposed fix:

diff --git a/dom/animation/EffectCompositor.cpp b/dom/animation/EffectCompositor.cpp
index 2282037536474..93be9f56afb17 100644
--- a/dom/animation/EffectCompositor.cpp
+++ b/dom/animation/EffectCompositor.cpp
@@ -787,10 +787,9 @@ bool EffectCompositor::PreTraverseInSubtree(ServoTraversalFlags aFlags,
   // 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->IsGeneratedContentContainerForMarker())) {
-    aRoot = aRoot->GetParentElement();
+  if (aRoot) {
+    auto pair = AnimationUtils::GetElementPseudoPair(aRoot);
+    aRoot = const_cast<Element*>(pair.first);
   }

   AutoRestore<bool> guard(mIsInPreTraverse);

Boris, it seems this code also needs a similar fix? I don't think content can get into one of those tho.

(In reply to Emilio Cobos Álvarez (:emilio) from comment #0)

Boris, it seems this code also needs a similar fix? I don't think content can get into one of those tho.

For getAnimations(), I use a different code path to handle it:
https://searchfox.org/mozilla-central/rev/6c0885bd353e783a6b7009640e6d5b4f8e235c8e/dom/base/Element.cpp#4282, because it is impossible to get a view-transition pseudo element in JS code. In other words, this pointer is always the documentElement if you want to get the animations of a view transition pseudo-element.

It checks if this is the root element. If it is, we get the document and active view transition, and then find the pseudo element, and then collect the animations belonging to this pseudo element.

The PreTraverse() code is what I missed. Agree we have to find an example for it.

Severity: -- → S3
Whiteboard: [viewtransitions:triage]
You need to log in before you can comment on or make changes to this bug.