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,7 +68,9 @@ void MediaControlFullscreenButtonElement::DefaultEventHandler(Event& event) {
GetMediaControls().ExitFullscreen();
else
GetMediaControls().EnterFullscreen();
event.SetDefaultHandled();
if (!IsOverflowElement())
event.SetDefaultHandled();
}
MediaControlInputElement::DefaultEventHandler(event);
}
......
......@@ -70,7 +70,9 @@ void MediaControlMuteButtonElement::DefaultEventHandler(Event& event) {
}
MediaElement().setMuted(!MediaElement().muted());
event.SetDefaultHandled();
if (!IsOverflowElement())
event.SetDefaultHandled();
}
if (!IsOverflowElement()) {
......
......@@ -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 => {
......@@ -17,8 +32,16 @@ async_test(t => {
singleTapOnControl(overflowButton(video), t.step_func(() => {
assert_not_equals(getComputedStyle(menu).display, 'none');
singleTapOnControl(captionsOverflowItem(video), t.step_func_done(() => {
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');
singleTapOnControl(captionsOverflowItem(video), t.step_func_done(() => {
assert_equals(getComputedStyle(menu).display, 'none');
}));
}));
}));
}));
});
......
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