[go: nahoru, domu]

[Media Controls] Prevent flicker when enter/exit fullscreen

Previously, entering/exiting fullscreen whilst the media controls are
hidden due to inactivity would cause the media controls to briefly show
then almost immediately hide again, resulting in an ugly flicker.

They were shown by HTMLMediaElement::UpdateControlsVisibility (called
from HTMLMediaElement::Did{Enter,Exit}Fullscreen) and then hidden again
by MediaControlsImpl::OnTimeUpdate since ShouldHideMediaControls()
returns true.

(This was often masked by the fact that clicking the fullscreen button
with a mouse results in the mouse hovering over the media controls at
the start of the fullscreen transition, in which case it's ok to show
the media controls. It became particularly noticeable with the recent
video-rotate-to-fullscreen feature, which enters/exits fullscreen
without interacting with the media controls, but it can be reproduced
without that feature as well).

This patch renames MediaControls::Show to MaybeShow and makes it only
show the controls if they won't soon be hidden again.

BUG=717520
NOPRESUBMIT=true

Review-Url: https://codereview.chromium.org/2873493004
Cr-Commit-Position: refs/heads/master@{#472180}
10 files changed