Skip to content
Permalink
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
calvaris committed Sep 1, 2013
1 parent c69b5ad commit a69180eba0695faeb824c49d9dd8fc94ab9a5e12
@@ -1,3 +1,16 @@
2013-09-01 Xabier Rodriguez Calvar <calvaris@igalia.com>

Volume slider value should be 0 when audio is muted
https://bugs.webkit.org/show_bug.cgi?id=120553

Reviewed by Eric Carlson.

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.

2013-09-01 Joseph Pecoraro <pecoraro@apple.com>

Web Inspector: A little more test cleanup
@@ -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

@@ -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>
@@ -1,3 +1,32 @@
2013-09-01 Xabier Rodriguez Calvar <calvaris@igalia.com>

Volume slider value should be 0 when audio is muted
https://bugs.webkit.org/show_bug.cgi?id=120553

Reviewed by Eric Carlson.

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.

2013-09-01 Andreas Kling <akling@apple.com>

Give EditCommand a protected Frame& getter.
@@ -108,7 +108,7 @@ void MediaControls::reset()
m_volumeSlider->hide();
else {
m_volumeSlider->show();
m_volumeSlider->setVolume(m_mediaController->volume());
setSliderVolume();
}
}

@@ -240,7 +240,7 @@ void MediaControls::changedMute()
void MediaControls::changedVolume()
{
if (m_volumeSlider)
m_volumeSlider->setVolume(m_mediaController->volume());
setSliderVolume();
if (m_panelMuteButton && m_panelMuteButton->renderer())
m_panelMuteButton->renderer()->repaint();
}
@@ -425,6 +425,11 @@ void MediaControls::textTrackPreferencesChanged()
}
#endif

void MediaControls::setSliderVolume()
{
m_volumeSlider->setVolume(m_mediaController->muted() ? 0.0 : m_mediaController->volume());
}

}

#endif
@@ -114,6 +114,8 @@ class MediaControls : public HTMLDivElement {

virtual bool containsRelatedTarget(Event*);

void setSliderVolume();

MediaControllerInterface* m_mediaController;

// Container for the media control elements.
@@ -340,7 +340,7 @@ void MediaControlsApple::reset()
m_panelMuteButton->hide();

if (m_volumeSlider)
m_volumeSlider->setVolume(m_mediaController->volume());
setSliderVolume();

if (m_toggleClosedCaptionsButton) {
if (m_mediaController->hasClosedCaptions())
@@ -354,7 +354,7 @@ void MediaControlsApple::reset()

#if ENABLE(FULLSCREEN_API)
if (m_fullScreenVolumeSlider)
m_fullScreenVolumeSlider->setVolume(m_mediaController->volume());
setFullscreenSliderVolume();

if (m_isFullscreen) {
if (m_mediaController->isLiveStream()) {
@@ -446,7 +446,7 @@ void MediaControlsApple::changedVolume()
MediaControls::changedVolume();

if (m_fullScreenVolumeSlider)
m_fullScreenVolumeSlider->setVolume(m_mediaController->volume());
setFullscreenSliderVolume();
}

void MediaControlsApple::enteredFullscreen()
@@ -549,6 +549,11 @@ void MediaControlsApple::hideClosedCaptionTrackList()
removeEventListener(eventNames().clickEvent, listener, true);
}

void MediaControlsApple::setFullscreenSliderVolume()
{
m_fullScreenVolumeSlider->setVolume(m_mediaController->muted() ? 0.0 : m_mediaController->volume());
}

bool MediaControlsApple::shouldClosedCaptionsContainerPreventPageScrolling(int wheelDeltaY)
{
int scrollTop = m_closedCaptionsContainer->scrollTop();
@@ -99,6 +99,7 @@ class MediaControlsApple : public MediaControls {

void showClosedCaptionTrackList();
void hideClosedCaptionTrackList();
void setFullscreenSliderVolume();

MediaControlRewindButtonElement* m_rewindButton;
MediaControlReturnToRealtimeButtonElement* m_returnToRealTimeButton;
@@ -931,7 +931,7 @@ void MediaControlsBlackBerry::reset()
m_muteButton->hide();

if (m_volumeSlider)
m_volumeSlider->setVolume(m_mediaController->volume());
setSliderVolume();

if (m_toggleClosedCaptionsButton) {
if (m_mediaController->hasClosedCaptions())

0 comments on commit a69180e

Please sign in to comment.