summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Page/EventHandler.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-10-12 14:44:52 +0200
committerAndreas Kling <kling@serenityos.org>2021-10-12 14:44:52 +0200
commit959b18bde3dec5acf060f3d3ef56324374610000 (patch)
tree4d9d83dcc963efb58de71278f5adab8238915732 /Userland/Libraries/LibWeb/Page/EventHandler.cpp
parentd90be22a735ab31dbfe3a75cf93b03aa061f0134 (diff)
downloadserenity-959b18bde3dec5acf060f3d3ef56324374610000.zip
LibWeb: Remove a bunch of pointless "else" in EventHandler
Diffstat (limited to 'Userland/Libraries/LibWeb/Page/EventHandler.cpp')
-rw-r--r--Userland/Libraries/LibWeb/Page/EventHandler.cpp24
1 files changed, 14 insertions, 10 deletions
diff --git a/Userland/Libraries/LibWeb/Page/EventHandler.cpp b/Userland/Libraries/LibWeb/Page/EventHandler.cpp
index 64dd778838..2544585ec1 100644
--- a/Userland/Libraries/LibWeb/Page/EventHandler.cpp
+++ b/Userland/Libraries/LibWeb/Page/EventHandler.cpp
@@ -413,8 +413,7 @@ bool EventHandler::handle_keydown(KeyCode key, unsigned modifiers, u32 code_poin
if (key == KeyCode::Key_Tab) {
if (modifiers & KeyModifier::Mod_Shift)
return focus_previous_element();
- else
- return focus_next_element();
+ return focus_next_element();
}
if (layout_root->selection().is_valid()) {
@@ -428,7 +427,8 @@ bool EventHandler::handle_keydown(KeyCode key, unsigned modifiers, u32 code_poin
if (key == KeyCode::Key_Backspace || key == KeyCode::Key_Delete) {
m_edit_event_handler->handle_delete(range);
return true;
- } else if (!should_ignore_keydown_event(code_point)) {
+ }
+ if (!should_ignore_keydown_event(code_point)) {
m_edit_event_handler->handle_delete(range);
m_edit_event_handler->handle_insert(m_frame.cursor_position(), code_point);
m_frame.increment_cursor_position_offset();
@@ -446,31 +446,35 @@ bool EventHandler::handle_keydown(KeyCode key, unsigned modifiers, u32 code_poin
m_edit_event_handler->handle_delete_character_after(m_frame.cursor_position());
return true;
- } else if (key == KeyCode::Key_Delete) {
+ }
+ if (key == KeyCode::Key_Delete) {
if (m_frame.cursor_position().offset_is_at_end_of_node()) {
// FIXME: Move to the next node and delete the first character there.
return true;
}
m_edit_event_handler->handle_delete_character_after(m_frame.cursor_position());
return true;
- } else if (key == KeyCode::Key_Right) {
+ }
+ if (key == KeyCode::Key_Right) {
if (!m_frame.increment_cursor_position_offset()) {
// FIXME: Move to the next node.
}
return true;
- } else if (key == KeyCode::Key_Left) {
+ }
+ if (key == KeyCode::Key_Left) {
if (!m_frame.decrement_cursor_position_offset()) {
// FIXME: Move to the previous node.
}
return true;
- } else if (!should_ignore_keydown_event(code_point)) {
+ }
+ if (!should_ignore_keydown_event(code_point)) {
m_edit_event_handler->handle_insert(m_frame.cursor_position(), code_point);
m_frame.increment_cursor_position_offset();
return true;
- } else {
- // NOTE: Because modifier keys should be ignored, we need to return true.
- return true;
}
+
+ // NOTE: Because modifier keys should be ignored, we need to return true.
+ return true;
}
auto event = UIEvents::KeyboardEvent::create_from_platform_event(UIEvents::EventNames::keydown, key, modifiers, code_point);