Revert "2009-09-16 Albert J. Wong <ajwong@chromium.org>"
authorbrettw@chromium.org <brettw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Sep 2009 02:33:24 +0000 (02:33 +0000)
committerbrettw@chromium.org <brettw@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 17 Sep 2009 02:33:24 +0000 (02:33 +0000)
This change did not compile.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48450 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/css/mediaControlsChromium.css
WebCore/rendering/RenderThemeChromiumMac.h
WebCore/rendering/RenderThemeChromiumMac.mm
WebCore/rendering/RenderThemeChromiumSkia.cpp

index 96e55a614e4d1978974863b13ad7fc977329e791..0a9f8712d0ec664d97bb2a5c9dbdaca5f1a5a9f0 100644 (file)
         * rendering/style/RenderStyleConstants.h:
         (WebCore::):
 
-2009-09-16  Albert J. Wong  <ajwong@chromium.org>
-
-        Reviewed by David Levin.
-
-        Reimplement default media UI for Mac Chromium to match the style
-        of the Windows and Linux versions.  Also breaks the dependency
-        on the internal wk* functions that were previously used to
-        render the media controller widgets.
-        https://bugs.webkit.org/show_bug.cgi?id=29161
-
-        No media layout tests are currently enabled in Mac Chromium, so
-        nothing needs rebaselineing, etc.
-
-        * css/mediaControlsChromium.css:
-        * rendering/RenderThemeChromiumMac.h:
-        * rendering/RenderThemeChromiumMac.mm:
-        (WebCore::mediaElementParent):
-        (WebCore::RenderThemeChromiumMac::extraMediaControlsStyleSheet):
-        (WebCore::mediaSliderThumbImage):
-        (WebCore::mediaVolumeSliderThumbImage):
-        (WebCore::RenderThemeChromiumMac::paintSliderTrack):
-        (WebCore::RenderThemeChromiumMac::adjustSliderThumbSize):
-        (WebCore::RenderThemeChromiumMac::paintMediaButtonInternal):
-        (WebCore::RenderThemeChromiumMac::paintMediaPlayButton):
-        (WebCore::RenderThemeChromiumMac::paintMediaMuteButton):
-        (WebCore::RenderThemeChromiumMac::paintMediaSliderTrack):
-        (WebCore::RenderThemeChromiumMac::paintMediaVolumeSliderTrack):
-        (WebCore::RenderThemeChromiumMac::paintMediaSliderThumb):
-        (WebCore::RenderThemeChromiumMac::paintMediaVolumeSliderThumb):
-        (WebCore::RenderThemeChromiumMac::paintMediaControlsBackground):
-        * rendering/RenderThemeChromiumSkia.cpp:
-        (WebCore::RenderThemeChromiumSkia::adjustSliderThumbSize):
-
 2009-09-16  Yury Semikhatsky  <yurys@chromium.org>
 
         Reviewed by Timothy Hatcher.
