diff options
author | asynts <asynts@gmail.com> | 2020-12-02 13:41:58 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-12-09 21:05:06 +0100 |
commit | e96faea1a232a349c4db31657624a577eaa6f7a0 (patch) | |
tree | 0c1ebef57c8c620db580365acda99ebbf9a6e59c /Libraries/LibWeb/Page/EventHandler.cpp | |
parent | 43dc47a4941d6aaa99ed847f879b4601094f6d4a (diff) | |
download | serenity-e96faea1a232a349c4db31657624a577eaa6f7a0.zip |
LibWeb: Support range delection accross nodes with shared parent.
Diffstat (limited to 'Libraries/LibWeb/Page/EventHandler.cpp')
-rw-r--r-- | Libraries/LibWeb/Page/EventHandler.cpp | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/Libraries/LibWeb/Page/EventHandler.cpp b/Libraries/LibWeb/Page/EventHandler.cpp index 4a94a54c77..e8e806d57c 100644 --- a/Libraries/LibWeb/Page/EventHandler.cpp +++ b/Libraries/LibWeb/Page/EventHandler.cpp @@ -353,25 +353,21 @@ bool EventHandler::handle_keydown(KeyCode key, unsigned modifiers, u32 code_poin m_edit_event_handler->handle_delete(range); return true; } + } else { + m_edit_event_handler->handle_delete(range); + m_edit_event_handler->handle_insert(m_frame.cursor_position(), code_point); + return true; } - - // FIXME: Check if this code point is in the printable character range. - - m_edit_event_handler->handle_delete(range); - m_edit_event_handler->handle_insert(m_frame.cursor_position(), code_point); - return true; } if (m_frame.cursor_position().is_valid() && m_frame.cursor_position().node()->is_editable()) { if (key == KeyCode::Key_Backspace) { m_edit_event_handler->handle_delete(m_frame.cursor_position()); return true; + } else { + m_edit_event_handler->handle_insert(m_frame.cursor_position(), code_point); + return true; } - - // FIXME: Check if this code point is in the printable character range. - - m_edit_event_handler->handle_insert(m_frame.cursor_position(), code_point); - return true; } return false; |