LibWeb: Make Animation's owning element an AbstractElement

From the spec:
> The owning element of a transition refers to the element or
  pseudo-element to which the transition-property property was applied
  that generated the animation.

https://drafts.csswg.org/css-transitions-2/#owning-element

Previously we only stored the element.
This commit is contained in:
Sam Atkins 2025-12-02 11:17:41 +00:00 committed by Andreas Kling
parent b61c857c64
commit d717dd64b3
Notes: github-actions[bot] 2025-12-03 12:31:08 +00:00
6 changed files with 22 additions and 20 deletions

View file

@ -26,11 +26,11 @@ int CSSAnimation::class_specific_composite_order(GC::Ref<Animations::Animation>
// The existence of an owning element determines the animation class, so both animations should have their owning
// element in the same state
VERIFY(!owning_element() == !other->owning_element());
VERIFY(owning_element().has_value() == other->owning_element().has_value());
// Within the set of CSS Animations with an owning element, two animations A and B are sorted in composite order
// (first to last) as follows:
if (owning_element()) {
if (owning_element().has_value()) {
// 1. If the owning element of A and B differs, sort A and B by tree order of their corresponding owning elements.
// With regard to pseudo-elements, the sort order is as follows:
// - element
@ -40,7 +40,7 @@ int CSSAnimation::class_specific_composite_order(GC::Ref<Animations::Animation>
// codepoints that make up each selector
// - ::after
// - element children
if (owning_element().ptr() != other->owning_element().ptr()) {
if (owning_element() != other->owning_element()) {
// FIXME: Sort by tree order
return 0;
}
@ -57,7 +57,7 @@ int CSSAnimation::class_specific_composite_order(GC::Ref<Animations::Animation>
Animations::AnimationClass CSSAnimation::animation_class() const
{
if (owning_element())
if (owning_element().has_value())
return Animations::AnimationClass::CSSAnimationWithOwningElement;
return Animations::AnimationClass::CSSAnimationWithoutOwningElement;
}