LibWeb: Store visual context nodes in arena-based tree

Replace per-node heap-allocated AtomicRefCounted
AccumulatedVisualContext objects with a single contiguous Vector inside
AccumulatedVisualContextTree. All nodes for a frame are now stored in
one allocation, using type-safe VisualContextIndex instead of RefPtr
pointers.

This reduces allocation churn, improves cache locality, and opens the
door for future snapshotting of visual context state — similar to how
scroll offsets are snapshotted today.
This commit is contained in:
Aliaksandr Kalenik
2026-03-11 00:21:46 +01:00
committed by Alexander Kalenik
parent 834675aea3
commit 9d2ebe90ed
Notes: github-actions[bot] 2026-03-11 10:17:47 +00:00
20 changed files with 258 additions and 207 deletions

View File

@@ -87,8 +87,8 @@ public:
void translate(Gfx::IntPoint delta);
void set_accumulated_visual_context(RefPtr<AccumulatedVisualContext const> state) { m_accumulated_visual_context = move(state); }
RefPtr<AccumulatedVisualContext const> accumulated_visual_context() const { return m_accumulated_visual_context; }
void set_accumulated_visual_context(VisualContextIndex index) { m_accumulated_visual_context_index = index; }
VisualContextIndex accumulated_visual_context() const { return m_accumulated_visual_context_index; }
void replay_cached_commands(ReadonlySpan<DisplayListCommand> commands);
@@ -149,7 +149,7 @@ public:
private:
void end_capture();
RefPtr<AccumulatedVisualContext const> m_accumulated_visual_context;
VisualContextIndex m_accumulated_visual_context_index {};
Vector<size_t> m_push_sc_index_stack;
DisplayList& m_display_list;
bool m_is_capturing { false };