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

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

Issue 441193003: Hide video controls after touch when hideMediaControlsTimerFired fires. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: /s/TODO/FIXME Created 6 years, 4 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 8e65d275d32aae675e97f5050b16f13c429948fc..5b521ce71d70c41027545b52b1a4ee1b72762158 100644
--- a/Source/core/html/shadow/MediaControls.cpp
+++ b/Source/core/html/shadow/MediaControls.cpp
@@ -45,6 +45,11 @@ static bool fullscreenIsSupported(const Document& document)
return !document.settings() || document.settings()->fullscreenSupported();
}
+static bool deviceSupportsMouse(const Document& document)
+{
+ return !document.settings() || document.settings()->deviceSupportsMouse();
+}
+
MediaControls::MediaControls(HTMLMediaElement& mediaElement)
: HTMLDivElement(mediaElement.document())
, m_mediaElement(&mediaElement)
@@ -229,9 +234,13 @@ bool MediaControls::shouldHideMediaControls(unsigned behaviorFlags) const
// Never hide for a media element without visual representation.
if (!mediaElement().hasVideo())
return false;
- // Don't hide if the controls are hovered or the mouse is over the video area.
+ // Don't hide if the mouse is over the controls.
+ const bool ignoreControlsHover = behaviorFlags & IgnoreControlsHover;
+ if (!ignoreControlsHover && m_panel->hovered())
+ return false;
+ // Don't hide if the mouse is over the video area.
const bool ignoreVideoHover = behaviorFlags & IgnoreVideoHover;
- if (m_panel->hovered() || (!ignoreVideoHover && m_isMouseOverControls))
+ if (!ignoreVideoHover && m_isMouseOverControls)
return false;
// Don't hide if focus is on the HTMLMediaElement or within the
// controls/shadow tree. (Perform the checks separately to avoid going
@@ -399,7 +408,12 @@ void MediaControls::hideMediaControlsTimerFired(Timer<MediaControls>*)
if (mediaElement().togglePlayStateWillPlay())
return;
- if (!shouldHideMediaControls(IgnoreFocus | IgnoreVideoHover))
+ unsigned behaviorFlags = IgnoreFocus | IgnoreVideoHover;
+ // FIXME: improve this check, see http://www.crbug.com/401177.
+ if (!deviceSupportsMouse(document())) {
+ behaviorFlags |= IgnoreControlsHover;
+ }
+ if (!shouldHideMediaControls(behaviorFlags))
return;
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