Index: Source/core/html/shadow/MediaControls.cpp |
diff --git a/Source/core/html/shadow/MediaControls.cpp b/Source/core/html/shadow/MediaControls.cpp |
index 05c56e8d88923dcd665c1f2f32c593d620b9cc69..017229b9bdb51295ceb052ec597c5ec7836a1d36 100644 |
--- a/Source/core/html/shadow/MediaControls.cpp |
+++ b/Source/core/html/shadow/MediaControls.cpp |
@@ -191,6 +191,12 @@ void MediaControls::show() |
m_panel->show(); |
} |
+void MediaControls::mediaElementFocused() |
+{ |
+ show(); |
+ stopHideMediaControlsTimer(); |
+} |
+ |
void MediaControls::hide() |
{ |
m_panel->setIsDisplayed(false); |
@@ -207,9 +213,20 @@ void MediaControls::makeTransparent() |
m_panel->makeTransparent(); |
} |
-bool MediaControls::shouldHideMediaControls() |
+bool MediaControls::shouldHideMediaControls(HideBehavior behavior) const |
{ |
- return !m_panel->hovered(); |
+ // Never hide for <audio>. |
philipj_slow
2014/05/23 13:22:43
The comment doesn't quite match the code. isHTMLAu
fs
2014/05/23 14:39:30
Will change to something more long-winded about "v
|
+ if (!mediaElement().hasVideo()) |
+ return false; |
+ // Don't hide if hovered or the mouse is over the controls. |
+ if (m_panel->hovered() || m_isMouseOverControls) |
philipj_slow
2014/05/23 13:22:43
Almost completely off topic: When I've seen m_isMo
fs
2014/05/23 14:39:30
Yes... Personally I'm more worried that this is to
|
+ return false; |
+ // Don't hide if focus is on the HTMLMediaElement or within the |
+ // controls/shadow tree. (Perform the checks separately to avoid going |
philipj_slow
2014/05/23 13:22:43
I feel like this comment should make me understand
fs
2014/05/23 14:39:30
contains(...) will not cross into the shadow tree.
philipj_slow
2014/05/23 20:08:34
Ah, that's what I overlooked, thanks! The comment
|
+ // through all the potential ancestor hosts for the focused element.) |
+ if (behavior != IgnoreFocus && (mediaElement().focused() || contains(document().focusedElement()))) |
+ return false; |
+ return true; |
} |
void MediaControls::playbackStarted() |
@@ -229,7 +246,7 @@ void MediaControls::playbackProgressed() |
m_timeline->setPosition(mediaElement().currentTime()); |
updateCurrentTimeDisplay(); |
- if (!m_isMouseOverControls && mediaElement().hasVideo()) |
+ if (shouldHideMediaControls()) |
makeTransparent(); |
} |
@@ -369,7 +386,7 @@ void MediaControls::hideMediaControlsTimerFired(Timer<MediaControls>*) |
if (mediaElement().togglePlayStateWillPlay()) |
return; |
- if (!shouldHideMediaControls()) |
+ if (!shouldHideMediaControls(IgnoreFocus)) |
acolwell GONE FROM CHROMIUM
2014/05/22 18:44:09
What is the situation where we would want the cont
fs
2014/05/23 07:05:40
The case where I found this a useful behavior was
|
return; |
makeTransparent(); |