Commit b8565b2d authored by eric@webkit.org's avatar eric@webkit.org

2009-08-25 Alpha Lam <hclam@chromium.org>

        Reviewed by David Levin.

        [chromium] Implement media volume slider for chromium
        https://bugs.webkit.org/show_bug.cgi?id=28715

        Provided the implementation of the volume slider and its container for
        chromium port. With this change there will be a usable volume control
        slider for chromium theme.

        No new tests since this is covered by existing media layout tests.

        * css/mediaControlsChromium.css: CSS style for the volume slider.
        * rendering/RenderThemeChromiumSkia.cpp:
        (WebCore::mediaSliderThumbImage): Returns the image for slider thumb.
        (WebCore::mediaVolumeSliderThumbImage): Returns the image for volume slider thumb.
        (WebCore::RenderThemeChromiumSkia::paintMediaVolumeSliderTrack): Paints the track with one vertical white line.
        (WebCore::RenderThemeChromiumSkia::adjustSliderThumbSize): Adjusts thumb sizes according to the images.
        (WebCore::RenderThemeChromiumSkia::paintMediaSliderThumb): Paints slider thumb image.
        (WebCore::RenderThemeChromiumSkia::paintMediaVolumeSliderThumb): Paints volume slider thumb image.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@47756 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 02c5c7d5
2009-08-25 Alpha Lam <hclam@chromium.org>
Reviewed by David Levin.
[chromium] Implement media volume slider for chromium
https://bugs.webkit.org/show_bug.cgi?id=28715
Provided the implementation of the volume slider and its container for
chromium port. With this change there will be a usable volume control
slider for chromium theme.
No new tests since this is covered by existing media layout tests.
* css/mediaControlsChromium.css: CSS style for the volume slider.
* rendering/RenderThemeChromiumSkia.cpp:
(WebCore::mediaSliderThumbImage): Returns the image for slider thumb.
(WebCore::mediaVolumeSliderThumbImage): Returns the image for volume slider thumb.
(WebCore::RenderThemeChromiumSkia::paintMediaVolumeSliderTrack): Paints the track with one vertical white line.
(WebCore::RenderThemeChromiumSkia::adjustSliderThumbSize): Adjusts thumb sizes according to the images.
(WebCore::RenderThemeChromiumSkia::paintMediaSliderThumb): Paints slider thumb image.
(WebCore::RenderThemeChromiumSkia::paintMediaVolumeSliderThumb): Paints volume slider thumb image.
2009-08-25 Chris Marrin <cmarrin@apple.com>
Reviewed by Simon Fraser.
......@@ -33,6 +33,7 @@ audio {
audio::-webkit-media-controls-panel, video::-webkit-media-controls-panel {
-webkit-user-select: none;
position: absolute;
overflow: visible;
bottom: 0;
width: 100%;
height: 32px;
......@@ -46,7 +47,6 @@ video:-webkit-full-page-media::-webkit-media-controls-panel {
audio::-webkit-media-controls-mute-button, video::-webkit-media-controls-mute-button {
-webkit-appearance: media-mute-button;
position: absolute;
top: auto;
bottom: 0;
......@@ -167,3 +167,25 @@ audio::-webkit-media-controls-fullscreen-button, video::-webkit-media-controls-f
-webkit-appearance: media-fullscreen-button;
display: none;
}
audio::-webkit-media-controls-volume-slider-container, video::-webkit-media-controls-volume-slider-container {
-webkit-appearance: media-volume-slider-container;
position: absolute;
width: 34px;
height: 100px;
background-color: rgba(0, 0, 0, 0.6);
}
audio::-webkit-media-controls-volume-slider, video::-webkit-media-controls-volume-slider {
-webkit-appearance: media-volume-slider;
display: inline;
position: absolute;
top: 10px;
left: 12px;
width: 10px;
height: 80px;
}
......@@ -571,14 +571,52 @@ bool RenderThemeChromiumSkia::paintMediaSliderTrack(RenderObject* object, const
#endif
}
void RenderThemeChromiumSkia::adjustSliderThumbSize(RenderObject* object) const {
bool RenderThemeChromiumSkia::paintMediaVolumeSliderTrack(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
{
#if ENABLE(VIDEO)
if (object->style()->appearance() == MediaSliderThumbPart) {
static Image* mediaSliderThumb = Image::loadPlatformResource("mediaSliderThumb").releaseRef();
HTMLMediaElement* mediaElement = mediaElementParent(object->node());
if (!mediaElement)
return false;
object->style()->setWidth(Length(mediaSliderThumb->width(), Fixed));
object->style()->setHeight(Length(mediaSliderThumb->height(), Fixed));
}
SkCanvas* canvas = paintInfo.context->platformContext()->canvas();
SkPaint paint;
paint.setARGB(0xff, 0xff, 0xff, 0xff);
int x = rect.x() + rect.width() / 2;
canvas->drawLine(x, rect.y(), x, rect.y() + rect.height(), paint);
return true;
#else
UNUSED_PARAM(object);
UNUSED_PARAM(paintInfo);
UNUSED_PARAM(rect);
return false;
#endif
}
static Image* mediaSliderThumbImage()
{
static Image* mediaSliderThumb = Image::loadPlatformResource("mediaSliderThumb").releaseRef();
return mediaSliderThumb;
}
static Image* mediaVolumeSliderThumbImage()
{
static Image* mediaVolumeSliderThumb = Image::loadPlatformResource("mediaVolumeSliderThumb").releaseRef();
return mediaVolumeSliderThumb;
}
void RenderThemeChromiumSkia::adjustSliderThumbSize(RenderObject* object) const
{
#if ENABLE(VIDEO)
Image* thumbImage = 0;
if (object->style()->appearance() == MediaSliderThumbPart)
thumbImage = mediaSliderThumbImage();
else if (object->style()->appearance() == MediaVolumeSliderThumbPart)
thumbImage = mediaVolumeSliderThumbImage();
ASSERT(thumbImage);
object->style()->setWidth(Length(thumbImage->width(), Fixed));
object->style()->setHeight(Length(thumbImage->height(), Fixed));
#else
UNUSED_PARAM(object);
#endif
......@@ -590,9 +628,22 @@ bool RenderThemeChromiumSkia::paintMediaSliderThumb(RenderObject* object, const
if (!object->parent()->isSlider())
return false;
static Image* mediaSliderThumb = Image::loadPlatformResource("mediaSliderThumb").releaseRef();
return paintMediaButtonInternal(paintInfo.context, rect, mediaSliderThumbImage());
#else
UNUSED_PARAM(object);
UNUSED_PARAM(paintInfo);
UNUSED_PARAM(rect);
return false;
#endif
}
bool RenderThemeChromiumSkia::paintMediaVolumeSliderThumb(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
{
#if ENABLE(VIDEO)
if (!object->parent()->isSlider())
return false;
return paintMediaButtonInternal(paintInfo.context, rect, mediaSliderThumb);
return paintMediaButtonInternal(paintInfo.context, rect, mediaVolumeSliderThumbImage());
#else
UNUSED_PARAM(object);
UNUSED_PARAM(paintInfo);
......
......@@ -91,8 +91,10 @@ namespace WebCore {
virtual bool paintMediaControlsBackground(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaVolumeSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual void adjustSliderThumbSize(RenderObject*) const;
virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaVolumeSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
......
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