mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-26 01:35:08 +02:00
LibWeb: Sort update-the-rendering docs per HTML spec
Prep for rasterizing each Navigable independently, where children must paint before their parents — the event loop needs to walk documents in an order where every child comes after its container. The HTML spec already mandates such an order for the "docs" list: each document appears after its container, with siblings in shadow-including tree order. Maintain m_documents in that sorted order, re-sorting lazily when a document is registered or its navigable is reassigned.
This commit is contained in:
committed by
Alexander Kalenik
parent
199fcaa0e8
commit
115531eef1
Notes:
github-actions[bot]
2026-04-07 13:10:55 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/115531eef1c Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/8793
@@ -75,6 +75,7 @@ public:
|
||||
|
||||
void register_document(Badge<DOM::Document>, DOM::Document&);
|
||||
void unregister_document(Badge<DOM::Document>, DOM::Document&);
|
||||
void document_navigable_did_change(Badge<DOM::Document>);
|
||||
|
||||
[[nodiscard]] Vector<GC::Root<DOM::Document>> documents_in_this_event_loop_matching(Function<bool(DOM::Document&)> callback) const;
|
||||
|
||||
@@ -124,7 +125,9 @@ private:
|
||||
// https://html.spec.whatwg.org/multipage/webappapis.html#performing-a-microtask-checkpoint
|
||||
bool m_performing_a_microtask_checkpoint { false };
|
||||
|
||||
Vector<GC::Weak<DOM::Document>> m_documents;
|
||||
mutable Vector<GC::Weak<DOM::Document>> m_documents;
|
||||
mutable bool m_documents_sort_dirty { false };
|
||||
void ensure_documents_sorted() const;
|
||||
|
||||
// Used to implement step 4 of "perform a microtask checkpoint".
|
||||
// NOTE: These are weak references! ESO registers and unregisters itself from the event loop manually.
|
||||
|
||||
Reference in New Issue
Block a user