summaryrefslogtreecommitdiffstats
path: root/WebCore/rendering/RenderMediaControlsChromium.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/rendering/RenderMediaControlsChromium.cpp')
-rw-r--r--WebCore/rendering/RenderMediaControlsChromium.cpp31
1 files changed, 24 insertions, 7 deletions
diff --git a/WebCore/rendering/RenderMediaControlsChromium.cpp b/WebCore/rendering/RenderMediaControlsChromium.cpp
index 50feb46..ede3d11 100644
--- a/WebCore/rendering/RenderMediaControlsChromium.cpp
+++ b/WebCore/rendering/RenderMediaControlsChromium.cpp
@@ -99,6 +99,12 @@ static bool paintMediaPlayButton(RenderObject* object, const RenderObject::Paint
return paintMediaButton(paintInfo.context, rect, mediaElement->paused() ? mediaPlay : mediaPause);
}
+static Image* getMediaSliderThumb()
+{
+ static Image* mediaSliderThumb = platformResource("mediaSliderThumb");
+ return mediaSliderThumb;
+}
+
static bool paintMediaSlider(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
{
HTMLMediaElement* mediaElement = toParentMediaElement(object);
@@ -114,9 +120,9 @@ static bool paintMediaSlider(RenderObject* object, const RenderObject::PaintInfo
context->save();
context->setShouldAntialias(true);
context->setStrokeStyle(SolidStroke);
- context->setStrokeColor(style->borderLeftColor(), DeviceColorSpace);
+ context->setStrokeColor(style->visitedDependentColor(CSSPropertyBorderLeftColor), DeviceColorSpace);
context->setStrokeThickness(style->borderLeftWidth());
- context->setFillColor(style->backgroundColor(), DeviceColorSpace);
+ context->setFillColor(style->visitedDependentColor(CSSPropertyBackgroundColor), DeviceColorSpace);
context->drawRect(rect);
context->restore();
@@ -124,7 +130,18 @@ static bool paintMediaSlider(RenderObject* object, const RenderObject::PaintInfo
// FIXME: Draw multiple ranges if there are multiple buffered ranges.
IntRect bufferedRect = rect;
bufferedRect.inflate(-style->borderLeftWidth());
- bufferedRect.setWidth((bufferedRect.width() * mediaElement->percentLoaded()));
+
+ double bufferedWidth = 0.0;
+ if (mediaElement->percentLoaded() > 0.0) {
+ // Account for the width of the slider thumb.
+ Image* mediaSliderThumb = getMediaSliderThumb();
+ double thumbWidth = mediaSliderThumb->width() / 2.0 + 1.0;
+ double rectWidth = bufferedRect.width() - thumbWidth;
+ if (rectWidth < 0.0)
+ rectWidth = 0.0;
+ bufferedWidth = rectWidth * mediaElement->percentLoaded() + thumbWidth;
+ }
+ bufferedRect.setWidth(bufferedWidth);
// Don't bother drawing an empty area.
if (!bufferedRect.isEmpty()) {
@@ -133,7 +150,7 @@ static bool paintMediaSlider(RenderObject* object, const RenderObject::PaintInfo
sliderTopRight.move(0, bufferedRect.height());
RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderTopRight);
- Color startColor = object->style()->color();
+ Color startColor = object->style()->visitedDependentColor(CSSPropertyColor);
gradient->addColorStop(0.0, startColor);
gradient->addColorStop(1.0, Color(startColor.red() / 2, startColor.green() / 2, startColor.blue() / 2, startColor.alpha()));
@@ -159,7 +176,7 @@ static bool paintMediaSliderThumb(RenderObject* object, const RenderObject::Pain
if (!hasSource(mediaElement))
return true;
- static Image* mediaSliderThumb = platformResource("mediaSliderThumb");
+ Image* mediaSliderThumb = getMediaSliderThumb();
return paintMediaButton(paintInfo.context, rect, mediaSliderThumb);
}
@@ -207,13 +224,13 @@ static bool paintMediaTimelineContainer(RenderObject* object, const RenderObject
// Draw the left border using CSS defined width and color.
context->setStrokeThickness(object->style()->borderLeftWidth());
- context->setStrokeColor(object->style()->borderLeftColor().rgb(), DeviceColorSpace);
+ context->setStrokeColor(object->style()->visitedDependentColor(CSSPropertyBorderLeftColor).rgb(), DeviceColorSpace);
context->drawLine(IntPoint(rect.x() + 1, rect.y()),
IntPoint(rect.x() + 1, rect.y() + rect.height()));
// Draw the right border using CSS defined width and color.
context->setStrokeThickness(object->style()->borderRightWidth());
- context->setStrokeColor(object->style()->borderRightColor().rgb(), DeviceColorSpace);
+ context->setStrokeColor(object->style()->visitedDependentColor(CSSPropertyBorderRightColor).rgb(), DeviceColorSpace);
context->drawLine(IntPoint(rect.x() + rect.width() - 1, rect.y()),
IntPoint(rect.x() + rect.width() - 1, rect.y() + rect.height()));