[BlackBerry] Show correct fullscreen button image (media controls)
[WebKit-https.git] / Source / WebCore / platform / blackberry / RenderThemeBlackBerry.cpp
index 4ba60553d6f7ae9a0756d96f2e5bbe0fd9c96c11..b179e780e4f652a14e58ef8345dddfc8613f3f8d 100644 (file)
@@ -852,12 +852,19 @@ bool RenderThemeBlackBerry::paintMediaMuteButton(RenderObject* object, const Pai
 bool RenderThemeBlackBerry::paintMediaFullscreenButton(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
 #if ENABLE(VIDEO)
-    if (!toParentMediaElement(object))
+    HTMLMediaElement* mediaElement = toParentMediaElement(object);
+    if (!mediaElement)
         return false;
 
-    static Image* mediaFullscreen = Image::loadPlatformResource("fullscreen").leakRef();
+    static Image* mediaEnterFullscreen = Image::loadPlatformResource("fullscreen").leakRef();
+    static Image* mediaExitFullscreen = Image::loadPlatformResource("exit_fullscreen").leakRef();
 
-    return paintMediaButton(paintInfo.context, rect, mediaFullscreen);
+    Image* buttonImage = mediaEnterFullscreen;
+#if ENABLE(FULLSCREEN_API)
+    if (mediaElement->document()->webkitIsFullScreen() && mediaElement->document()->webkitCurrentFullScreenElement() == mediaElement)
+        buttonImage = mediaExitFullscreen;
+#endif
+    return paintMediaButton(paintInfo.context, rect, buttonImage);
 #else
     UNUSED_PARAM(object);
     UNUSED_PARAM(paintInfo);