mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 04:08:11 +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
|
@ -1857,6 +1857,20 @@ void HTMLMediaElement::reject_pending_play_promises(ReadonlySpan<JS::NonnullGCPt
|
|||
environment_settings.clean_up_after_running_script();
|
||||
}
|
||||
|
||||
WebIDL::ExceptionOr<void> HTMLMediaElement::handle_keydown(Badge<Web::EventHandler>, KeyCode key)
|
||||
{
|
||||
switch (key) {
|
||||
case KeyCode::Key_Space:
|
||||
TRY(toggle_playback());
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void HTMLMediaElement::set_layout_display_time(Badge<Painting::MediaPaintable>, Optional<double> display_time)
|
||||
{
|
||||
if (display_time.has_value() && !m_display_time.has_value()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue