LibWeb: Track the transition generation

This is used for transition's class-specific composite ordering
This commit is contained in:
Matthew Olsson 2024-02-19 19:27:37 -07:00 committed by Andreas Kling
commit e4f1cb6f8c
Notes: sideshowbarker 2024-07-18 04:46:35 +09:00
2 changed files with 9 additions and 0 deletions

View file

@ -1166,6 +1166,10 @@ void Document::update_style()
update_animated_style_if_needed();
// Associated with each top-level browsing context is a current transition generation that is incremented on each
// style change event. [CSS-Transitions-2]
m_transition_generation++;
if (!needs_full_style_update() && !needs_style_update() && !child_needs_style_update())
return;

View file

@ -622,6 +622,8 @@ public:
OrderedHashTable<JS::NonnullGCPtr<Element>> const& top_layer_elements() const { return m_top_layer_elements; }
size_t transition_generation() const { return m_transition_generation; }
protected:
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Cell::Visitor&) override;
@ -843,6 +845,9 @@ private:
Vector<PendingAnimationEvent> m_pending_animation_event_queue;
RefPtr<Core::Timer> m_animation_driver_timer;
// https://drafts.csswg.org/css-transitions-2/#current-transition-generation
size_t m_transition_generation { 0 };
bool m_needs_to_call_page_did_load { false };
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#scripts-may-run-for-the-newly-created-document