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

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

Issue 892963003: Ensure media control goes to transparent(hide) after seek by touch (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 10 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 bd04ac6ae8d41c0d3a59898d537b5670bfb522cc..57d0d7332aa13034da29eba261dceaa173f23285 100644
--- a/Source/core/html/shadow/MediaControls.cpp
+++ b/Source/core/html/shadow/MediaControls.cpp
@@ -65,6 +65,7 @@ MediaControls::MediaControls(HTMLMediaElement& mediaElement)
, m_durationDisplay(nullptr)
, m_enclosure(nullptr)
, m_hideMediaControlsTimer(this, &MediaControls::hideMediaControlsTimerFired)
+ , m_hideTimerBehaviorFlags(IgnoreNone)
, m_isMouseOverControls(false)
, m_isPausedForScrubbing(false)
, m_wasLastEventTouch(false)
@@ -441,6 +442,12 @@ void MediaControls::defaultEventHandler(Event* event)
m_wasLastEventTouch = event->isTouchEvent() || event->isGestureEvent()
|| (event->isMouseEvent() && toMouseEvent(event)->fromTouch());
+ // Add IgnoreControlsHover to m_hideTimerBehaviorFlags when we see a touch event,
+ // to allow the hide-timer to do the right thing when it fires.
+ // FIXME: Preferably we would only do this when we're actually handling the event
+ // here ourselves.
+ m_hideTimerBehaviorFlags |= m_wasLastEventTouch ? IgnoreControlsHover : IgnoreNone;
+
if (event->type() == EventTypeNames::mouseover) {
if (!containsRelatedTarget(event)) {
m_isMouseOverControls = true;
@@ -474,13 +481,12 @@ void MediaControls::defaultEventHandler(Event* event)
void MediaControls::hideMediaControlsTimerFired(Timer<MediaControls>*)
{
+ unsigned behaviorFlags = m_hideTimerBehaviorFlags | IgnoreFocus | IgnoreVideoHover;
+ m_hideTimerBehaviorFlags = IgnoreNone;
+
if (mediaElement().togglePlayStateWillPlay())
return;
- unsigned behaviorFlags = IgnoreFocus | IgnoreVideoHover;
- if (m_wasLastEventTouch) {
- behaviorFlags |= IgnoreControlsHover;
- }
if (!shouldHideMediaControls(behaviorFlags))
return;
« 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