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

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

Issue 2757323002: Prevent Media Controls from hiding when the user is interacting via the keyboard (Closed)
Patch Set: johnme@ feedback and add unit tests 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
Index: third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp
index 070f17b32971c62841984ede8a0b15d1d8086e8d..85896b20dff09d0778686a5be3cfefd38557e378 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControlsMediaEventListener.cpp
@@ -42,6 +42,12 @@ void MediaControlsMediaEventListener::attach() {
textTracks->addEventListener(EventTypeNames::addtrack, this, false);
textTracks->addEventListener(EventTypeNames::change, this, false);
textTracks->addEventListener(EventTypeNames::removetrack, this, false);
+
+ // Keypress events.
+ if (m_mediaControls->panelElement()) {
johnme 2017/04/06 17:15:28 Nit: it doesn't seem possible for this to be null,
mlamouri (slow - plz ping) 2017/04/07 13:21:21 Indeed, we always assume it's available. It should
steimel 2017/04/07 16:47:16 I was getting segfaults before I added this. Didn'
+ m_mediaControls->panelElement()->addEventListener(EventTypeNames::keypress,
+ this, false);
+ }
}
void MediaControlsMediaEventListener::detach() {
@@ -54,6 +60,11 @@ void MediaControlsMediaEventListener::detach() {
textTracks->removeEventListener(EventTypeNames::addtrack, this, false);
textTracks->removeEventListener(EventTypeNames::change, this, false);
textTracks->removeEventListener(EventTypeNames::removetrack, this, false);
+
+ if (m_mediaControls->panelElement()) {
+ m_mediaControls->panelElement()->removeEventListener(
+ EventTypeNames::keypress, this, false);
+ }
}
bool MediaControlsMediaEventListener::operator==(
@@ -122,6 +133,13 @@ void MediaControlsMediaEventListener::handleEvent(
return;
}
+ // Keypress events.
+ if (event->type() == EventTypeNames::keypress) {
+ if (event->currentTarget() == m_mediaControls->panelElement())
+ m_mediaControls->onPanelKeypress();
+ return;
+ }
+
NOTREACHED();
}

Powered by Google App Engine
This is Rietveld 408576698