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

Unified Diff: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp

Issue 2700663002: Adds keyboard functionality for videos. (Closed)
Patch Set: Clean up. Created 3 years, 9 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
Index: third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
index 6fcf2642e672bbb9fa145f243b43bcf7045fa993..e77ba7dad0f7015c91a02b78fa78dc83f52c7952 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControls.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControls.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"
@@ -751,6 +752,26 @@ void MediaControls::defaultEventHandler(Event* event) {
startHideMediaControlsTimer();
return;
}
+
+ if (event->type() == EventTypeNames::input) {
mlamouri (slow - plz ping) 2017/03/27 13:02:12 stupid question: why is that?
CJ 2017/04/08 00:31:27 So we don't hide media controls while manipulating
+ resetHideMediaControlsTimer();
+ }
+
+ if (event->isKeyboardEvent()) {
+ const String& key = toKeyboardEvent(event)->key();
+ if (key == "Enter" || key == " ") {
+ m_playButton->onMediaKeyboardEvent(event);
+ return;
+ }
+ if (key == "ArrowLeft" || key == "ArrowRight") {
+ timelineElement()->onMediaKeyboardEvent(event);
+ return;
+ }
+ if (key == "ArrowDown" || key == "ArrowUp") {
+ volumeSliderElement()->onMediaKeyboardEvent(event);
+ return;
+ }
+ }
}
void MediaControls::hideMediaControlsTimerFired(TimerBase*) {

Powered by Google App Engine
This is Rietveld 408576698