From a7d7c5b7b427f38bbf377a72bf8b4cb45068e5e0 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 17 Mar 2024 19:15:20 +0100 Subject: [PATCH] LibWeb: Don't force relayout after every keyboard input event Instead, just rely on the invalidation and lazy relayout that happens as a consequence of mutating the DOM. This allows multiple keystrokes to coalesce into a single relayout if necessary, dramatically improving performance when typing text into form fields on complex pages. --- .../Libraries/LibWeb/Page/EditEventHandler.cpp | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/Userland/Libraries/LibWeb/Page/EditEventHandler.cpp b/Userland/Libraries/LibWeb/Page/EditEventHandler.cpp index 5b3dccdcfb2..542efbe2311 100644 --- a/Userland/Libraries/LibWeb/Page/EditEventHandler.cpp +++ b/Userland/Libraries/LibWeb/Page/EditEventHandler.cpp @@ -33,11 +33,6 @@ void EditEventHandler::handle_delete_character_after(JS::NonnullGCPtractive_document()->force_layout(); - m_browsing_context->did_edit({}); } @@ -94,11 +89,6 @@ void EditEventHandler::handle_delete(DOM::Range& range) end->remove(); } - // FIXME: When nodes are removed from the DOM, the associated layout nodes become stale and still - // remain in the layout tree. This has to be fixed, this just causes everything to be recomputed - // which really hurts performance. - m_browsing_context->active_document()->force_layout(); - m_browsing_context->did_edit({}); } @@ -131,11 +121,6 @@ void EditEventHandler::handle_insert(JS::NonnullGCPtr position, u position->set_offset(1); } - // FIXME: When nodes are removed from the DOM, the associated layout nodes become stale and still - // remain in the layout tree. This has to be fixed, this just causes everything to be recomputed - // which really hurts performance. - m_browsing_context->active_document()->force_layout(); - m_browsing_context->did_edit({}); } }