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

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

Issue 297783004: Implement heuristic for showing media controls during playback w/o a mouse (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 7 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 | « Source/core/html/shadow/MediaControls.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/shadow/MediaControls.cpp
diff --git a/Source/core/html/shadow/MediaControls.cpp b/Source/core/html/shadow/MediaControls.cpp
index 1b1a234275e528d7ea759827b70eb757ce30ff7e..4a4e3cd2a197cd0d34bd7c3bdd0342a8fea0b398 100644
--- a/Source/core/html/shadow/MediaControls.cpp
+++ b/Source/core/html/shadow/MediaControls.cpp
@@ -191,6 +191,11 @@ void MediaControls::show()
m_panel->show();
}
+void MediaControls::mediaElementFocused()
+{
+ show();
acolwell GONE FROM CHROMIUM 2014/05/22 00:31:17 Should we have a stopHideMediaControlsTimer() call
fs 2014/05/22 15:48:45 Probably makes sense. Added.
+}
+
void MediaControls::hide()
{
m_panel->setIsDisplayed(false);
@@ -212,6 +217,16 @@ bool MediaControls::shouldHideMediaControls()
return !m_panel->hovered();
}
+bool MediaControls::shouldShowMediaControls() const
+{
+ if (m_isMouseOverControls)
+ return true;
+ // Check for 'focus' on the HTMLMediaElement and within the controls/shadow
+ // tree separately (to avoid going through all the potential ancestor hosts
+ // for the focused element.)
+ return mediaElement().focused() || contains(document().focusedElement());
+}
+
void MediaControls::playbackStarted()
{
m_currentTimeDisplay->show();
@@ -229,7 +244,7 @@ void MediaControls::playbackProgressed()
m_timeline->setPosition(mediaElement().currentTime());
updateCurrentTimeDisplay();
- if (!m_isMouseOverControls && mediaElement().hasVideo())
+ if (mediaElement().hasVideo() && !shouldShowMediaControls())
acolwell GONE FROM CHROMIUM 2014/05/22 00:31:17 !shouldShowMediaControls() conceptually seems like
fs 2014/05/22 15:48:45 I integrated should_Show_MediaControls in should_H
makeTransparent();
}
« no previous file with comments | « Source/core/html/shadow/MediaControls.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698