mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:47:44 +00:00
LibWeb: Allow toggling playback of media elements with keyboard controls
This allows pausing/playing media elements with the space bar.
This commit is contained in:
parent
2c5c815f44
commit
a4070b1452
3 changed files with 22 additions and 0 deletions
|
@ -745,6 +745,11 @@ bool EventHandler::handle_keydown(KeyCode key, unsigned modifiers, u32 code_poin
|
|||
}
|
||||
}
|
||||
|
||||
if (auto* element = m_browsing_context->active_document()->focused_element(); is<HTML::HTMLMediaElement>(element)) {
|
||||
auto& media_element = static_cast<HTML::HTMLMediaElement&>(*element);
|
||||
media_element.handle_keydown({}, key).release_value_but_fixme_should_propagate_errors();
|
||||
}
|
||||
|
||||
if (m_browsing_context->cursor_position().is_valid() && m_browsing_context->cursor_position().node()->is_editable()) {
|
||||
if (key == KeyCode::Key_Backspace) {
|
||||
if (!m_browsing_context->decrement_cursor_position_offset()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue