mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-18 16:57:29 +03:00
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.
This commit is contained in:
parent
c51a4cc007
commit
a7d7c5b7b4
Notes:
sideshowbarker
2024-07-18 08:59:31 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/a7d7c5b7b4 Pull-request: https://github.com/SerenityOS/serenity/pull/23626
@ -33,11 +33,6 @@ void EditEventHandler::handle_delete_character_after(JS::NonnullGCPtr<DOM::Posit
|
||||
builder.append(text.bytes_as_string_view().substring_view(*next_grapheme_offset));
|
||||
node.set_data(MUST(builder.to_string()));
|
||||
|
||||
// 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({});
|
||||
}
|
||||
|
||||
@ -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<DOM::Position> 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({});
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user