Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Unified Diff: third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp

Issue 2700663002: Adds keyboard functionality for videos. (Closed)
Patch Set: Addresses mlamouri's #20 comments. Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp
diff --git a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp
index 402230417b10ac62781469052557d3177e51ee4e..b367c4d1a2e11384842b3a580f97745206c9a812 100644
--- a/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp
+++ b/third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.cpp
@@ -33,6 +33,7 @@
#include "core/dom/ResizeObserverCallback.h"
#include "core/dom/ResizeObserverEntry.h"
#include "core/dom/TaskRunnerHelper.h"
+#include "core/events/KeyboardEvent.h"
#include "core/events/MouseEvent.h"
#include "core/frame/Settings.h"
#include "core/frame/UseCounter.h"
@@ -765,6 +766,27 @@ void MediaControlsImpl::defaultEventHandler(Event* event) {
startHideMediaControlsTimer();
return;
}
+
+ if (event->type() == EventTypeNames::input) {
+ resetHideMediaControlsTimer();
+ }
mlamouri (slow - plz ping) 2017/04/10 13:14:02 I think steimel@'s CL doing this has landed.
CJ 2017/04/12 23:21:05 Done.
CJ 2017/04/12 23:21:05 Done.
+
+ if (event->isKeyboardEvent()) {
+ const String& key = toKeyboardEvent(event)->key();
+ if (key == "Enter" || toKeyboardEvent(event)->keyCode() == ' ') {
+ m_playButton->onMediaKeyboardEvent(event);
+ return;
+ }
+ if (key == "ArrowLeft" || key == "ArrowRight" || key == "Home" ||
+ key == "End") {
+ timelineElement()->onMediaKeyboardEvent(event);
mlamouri (slow - plz ping) 2017/04/10 13:14:02 nit: use the member directly
CJ 2017/04/12 23:21:05 Done.
+ return;
+ }
+ if (key == "ArrowDown" || key == "ArrowUp") {
+ volumeSliderElement()->onMediaKeyboardEvent(event);
mlamouri (slow - plz ping) 2017/04/10 13:14:02 ditto
CJ 2017/04/12 23:21:05 Done.
+ return;
+ }
+ }
}
void MediaControlsImpl::hideMediaControlsTimerFired(TimerBase*) {
« no previous file with comments | « third_party/WebKit/Source/modules/media_controls/MediaControlsImpl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698