LibWeb: Run IntersectionObserver steps only when needed

Instead of updating IOs in every iteration of the HTML event loop,
we now only do it after a relayout, or after the viewport changes.
This commit is contained in:
Andreas Kling 2024-02-24 08:09:42 +01:00
commit 11b4216e65
Notes: sideshowbarker 2024-07-17 07:35:03 +09:00
3 changed files with 8 additions and 3 deletions

View file

@ -1106,6 +1106,9 @@ void Document::update_layout()
m_needs_layout = false;
m_layout_update_timer->stop();
// OPTIMIZATION: We do this here instead of in HTML::EventLoop::process() to avoid redundant work.
run_the_update_intersection_observations_steps(HighResolutionTime::unsafe_shared_current_time());
}
[[nodiscard]] static Element::RequiredInvalidationAfterStyleChange update_style_recursively(Node& node)