LibWeb: Make transition order consider property name

class_specific_composite_order() also has no reason to return an
Optional<int>, since it can just return 0.
This commit is contained in:
Psychpsyo 2025-11-11 11:45:36 +01:00 committed by Jelle Raaijmakers
parent 1df94c4513
commit 2c4f2a3cb6
Notes: github-actions[bot] 2025-11-11 12:48:13 +00:00
8 changed files with 36 additions and 12 deletions

View file

@ -38,7 +38,7 @@ Animations::AnimationClass CSSTransition::animation_class() const
return Animations::AnimationClass::CSSTransition;
}
Optional<int> CSSTransition::class_specific_composite_order(GC::Ref<Animations::Animation> other_animation) const
int CSSTransition::class_specific_composite_order(GC::Ref<Animations::Animation> other_animation) const
{
auto other = GC::Ref { as<CSSTransition>(*other_animation) };
@ -66,7 +66,7 @@ Optional<int> CSSTransition::class_specific_composite_order(GC::Ref<Animations::
// - element children
if (owning_element().ptr() != other->owning_element().ptr()) {
// FIXME: Actually sort by tree order
return {};
return 0;
}
// 4. Otherwise, if A and B have different transition generation values, sort by their corresponding transition
@ -74,11 +74,11 @@ Optional<int> CSSTransition::class_specific_composite_order(GC::Ref<Animations::
if (m_transition_generation != other->m_transition_generation)
return m_transition_generation - other->m_transition_generation;
// FIXME:
// 5. Otherwise, sort A and B in ascending order by the Unicode codepoints that make up the expanded transition
// property name of each transition (i.e. without attempting case conversion and such that -moz-column-width
// sorts before column-width).
return {};
// FIXME: This should operate on Unicode strings, not StringViews.
return transition_property() > other->transition_property();
}
CSSTransition::CSSTransition(JS::Realm& realm, DOM::AbstractElement abstract_element, PropertyID property_id, size_t transition_generation,