LibWeb: Don't handle media player key events if any modifier is pressed
Some checks are pending
CI / Lagom (false, FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, macos-14, macOS, Clang) (push) Waiting to run
CI / Lagom (false, NO_FUZZ, ubuntu-22.04, Linux, GNU) (push) Waiting to run
CI / Lagom (true, NO_FUZZ, ubuntu-22.04, Linux, Clang) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (macos-14, macOS, macOS-universal2) (push) Waiting to run
Package the js repl as a binary artifact / build-and-package (ubuntu-22.04, Linux, Linux-x86_64) (push) Waiting to run
Run test262 and test-wasm / run_and_update_results (push) Waiting to run
Lint Code / lint (push) Waiting to run
Push notes / build (push) Waiting to run

This commit is contained in:
Tim Ledbetter 2024-09-04 04:30:44 +01:00 committed by Tim Flynn
parent 63231fd276
commit a56a2faf51
Notes: github-actions[bot] 2024-09-04 14:00:43 +00:00
3 changed files with 6 additions and 3 deletions

View file

@ -1914,8 +1914,11 @@ void HTMLMediaElement::reject_pending_play_promises(ReadonlySpan<JS::NonnullGCPt
WebIDL::reject_promise(realm, promise, error); WebIDL::reject_promise(realm, promise, error);
} }
WebIDL::ExceptionOr<bool> HTMLMediaElement::handle_keydown(Badge<Web::EventHandler>, UIEvents::KeyCode key) WebIDL::ExceptionOr<bool> HTMLMediaElement::handle_keydown(Badge<Web::EventHandler>, UIEvents::KeyCode key, u32 modifiers)
{ {
if (modifiers != UIEvents::KeyModifier::Mod_None)
return false;
switch (key) { switch (key) {
case UIEvents::KeyCode::Key_Space: case UIEvents::KeyCode::Key_Space:
TRY(toggle_playback()); TRY(toggle_playback());

View file

@ -109,7 +109,7 @@ public:
JS::NonnullGCPtr<TextTrack> add_text_track(Bindings::TextTrackKind kind, String const& label, String const& language); JS::NonnullGCPtr<TextTrack> add_text_track(Bindings::TextTrackKind kind, String const& label, String const& language);
WebIDL::ExceptionOr<bool> handle_keydown(Badge<Web::EventHandler>, UIEvents::KeyCode); WebIDL::ExceptionOr<bool> handle_keydown(Badge<Web::EventHandler>, UIEvents::KeyCode, u32 modifiers);
enum class MouseTrackingComponent { enum class MouseTrackingComponent {
Timeline, Timeline,

View file

@ -890,7 +890,7 @@ bool EventHandler::handle_keydown(UIEvents::KeyCode key, u32 modifiers, u32 code
if (auto* element = m_navigable->active_document()->focused_element(); is<HTML::HTMLMediaElement>(element)) { if (auto* element = m_navigable->active_document()->focused_element(); is<HTML::HTMLMediaElement>(element)) {
auto& media_element = static_cast<HTML::HTMLMediaElement&>(*element); auto& media_element = static_cast<HTML::HTMLMediaElement&>(*element);
if (media_element.handle_keydown({}, key).release_value_but_fixme_should_propagate_errors()) if (media_element.handle_keydown({}, key, modifiers).release_value_but_fixme_should_propagate_errors())
return true; return true;
} }