Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Volume slider value should be 0 when audio is muted
https://bugs.webkit.org/show_bug.cgi?id=120553 Reviewed by Eric Carlson. Source/WebCore: Fixed the problem of showing a non empty slider when audio is muted. Test: media/volume-bar-empty-when-muted.html. * html/shadow/MediaControls.cpp: (WebCore::MediaControls::reset): Use setSliderVolume. (WebCore::MediaControls::changedVolume): Use setSliderVolume. (WebCore::MediaControls::setSliderVolume): Added to set the volume to 0 when muted and to its value otherwise. * html/shadow/MediaControls.h: Added setSliderVolume. * html/shadow/MediaControlsApple.cpp: (WebCore::MediaControlsApple::reset): Used setSliderVolume and setFullscreenSliderVolume. (WebCore::MediaControlsApple::changedVolume): Used setFullscreenSliderVolume. (WebCore::MediaControlsApple::setFullscreenSliderVolume): Added to set the volume to 0 when muted and to its value otherwise. * html/shadow/MediaControlsApple.h: Added setFullscreenSliderVolume * html/shadow/MediaControlsBlackBerry.cpp: (WebCore::MediaControlsBlackBerry::reset): Used setSliderVolume. LayoutTests: Added test to check if the volume slider value is 0 when the element is muted even if volume is set to something else. * media/volume-bar-empty-when-muted-expected.txt: Added. * media/volume-bar-empty-when-muted.html: Added. Canonical link: https://commits.webkit.org/138570@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154944 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
with
118 additions
and 6 deletions.
- +13 −0 LayoutTests/ChangeLog
- +7 −0 LayoutTests/media/volume-bar-empty-when-muted-expected.txt
- +50 −0 LayoutTests/media/volume-bar-empty-when-muted.html
- +29 −0 Source/WebCore/ChangeLog
- +7 −2 Source/WebCore/html/shadow/MediaControls.cpp
- +2 −0 Source/WebCore/html/shadow/MediaControls.h
- +8 −3 Source/WebCore/html/shadow/MediaControlsApple.cpp
- +1 −0 Source/WebCore/html/shadow/MediaControlsApple.h
- +1 −1 Source/WebCore/html/shadow/MediaControlsBlackBerry.cpp
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,7 @@ | ||
Tests if the volume slider thumb is rendered properly when the volume is uninitialized but media is muted. | ||
|
||
EXPECTED (video.volume == '1') OK | ||
EXPECTED (video.muted == 'true') OK | ||
EXPECTED (volumeSlider.value == '0') OK | ||
END OF TEST | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,50 @@ | ||
<html> | ||
<head> | ||
<title>Test rendering of volume slider of video tag</title> | ||
<script src=media-file.js></script> | ||
<script src=media-controls.js></script> | ||
<script src=video-test.js></script> | ||
<script> | ||
var video; | ||
var volumeSliderTrackDimensions; | ||
|
||
function init() | ||
{ | ||
if (window.testRunner) | ||
testRunner.waitUntilDone(); | ||
|
||
video = document.getElementsByTagName("video")[0]; | ||
video.src = findMediaFile("video", "content/test"); | ||
} | ||
|
||
function test() | ||
{ | ||
if (!window.eventSender) { | ||
consoleWrite("ERROR: no event sender."); | ||
failTest(); | ||
} | ||
|
||
var muteButtonCoordinates; | ||
|
||
muteButtonCoordinates = mediaControlsButtonCoordinates(video, "mute-button"); | ||
eventSender.mouseMoveTo(muteButtonCoordinates[0], muteButtonCoordinates[1]); | ||
|
||
// Forcing relayout calculations to say that you are | ||
// triggering the volume slider to show up for | ||
// controls that work that way. | ||
document.body.offsetTop; | ||
|
||
volumeSlider = mediaControlsElement(internals.shadowRoot(video).firstChild, "-webkit-media-controls-volume-slider"); | ||
testExpected("video.volume", 1); | ||
testExpected("video.muted", true); | ||
testExpected("volumeSlider.value", 0); | ||
endTest(); | ||
} | ||
</script> | ||
</head> | ||
<body onload="init()"> | ||
<p>Tests if the volume slider thumb is rendered properly when the | ||
volume is uninitialized but media is muted.</p> | ||
<video oncanplaythrough="test()" controls muted></video> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -931,7 +931,7 @@ void MediaControlsBlackBerry::reset() | ||
m_muteButton->hide(); | ||
|
||
if (m_volumeSlider) | ||
setSliderVolume(); | ||
|
||
if (m_toggleClosedCaptionsButton) { | ||
if (m_mediaController->hasClosedCaptions()) | ||