From e4f1cb6f8c07e707384a1674dc5c159673ce2c96 Mon Sep 17 00:00:00 2001 From: Matthew Olsson Date: Mon, 19 Feb 2024 19:27:37 -0700 Subject: [PATCH] LibWeb: Track the transition generation This is used for transition's class-specific composite ordering --- Userland/Libraries/LibWeb/DOM/Document.cpp | 4 ++++ Userland/Libraries/LibWeb/DOM/Document.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 436e7fc0bcb..04ece3ca6cc 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -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; diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index 49abbbd30a6..a141b57a47c 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -622,6 +622,8 @@ public: OrderedHashTable> 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 m_pending_animation_event_queue; RefPtr 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