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

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

Issue 2700663002: Adds keyboard functionality for videos. (Closed)
Patch Set: Addresses mlamouri's #11 comment. 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..dcce3bdcff06bb7e17031912565277e840bd8509 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,31 @@ void MediaControls::defaultEventHandler(Event* event) {
startHideMediaControlsTimer();
return;
}
+
+ if (event->isKeyboardEvent()) {
+ if (!mediaElement().paused()) {
+ makeOpaque();
+ if (shouldHideMediaControls())
+ startHideMediaControlsTimer();
+ }
+
+ int key = toKeyboardEvent(event)->keyCode();
+ switch (key) {
+ case ('\r'):
+ case (' '):
+ m_playButton->defaultEventHandler(event);
+ return;
+ case (37):
+ case (39):
+ timelineElement()->defaultEventHandler(event);
+ onTimeUpdate();
mlamouri (slow - plz ping) 2017/03/16 12:17:22 Shouldn't this be called automatically?
CJ 2017/03/16 20:08:28 Didn't seem to work without it. Will double check.
+ return;
+ case (38):
+ case (40):
+ volumeSliderElement()->defaultEventHandler(event);
mlamouri (slow - plz ping) 2017/03/16 12:17:22 For the issue you mention, is onVolueChange called
CJ 2017/03/16 20:08:28 I tried that. Instead of refreshing the blue line
+ return;
+ }
+ }
}
void MediaControls::hideMediaControlsTimerFired(TimerBase*) {
@@ -806,6 +832,7 @@ void MediaControls::onVolumeChange() {
m_volumeSlider->setIsWanted(mediaElement().hasAudio() &&
!preferHiddenVolumeControls(document()));
m_muteButton->setIsWanted(mediaElement().hasAudio());
+ startHideMediaControlsTimer();
mlamouri (slow - plz ping) 2017/03/16 12:17:22 Why are you hiding this?
CJ 2017/03/16 20:08:28 Not sure why that is there. Removing.
}
void MediaControls::onFocusIn() {

Powered by Google App Engine
This is Rietveld 408576698