Chromium Code Reviews| 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..e3974a51795db0fd7bb6446e862d3fdaf871e4a3 100644 |
| --- a/Source/core/html/shadow/MediaControls.cpp |
| +++ b/Source/core/html/shadow/MediaControls.cpp |
| @@ -65,9 +65,9 @@ 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) |
| { |
| } |
| @@ -438,9 +438,13 @@ void MediaControls::stoppedCasting() |
| void MediaControls::defaultEventHandler(Event* event) |
| { |
| HTMLDivElement::defaultEventHandler(event); |
| - m_wasLastEventTouch = event->isTouchEvent() || event->isGestureEvent() |
| + bool wasLastEventTouch = event->isTouchEvent() || event->isGestureEvent() |
| || (event->isMouseEvent() && toMouseEvent(event)->fromTouch()); |
| + if (wasLastEventTouch) { |
| + startHideMediaControlsTimer(IgnoreControlsHover); |
|
fs
2015/02/06 15:20:59
unsigned hideBehavior = wasLastEventTouch ? Ignore
william.xie1
2015/02/06 15:45:10
Currently we need to invoke startHideMediaControls
fs
2015/02/06 16:01:59
This could end up starting the timer regardless of
|
| + } |
| + |
| if (event->type() == EventTypeNames::mouseover) { |
| if (!containsRelatedTarget(event)) { |
| m_isMouseOverControls = true; |
| @@ -477,10 +481,7 @@ void MediaControls::hideMediaControlsTimerFired(Timer<MediaControls>*) |
| if (mediaElement().togglePlayStateWillPlay()) |
| return; |
| - unsigned behaviorFlags = IgnoreFocus | IgnoreVideoHover; |
| - if (m_wasLastEventTouch) { |
| - behaviorFlags |= IgnoreControlsHover; |
| - } |
| + unsigned behaviorFlags = m_hideTimerBehaviorFlags | IgnoreFocus | IgnoreVideoHover; |
| if (!shouldHideMediaControls(behaviorFlags)) |
| return; |
| @@ -488,14 +489,16 @@ void MediaControls::hideMediaControlsTimerFired(Timer<MediaControls>*) |
| m_overlayCastButton->hide(); |
| } |
| -void MediaControls::startHideMediaControlsTimer() |
| +void MediaControls::startHideMediaControlsTimer(unsigned behaviorFlags) |
| { |
| + m_hideTimerBehaviorFlags |= behaviorFlags; |
|
fs
2015/02/06 15:20:59
This ought to be a simple assignment.
william.xie1
2015/02/06 15:45:10
You know, startHideMediaControlsTimer is also call
fs
2015/02/06 16:01:59
Ah ok. But that means that the stored flags need t
|
| m_hideMediaControlsTimer.startOneShot(timeWithoutMouseMovementBeforeHidingMediaControls, FROM_HERE); |
| } |
| void MediaControls::stopHideMediaControlsTimer() |
| { |
| m_hideMediaControlsTimer.stop(); |
| + m_hideTimerBehaviorFlags = IgnoreNone; |
| } |
| void MediaControls::resetHideMediaControlsTimer() |