index 16ff0e44d86a49a34155fb8064c0fba169268a75..0c01da29c86508d37a1cd54ebe560463e2a23b58 100644 (file)
@@ -147,7 +147,6 @@ audio::-webkit-media-controls-timeline, video::-webkit-media-controls-timeline {
     height: 16px;
 
     border-color: rgba(255, 255, 255, 0.2);
-    border-style: solid;
     border-width: 1px;
     border-radius: 2px;
     background-color: rgba(255, 255, 255, 0.08);
index 1ce2f9e9cc389c5470230d4e46545aa99e8a563d..0c417a2d98aebc13ca3d0d332344ebbeea914db0 100644 (file)
@@ -44,10 +44,6 @@ namespace WebCore {
     public:
         static PassRefPtr<RenderTheme> create();
 
-#if ENABLE(VIDEO)
-        virtual String extraMediaControlsStyleSheet();
-#endif
-
         // A method to obtain the baseline position for a "leaf" control.  This will only be used if a baseline
         // position cannot be determined by examining child content. Checkboxes and radio buttons are examples of
         // controls that need to do this.
@@ -137,13 +133,13 @@ namespace WebCore {
         virtual void adjustSearchFieldResultsButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const;
         virtual bool paintSearchFieldResultsButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
 
+        virtual bool paintMediaFullscreenButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
         virtual bool paintMediaPlayButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
         virtual bool paintMediaMuteButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+        virtual bool paintMediaSeekBackButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
+        virtual bool paintMediaSeekForwardButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
         virtual bool paintMediaSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
         virtual bool paintMediaSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
-        virtual bool paintMediaVolumeSliderTrack(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
-        virtual bool paintMediaVolumeSliderThumb(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
-        virtual bool paintMediaControlsBackground(RenderObject*, const RenderObject::PaintInfo&, const IntRect&);
 
     private:
         RenderThemeChromiumMac();
@@ -218,7 +214,6 @@ namespace WebCore {
         mutable HashMap<int, RGBA32> m_systemColorCache;
 
         RetainPtr<WebCoreRenderThemeNotificationObserver> m_notificationObserver;
-        bool paintMediaButtonInternal(GraphicsContext*, const IntRect&, Image*);
     };
 
 } // namespace WebCore
index 1a3ccf5af37c648b9fad8ff14f8c647283b5c224..659a0c68d56704f10823fc5716cc5eb429b80980 100644 (file)
@@ -39,7 +39,6 @@
 #import "Element.h"
 #import "FoundationExtras.h"
 #import "FrameView.h"
-#import "Gradient.h"
 #import "GraphicsContext.h"
 #import "HTMLInputElement.h"
 #import "HTMLMediaElement.h"
@@ -52,7 +51,6 @@
 #import "RenderView.h"
 #import "SharedBuffer.h"
 #import "TimeRanges.h"
-#import "UserAgentStyleSheets.h"
 #import "WebCoreSystemInterface.h"
 #import <wtf/RetainPtr.h>
 
@@ -113,20 +111,6 @@ enum {
     LeftPadding
 };
 
-#if ENABLE(VIDEO)
-// Attempt to retrieve a HTMLMediaElement from a Node. Returns 0 if one cannot be found.
-static HTMLMediaElement* mediaElementParent(Node* node)
-{
-    if (!node)
-        return 0;
-    Node* mediaNode = node->shadowAncestorNode();
-    if (!mediaNode || (!mediaNode->hasTagName(HTMLNames::videoTag) && !mediaNode->hasTagName(HTMLNames::audioTag)))
-        return 0;
-
-    return static_cast<HTMLMediaElement*>(mediaNode);
-}
-#endif
-
 // In our Mac port, we don't define PLATFORM(MAC) and thus don't pick up the
 // |operator NSRect()| on WebCore::IntRect and FloatRect. This substitues for
 // that missing conversion operator.
@@ -150,13 +134,6 @@ PassRefPtr<RenderTheme> RenderThemeChromiumMac::create()
     return adoptRef(new RenderThemeChromiumMac);
 }
 
-#if ENABLE(VIDEO)
-String RenderThemeChromiumMac::extraMediaControlsStyleSheet()
-{
-    return String(mediaControlsChromiumUserAgentStyleSheet, sizeof(mediaControlsChromiumUserAgentStyleSheet));
-}
-#endif
-
 PassRefPtr<RenderTheme> RenderTheme::themeForPage(Page* page)
 {
     static RenderTheme* rt = RenderThemeChromiumMac::create().releaseRef();
@@ -1478,18 +1455,9 @@ int RenderThemeChromiumMac::minimumMenuListSize(RenderStyle* style) const
     return sizeForSystemFont(style, menuListSizes()).width();
 }
 
-static Image* mediaSliderThumbImage()
-{
-    static Image* mediaSliderThumb = Image::loadPlatformResource("mediaSliderThumb").releaseRef();
-    return mediaSliderThumb;
-}
-  
-static Image* mediaVolumeSliderThumbImage()
-{
-    static Image* mediaVolumeSliderThumb = Image::loadPlatformResource("mediaVolumeSliderThumb").releaseRef();
-    return mediaVolumeSliderThumb;
-}
-  
+static const int trackWidth = 5;
+static const int trackRadius = 2;
+
 void RenderThemeChromiumMac::adjustSliderTrackStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const
 {
     style->setBoxShadow(0);
@@ -1497,9 +1465,6 @@ void RenderThemeChromiumMac::adjustSliderTrackStyle(CSSStyleSelector* selector,
 
 bool RenderThemeChromiumMac::paintSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
 {
-    static const int trackWidth = 5;
-    static const int trackRadius = 2;
-  
     IntRect bounds = r;
     float zoomLevel = o->style()->effectiveZoom();
     float zoomedTrackWidth = trackWidth * zoomLevel;
@@ -1607,6 +1572,8 @@ bool RenderThemeChromiumMac::paintSliderThumb(RenderObject* o, const RenderObjec
 
 const int sliderThumbWidth = 15;
 const int sliderThumbHeight = 15;
+const int mediaSliderThumbWidth = 13;
+const int mediaSliderThumbHeight = 14;
 
 void RenderThemeChromiumMac::adjustSliderThumbSize(RenderObject* o) const
 {
@@ -1614,20 +1581,10 @@ void RenderThemeChromiumMac::adjustSliderThumbSize(RenderObject* o) const
     if (o->style()->appearance() == SliderThumbHorizontalPart || o->style()->appearance() == SliderThumbVerticalPart) {
         o->style()->setWidth(Length(static_cast<int>(sliderThumbWidth * zoomLevel), Fixed));
         o->style()->setHeight(Length(static_cast<int>(sliderThumbHeight * zoomLevel), Fixed));
+    } else if (o->style()->appearance() == MediaSliderThumbPart) {
+        o->style()->setWidth(Length(mediaSliderThumbWidth, Fixed));
+        o->style()->setHeight(Length(mediaSliderThumbHeight, Fixed));
     }
-
-#if ENABLE(VIDEO)
-    Image* thumbImage = 0;
-    if (o->style()->appearance() == MediaSliderThumbPart)
-        thumbImage = mediaSliderThumbImage();
-    else if (o->style()->appearance() == MediaVolumeSliderThumbPart)
-        thumbImage = mediaVolumeSliderThumbImage();
-  
-    if (thumbImage) {
-        o->style()->setWidth(Length(thumbImage->width(), Fixed));
-        o->style()->setHeight(Length(thumbImage->height(), Fixed));
-    }
-#endif
 }
 
 bool RenderThemeChromiumMac::paintSearchField(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
@@ -1869,210 +1826,138 @@ bool RenderThemeChromiumMac::paintSearchFieldResultsButton(RenderObject* o, cons
     return false;
 }
 
-bool RenderThemeChromiumMac::paintMediaButtonInternal(GraphicsContext* context, const IntRect& rect, Image* image)
-{
-    // Create a destination rectangle for the image that is centered in the drawing rectangle, rounded left, and down.
-    IntRect imageRect = image->rect();
-    imageRect.setY(rect.y() + (rect.height() - image->height() + 1) / 2);
-    imageRect.setX(rect.x() + (rect.width() - image->width() + 1) / 2);
-
-    context->drawImage(image, imageRect);
-    return true;
-}
+#if ENABLE(VIDEO)
+// FIXME: This enum is lifted from RenderThemeMac.mm  We need to decide which theme to use for the default controls, or decide to avoid wkDrawMediaUIPart and render our own.
+typedef enum {
+    MediaControllerThemeClassic   = 1,
+    MediaControllerThemeQT        = 2
+} MediaControllerThemeStyle;
+
+enum WKMediaControllerThemeState {
+    MediaUIPartDisabledFlag = 1 << 0,
+    MediaUIPartPressedFlag = 1 << 1,
+    MediaUIPartDrawEndCapsFlag = 1 << 3,
+};
+#endif
 
-bool RenderThemeChromiumMac::paintMediaPlayButton(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
+bool RenderThemeChromiumMac::paintMediaFullscreenButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
 {
 #if ENABLE(VIDEO)
-    HTMLMediaElement* mediaElement = mediaElementParent(object->node());
-    if (!mediaElement)
+    Node* node = o->node();
+    if (!node)
         return false;
 
-    static Image* mediaPlay = Image::loadPlatformResource("mediaPlay").releaseRef();
-    static Image* mediaPause = Image::loadPlatformResource("mediaPause").releaseRef();
-    static Image* mediaPlayDisabled = Image::loadPlatformResource("mediaPlayDisabled").releaseRef();
-
-    if (mediaElement->networkState() == HTMLMediaElement::NETWORK_NO_SOURCE)
-        return paintMediaButtonInternal(paintInfo.context, rect, mediaPlayDisabled);
-
-    return paintMediaButtonInternal(paintInfo.context, rect, mediaElement->paused() ? mediaPlay : mediaPause);
-#else
-    UNUSED_PARAM(object);
-    UNUSED_PARAM(paintInfo);
-    UNUSED_PARAM(rect);
-    return false;
+    LocalCurrentGraphicsContext localContext(paintInfo.context);
+    wkDrawMediaUIPart(MediaFullscreenButton, MediaControllerThemeClassic,  paintInfo.context->platformContext(), r, 
+        node->active() ? MediaUIPartPressedFlag : 0);
 #endif
+    return false;
 }
 
-bool RenderThemeChromiumMac::paintMediaMuteButton(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
+bool RenderThemeChromiumMac::paintMediaMuteButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
 {
 #if ENABLE(VIDEO)
-    HTMLMediaElement* mediaElement = mediaElementParent(object->node());
-    if (!mediaElement)
+    Node* node = o->node();
+    Node* mediaNode = node ? node->shadowAncestorNode() : 0;
+    if (!mediaNode || (!mediaNode->hasTagName(videoTag) && !mediaNode->hasTagName(audioTag)))
         return false;
 
-    static Image* soundFull = Image::loadPlatformResource("mediaSoundFull").releaseRef();
-    static Image* soundNone = Image::loadPlatformResource("mediaSoundNone").releaseRef();
-    static Image* soundDisabled = Image::loadPlatformResource("mediaSoundDisabled").releaseRef();
-
-    if (mediaElement->networkState() == HTMLMediaElement::NETWORK_NO_SOURCE || !mediaElement->hasAudio())
-        return paintMediaButtonInternal(paintInfo.context, rect, soundDisabled);
-
-    return paintMediaButtonInternal(paintInfo.context, rect, mediaElement->muted() ? soundNone : soundFull);
-#else
-    UNUSED_PARAM(object);
-    UNUSED_PARAM(paintInfo);
-    UNUSED_PARAM(rect);
-    return false;
+    HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(mediaNode);
+    if (!mediaElement)
+        return false;
+    
+    LocalCurrentGraphicsContext localContext(paintInfo.context);
+    wkDrawMediaUIPart(mediaElement->muted() ? MediaUnMuteButton : MediaMuteButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r,
+        node->active() ? MediaUIPartPressedFlag : 0);
 #endif
+    return false;
 }
 
-bool RenderThemeChromiumMac::paintMediaSliderTrack(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
+bool RenderThemeChromiumMac::paintMediaPlayButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
 {
 #if ENABLE(VIDEO)
-    HTMLMediaElement* mediaElement = mediaElementParent(object->node());
+    Node* node = o->node();
+    Node* mediaNode = node ? node->shadowAncestorNode() : 0;
+    if (!mediaNode || (!mediaNode->hasTagName(videoTag) && !mediaNode->hasTagName(audioTag)))
+        return false;
+
+    HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(mediaNode);
     if (!mediaElement)
         return false;
 
-    RenderStyle* style = object->style();    
-    GraphicsContext* context = paintInfo.context;
-    context->save();
-    
-    context->setShouldAntialias(true);
-
-    IntSize topLeftRadius = style->borderTopLeftRadius();
-    IntSize topRightRadius = style->borderTopRightRadius();
-    IntSize bottomLeftRadius = style->borderBottomLeftRadius();
-    IntSize bottomRightRadius = style->borderBottomRightRadius();
-    float borderWidth = style->borderLeftWidth();
-
-    // Draw the border of the time bar.
-    context->setStrokeColor(style->borderLeftColor());
-    context->setStrokeThickness(borderWidth);
-    context->setFillColor(style->backgroundColor());
-    context->addPath(Path::createRoundedRectangle(rect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius));
-    context->drawPath();
-    
-    // Draw the buffered ranges.
-    // FIXME: Draw multiple ranges if there are multiple buffered ranges.
-    FloatRect bufferedRect = rect;
-    bufferedRect.inflate(-1.0 - borderWidth);
-    bufferedRect.setWidth(bufferedRect.width() * mediaElement->percentLoaded());
-    bufferedRect = context->roundToDevicePixels(bufferedRect);
-   
-    // Don't bother drawing an empty area.
-    if (bufferedRect.width() > 0 && bufferedRect.height() > 0) {
-        FloatPoint sliderTopLeft = bufferedRect.location();
-        FloatPoint sliderTopRight = sliderTopLeft;
-        p1.move(0.0f, bufferedRect.height());
-        
-        RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderTopRight);
-        Color startColor = object->style()->color();
-        gradient->addColorStop(0.0, startColor);
-        gradient->addColorStop(1.0, Color(startColor.red() / 2, startColor.green() / 2, startColor.blue() / 2, startColor.alpha()));
-        context->setFillGradient(gradient);
-        context->addPath(Path::createRoundedRectangle(bufferedRect, topLeftRadius, topRightRadius, bottomLeftRadius, bottomRightRadius));
-        context->fillPath();
-    }
-    
-    context->restore();    
-    return true;
-#else
-    UNUSED_PARAM(object);
-    UNUSED_PARAM(paintInfo);
-    UNUSED_PARAM(rect);
-    return false;
+    LocalCurrentGraphicsContext localContext(paintInfo.context);
+    wkDrawMediaUIPart(mediaElement->canPlay() ? MediaPlayButton : MediaPauseButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r,
+        node->active() ? MediaUIPartPressedFlag : 0);
 #endif
+    return false;
 }
 
-bool RenderThemeChromiumMac::paintMediaVolumeSliderTrack(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
+bool RenderThemeChromiumMac::paintMediaSeekBackButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
 {
 #if ENABLE(VIDEO)
-    HTMLMediaElement* mediaElement = mediaElementParent(object->node());
-    if (!mediaElement)
+    Node* node = o->node();
+    if (!node)
         return false;
 
-    GraphicsContext* context = paintInfo.context;
-    Color originalColor = context->strokeColor();
-    if (originalColor != Color::white)
-        context->setStrokeColor(Color::white);
-
-    int x = rect.x() + rect.width() / 2;
-    context->drawLine(IntPoint(x, rect.y()),  IntPoint(x, rect.y() + rect.height()));
-    
-    if (originalColor != Color::white)
-        context->setStrokeColor(originalColor);
-    return true;
-#else
-    UNUSED_PARAM(object);
-    UNUSED_PARAM(paintInfo);
-    UNUSED_PARAM(rect);
-    return false;
+    LocalCurrentGraphicsContext localContext(paintInfo.context);
+    wkDrawMediaUIPart(MediaSeekBackButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r,
+        node->active() ? MediaUIPartPressedFlag : 0);
 #endif
+    return false;
 }
 
-bool RenderThemeChromiumMac::paintMediaSliderThumb(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
+bool RenderThemeChromiumMac::paintMediaSeekForwardButton(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
 {
 #if ENABLE(VIDEO)
-    if (!object->parent()->isSlider())
+    Node* node = o->node();
+    if (!node)
         return false;
 
-    return paintMediaButtonInternal(paintInfo.context, rect, mediaSliderThumbImage());
-#else
-    UNUSED_PARAM(object);
-    UNUSED_PARAM(paintInfo);
-    UNUSED_PARAM(rect);
-    return false;
+    LocalCurrentGraphicsContext localContext(paintInfo.context);
+    wkDrawMediaUIPart(MediaSeekForwardButton, MediaControllerThemeClassic, paintInfo.context->platformContext(), r,
+        node->active() ? MediaUIPartPressedFlag : 0);
 #endif
+    return false;
 }
 
-bool RenderThemeChromiumMac::paintMediaVolumeSliderThumb(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
+bool RenderThemeChromiumMac::paintMediaSliderTrack(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
 {
 #if ENABLE(VIDEO)
-    if (!object->parent()->isSlider())
+    Node* node = o->node();
+    Node* mediaNode = node ? node->shadowAncestorNode() : 0;
+    if (!mediaNode || (!mediaNode->hasTagName(videoTag) && !mediaNode->hasTagName(audioTag)))
         return false;
 
-    return paintMediaButtonInternal(paintInfo.context, rect, mediaVolumeSliderThumbImage());
-#else
-    UNUSED_PARAM(object);
-    UNUSED_PARAM(paintInfo);
-    UNUSED_PARAM(rect);
-    return false;
+    HTMLMediaElement* mediaElement = static_cast<HTMLMediaElement*>(mediaNode);
+    if (!mediaElement)
+        return false;
+
+    RefPtr<TimeRanges> timeRanges = mediaElement->buffered();
+    ExceptionCode ignoredException;
+    float timeLoaded = timeRanges->length() ? timeRanges->end(0, ignoredException) : 0;
+    float currentTime = mediaElement->currentTime();
+    float duration = mediaElement->duration();
+    if (isnan(duration))
+        duration = 0;
+
+    bool shouldDrawEndCaps = !toRenderMedia(mediaElement->renderer())->shouldShowTimeDisplayControls();
+    wkDrawMediaSliderTrack(MediaControllerThemeClassic, paintInfo.context->platformContext(), r, timeLoaded, currentTime, duration, shouldDrawEndCaps ? MediaUIPartDrawEndCapsFlag : 0);
 #endif
+    return false;
 }
 
-bool RenderThemeChromiumMac::paintMediaControlsBackground(RenderObject* object, const RenderObject::PaintInfo& paintInfo, const IntRect& rect)
+bool RenderThemeChromiumMac::paintMediaSliderThumb(RenderObject* o, const RenderObject::PaintInfo& paintInfo, const IntRect& r)
 {
 #if ENABLE(VIDEO)
-    HTMLMediaElement* mediaElement = mediaElementParent(object->node());
-    if (!mediaElement)
+    Node* node = o->node();
+    if (!node)
         return false;
 
-    if (!rect.isEmpty())
-    {
-        GraphicsContext* context = paintInfo.context;
-        Color originalColor = context->strokeColor();
-        // Draws the left border, it is always 1px wide.
-        context->setStrokeColor(object->style()->borderLeftColor());
-        context->drawLine(IntPoint(rect.x() + 1, rect.y()),
-                          IntPoint(rect.x() + 1, rect.y() + rect.height()));
-                         
-
-        // Draws the right border, it is always 1px wide.
-        context->setStrokeColor(object->style()->borderRightColor());
-        context->drawLine(IntPoint(rect.x() + rect.width() - 1, rect.y()),
-                          IntPoint(rect.x() + rect.width() - 1, rect.y() + rect.height()));
-        
-        context->setStrokeColor(originalColor);
-    }
-    return true;
-#else
-    UNUSED_PARAM(object);
-    UNUSED_PARAM(paintInfo);
-    UNUSED_PARAM(rect);
-    return false;
+    LocalCurrentGraphicsContext localContext(paintInfo.context);
+    wkDrawMediaUIPart(MediaSliderThumb, MediaControllerThemeClassic, paintInfo.context->platformContext(), r,
+        node->active() ? MediaUIPartPressedFlag : 0);
 #endif
+    return false;
 }
 
 // FIXME: This used to be in the upstream version until it was converted to the new theme API in r37731.
index 82e633b7022a83eef964a34ffd03f3d452347055..e25eed3cea5d2bd5dad8fb1faa58453c87c6d4c9 100644 (file)
@@ -640,10 +640,9 @@ void RenderThemeChromiumSkia::adjustSliderThumbSize(RenderObject* object) const
     else if (object->style()->appearance() == MediaVolumeSliderThumbPart)
         thumbImage = mediaVolumeSliderThumbImage();
 
-    if (thumbImage) {
-        object->style()->setWidth(Length(thumbImage->width(), Fixed));
-        object->style()->setHeight(Length(thumbImage->height(), Fixed));
-    }
+    ASSERT(thumbImage);
+    object->style()->setWidth(Length(thumbImage->width(), Fixed));
+    object->style()->setHeight(Length(thumbImage->height(), Fixed));
 #else
     UNUSED_PARAM(object);
 #endif