Commit 2483711d authored by watk@chromium.org's avatar watk@chromium.org

Don't show media controls on focus if 'controls' is not set.

Previously when an HTMLMediaElement received focus, the media controls
would be shown regardless of whether 'controls' was set.
It's possible for an HTMLMediaElement to receive focus despite not having
'controls' set, if it has a 'tabindex'.

BUG=424625

Review URL: https://codereview.chromium.org/692643002

git-svn-id: svn://svn.chromium.org/blink/trunk@184803 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent de222b0f
Test that video controls don't appear when the media (<video>) element is focused and the 'controls' attribute is not set.
EXPECTED (getComputedStyle(controls).opacity == '0') OK
END OF TEST
<!DOCTYPE html>
<html>
<title>Test visibiblity of controls when focusing of &lt;video></title>
<script src=video-test.js></script>
<script src=media-controls.js></script>
<p>
Test that video controls don't appear when the media (&lt;video>) element is
focused and the 'controls' attribute is not set.
</p>
<!-- 'tabindex' makes the video focusable despite it not having controls -->
<video tabindex="0" autoplay src="content/test.ogv"></video>
<script>
var controls;
var video = document.querySelector("video");
video.addEventListener("playing", function()
{
runAfterHideMediaControlsTimerFired(function()
{
controls = mediaControlsButton(video, "panel");
video.focus();
testExpected("getComputedStyle(controls).opacity", 0);
endTest();
}, video);
});
</script>
......@@ -220,8 +220,10 @@ void MediaControls::show()
void MediaControls::mediaElementFocused()
{
show();
resetHideMediaControlsTimer();
if (mediaElement().shouldShowControls()) {
show();
resetHideMediaControlsTimer();
}
}
void MediaControls::hide()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment