ladybird/Libraries/LibWeb/IntersectionObserver
Andreas Kling e2d5d72f55 LibWeb: Reduce allocations in IntersectionObserver hot path
Pre-compute per-observer values (root node, root paintable, root
bounds, is_implicit_root, root_is_element) once before the per-target
loop instead of recomputing them for each target.

Add intersection_root_node() which returns GC::Ref<DOM::Node> without
creating GC::Root wrappers. Previously, intersection_root() was called
multiple times per target (in the skip condition check, in
compute_intersection, and again in root_intersection_rectangle inside
compute_intersection), each call creating GC::Root objects that require
heap allocation via new RootImpl.

Pass the pre-computed root bounds and root paintable into
compute_intersection instead of having it call
root_intersection_rectangle() and intersection_root() internally.

For an observer watching N targets, this eliminates roughly 4N heap
allocations per frame.
2026-03-22 14:09:22 -05:00
..
IntersectionObserver.cpp LibWeb: Reduce allocations in IntersectionObserver hot path 2026-03-22 14:09:22 -05:00
IntersectionObserver.h LibWeb: Reduce allocations in IntersectionObserver hot path 2026-03-22 14:09:22 -05:00
IntersectionObserver.idl LibWeb: Convert trivial attributes to FrozenArray 2025-04-25 16:43:43 +02:00
IntersectionObserverEntry.cpp LibWeb: Only set prototype once for object with IDL interface 2025-04-20 18:43:11 +02:00
IntersectionObserverEntry.h LibGC+Everywhere: Factor out a LibGC from LibJS 2024-11-15 14:49:20 +01:00
IntersectionObserverEntry.idl Everywhere: Hoist the Libraries folder to the top-level 2024-11-10 12:50:45 +01:00
IntersectionObserverRegistration.h LibWeb: Reduce recompilation impact of DOM/Element.h 2026-02-11 20:02:28 +01:00