Commit 7486e938 authored by Jazz Xu's avatar Jazz Xu Committed by Commit Bot

[Media Controls] Fix overflow menu won't close when click mute button.

This CL prevent fullscreen button and mute button in overflow menu from
swallowing event which causes the issue.

Bug: 941451
Change-Id: I0e0dc1203df86b0979110da0d78f24d391ae8efb
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1626398
Commit-Queue: Jazz Xu <jazzhsu@chromium.org>
Reviewed-by: default avatarTommy Steimel <steimel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#663843}
parent 9cbc00de
......@@ -68,6 +68,8 @@ void MediaControlFullscreenButtonElement::DefaultEventHandler(Event& event) {
GetMediaControls().ExitFullscreen();
else
GetMediaControls().EnterFullscreen();
if (!IsOverflowElement())
event.SetDefaultHandled();
}
MediaControlInputElement::DefaultEventHandler(event);
......
......@@ -70,6 +70,8 @@ void MediaControlMuteButtonElement::DefaultEventHandler(Event& event) {
}
MediaElement().setMuted(!MediaElement().muted());
if (!IsOverflowElement())
event.SetDefaultHandled();
}
......
......@@ -3,6 +3,21 @@
<script src='../../resources/testharness.js'></script>
<script src='../../resources/testharnessreport.js'></script>
<script src='../media-controls.js'></script>
<style>
/*
* We need to have the video small enough to have the mute button
* displayed in overflow menu. Meanwhile, we want the video element
* far from edge so that the overflow menu is fully displayed.
*/
video {
width: 150px;
position: absolute;
left: 400px;
top: 400px;
}
</style>
<video controls></video>
<script>
async_test(t => {
......@@ -14,6 +29,12 @@ async_test(t => {
video.onloadeddata = t.step_func(() => {
const menu = overflowMenu(video);
singleTapOnControl(overflowButton(video), t.step_func(() => {
assert_not_equals(getComputedStyle(menu).display, 'none');
singleTapOnControl(muteOverflowItem(video), t.step_func(() => {
assert_equals(getComputedStyle(menu).display, 'none');
singleTapOnControl(overflowButton(video), t.step_func(() => {
assert_not_equals(getComputedStyle(menu).display, 'none');
......@@ -21,6 +42,8 @@ async_test(t => {
assert_equals(getComputedStyle(menu).display, 'none');
}));
}));
}));
}));
});
});
</script>
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