LibWeb: Refresh text-<input> contents when pressing backspace or delete

Make sure to refresh the contents of text-<input> when pressing
backspace or delete key.

The methods 'handle_insert()' and 'handle_delete()' already had the call
to 'm_browsing_context.active_document()->force_layout()' so let us also
add it to 'handle_delete_character_after()'.
This commit is contained in:
Kenneth Myhra 2022-02-18 23:14:52 +01:00 committed by Andreas Kling
parent e2d797dd60
commit 4877e7593c
Notes: sideshowbarker 2024-07-17 18:33:33 +09:00

View File

@ -33,6 +33,11 @@ void EditEventHandler::handle_delete_character_after(const DOM::Position& cursor
builder.append(text.substring_view(cursor_position.offset() + code_point_length));
node.set_data(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({});
}