[Webkit-unassigned] [Bug 31135] New: Volume slider doesn't have a thumb

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Nov 4 11:46:57 PST 2009


https://bugs.webkit.org/show_bug.cgi?id=31135

           Summary: Volume slider doesn't have a thumb
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: PC
        OS/Version: Mac OS X 10.5
            Status: NEW
          Severity: Normal
          Priority: P2
         Component: Media Elements
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: hclam at google.com


Using the latest Chromium port, if you mouse over the mute button, the volume
slider pops up but it doesn't has a thumb. When you mouse over the slider track
there will be a crash.

The reason being that in WebCore/rendering/MediaControlElements.cpp:

void MediaControlVolumeSliderElement::update()
{
    float volume = m_mediaElement->volume();
    if (value().toFloat() != volume) {
        setValue(String::number(volume));
        MediaControlInputElement::update();
    }
}

We don't call MediaControlInputElement::update() which creates the thumb in
RenderSlider if the current value of the slider equals the volume. This
statement is wrong, because just when a RenderMedia is created, it sets the
slider value using its current volume value. So value().toFloat() will always
equals to volume when update() is called.

We can force an update just when we call
MediaCotnrolVolumeSliderElement::update() during creation of the element, so
the if statement would look like  "if (forceUpdate || value().toFloat() !=
volume)" but the thumb will disappear when we drag it. This is because of
MediaControlVolumeSliderElement::defaultEventHandler():

void MediaControlVolumeSliderElement::defaultEventHandler(Event* event)
{
    // Left button is 0. Rejects mouse events not from left button.
    if (event->isMouseEvent() && static_cast<MouseEvent*>(event)->button())
        return;

    MediaControlInputElement::defaultEventHandler(event);

    if (event->type() == eventNames().mouseoverEvent || event->type() ==
eventNames().mouseoutEvent || event->type() == eventNames().mousemoveEvent)
        return;

    float volume = narrowPrecisionToFloat(value().toDouble());
    if (volume != m_mediaElement->volume()) {
        ExceptionCode ec = 0;
        m_mediaElement->setVolume(volume, ec);
        ASSERT(!ec);
    }
}

We sets the volume of the media element when a mouse event is received, this
triggers MediaControlInputElement::update() from RenderMedia::updateControls().
And again, the slider value is the same as the volume so the RenderSlider is
never updated.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list