Index: third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
index 9156bba583b6c602b3a8cc84b4db479d0b50a85d..4d89681c04bc37acc4956991ca3315423b0a40bd 100644 |
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.cpp |
@@ -26,6 +26,7 @@ |
#include "core/html/HTMLMediaElement.h" |
+#include <limits> |
#include "bindings/core/v8/ExceptionState.h" |
#include "bindings/core/v8/Microtask.h" |
#include "bindings/core/v8/ScriptController.h" |
@@ -41,6 +42,7 @@ |
#include "core/dom/TaskRunnerHelper.h" |
#include "core/dom/shadow/ShadowRoot.h" |
#include "core/events/Event.h" |
+#include "core/events/KeyboardEvent.h" |
#include "core/frame/FrameView.h" |
#include "core/frame/LocalFrame.h" |
#include "core/frame/Settings.h" |
@@ -84,6 +86,7 @@ |
#include "platform/network/mime/MIMETypeFromURL.h" |
#include "platform/weborigin/SecurityOrigin.h" |
#include "public/platform/Platform.h" |
+#include "public/platform/UserMetricsAction.h" |
#include "public/platform/WebAudioSourceProvider.h" |
#include "public/platform/WebContentDecryptionModule.h" |
#include "public/platform/WebInbandTextTrack.h" |
@@ -97,7 +100,6 @@ |
#include "wtf/MathExtras.h" |
#include "wtf/PtrUtil.h" |
#include "wtf/text/CString.h" |
-#include <limits> |
#ifndef BLINK_MEDIA_LOG |
#define BLINK_MEDIA_LOG DVLOG(3) |
@@ -3642,6 +3644,31 @@ void HTMLMediaElement::ensureMediaControls() { |
assertShadowRootChildren(shadowRoot); |
} |
+void HTMLMediaElement::defaultEventHandler(Event* event) { |
+ if (isFocusedElementInDocument()) { |
+ if (event->isKeyboardEvent()) { |
+ int key = toKeyboardEvent(event)->keyCode(); |
+ switch (key) { |
+ case ('\r'): |
+ case (' '): |
+ togglePlayState(); |
+ return; |
+ case (37): |
+ case (39): |
+ m_mediaControls->timelineElement()->defaultEventHandler(event); |
+ m_mediaControls->startHideMediaControlsTimer(); |
+ return; |
+ case (38): |
+ case (40): |
+ m_mediaControls->volumeSliderElement()->defaultEventHandler(event); |
+ m_mediaControls->startHideMediaControlsTimer(); |
+ return; |
+ } |
+ } |
+ } |
+ HTMLElement::defaultEventHandler(event); |
+} |
+ |
void HTMLMediaElement::updateControlsVisibility() { |
if (!isConnected()) { |
if (mediaControls()) |