LibWeb: Don't propagate key events that are handled by the media player

If a key is pressed when the media player is in focus, which causes the
media player to perform some action, that key event is no longer
propagated further.
This commit is contained in:
Tim Ledbetter 2024-09-03 14:21:33 +01:00 committed by Tim Flynn
parent f1395a2c38
commit 63231fd276
Notes: github-actions[bot] 2024-09-04 14:00:50 +00:00
3 changed files with 6 additions and 5 deletions

View file

@ -1914,7 +1914,7 @@ void HTMLMediaElement::reject_pending_play_promises(ReadonlySpan<JS::NonnullGCPt
WebIDL::reject_promise(realm, promise, error);
}
WebIDL::ExceptionOr<void> HTMLMediaElement::handle_keydown(Badge<Web::EventHandler>, UIEvents::KeyCode key)
WebIDL::ExceptionOr<bool> HTMLMediaElement::handle_keydown(Badge<Web::EventHandler>, UIEvents::KeyCode key)
{
switch (key) {
case UIEvents::KeyCode::Key_Space:
@ -1961,10 +1961,10 @@ WebIDL::ExceptionOr<void> HTMLMediaElement::handle_keydown(Badge<Web::EventHandl
break;
default:
break;
return false;
}
return {};
return true;
}
void HTMLMediaElement::set_layout_display_time(Badge<Painting::MediaPaintable>, Optional<double> display_time)