LibWeb: Remove a bunch of redundant Document::navigable() lookups

Document::navigable() can be unpleasantly slow, since we don't have a
direct link between documents and navigables at the moment. So let's not
call it twice when once is enough.
This commit is contained in:
Andreas Kling 2024-03-16 09:24:57 +01:00
commit 43c720db81
Notes: sideshowbarker 2024-07-17 02:06:40 +09:00
4 changed files with 21 additions and 14 deletions

View file

@ -922,8 +922,9 @@ JS::NonnullGCPtr<Geometry::DOMRectList> Element::get_client_rects() const
// FIXME: - Replace each anonymous block box with its child box(es) and repeat this until no anonymous block boxes
// are left in the final list.
const_cast<Document&>(document()).update_layout();
VERIFY(document().navigable());
auto viewport_offset = document().navigable()->viewport_scroll_offset();
auto navigable = document().navigable();
VERIFY(navigable);
auto viewport_offset = navigable->viewport_scroll_offset();
if (document().paintable()) {
// NOTE: Make sure CSS transforms are resolved before it is used to calculate the rect position.