Title: [147578] trunk/Source/WebCore
Revision
147578
Author
[email protected]
Date
2013-04-03 13:05:43 -0700 (Wed, 03 Apr 2013)

Log Message

[BlackBerry] Adjustments to media controls appearance.
https://bugs.webkit.org/show_bug.cgi?id=113816
https://przilla.ott.qnx.com/bugzilla/show_bug.cgi?id=316398
https://przilla.ott.qnx.com/bugzilla/show_bug.cgi?id=316438

Updates to the BlackBerry media controls:
 - extend the timeline slider.
 - move the volume slider for audio elements up so it does not overlap the main panel.
 - upstream some other cosmetic changes to media controls that were not previously upstreamed.

Patch by John Griggs <[email protected]> on 2013-04-03
Reviewed by Rob Buis.

BlackBerry-specific, cosmetic change; No new tests required.

* platform/blackberry/RenderThemeBlackBerry.cpp:
(WebCore::RenderThemeBlackBerry::adjustMediaControlStyle):
(WebCore::RenderThemeBlackBerry::paintMediaPlayButton):
(WebCore::RenderThemeBlackBerry::paintMediaMuteButton):
(WebCore::RenderThemeBlackBerry::paintMediaSliderTrack):
(WebCore::RenderThemeBlackBerry::paintMediaVolumeSliderTrack):
(WebCore::RenderThemeBlackBerry::paintMediaVolumeSliderThumb):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (147577 => 147578)


--- trunk/Source/WebCore/ChangeLog	2013-04-03 19:53:55 UTC (rev 147577)
+++ trunk/Source/WebCore/ChangeLog	2013-04-03 20:05:43 UTC (rev 147578)
@@ -1,3 +1,27 @@
+2013-04-03  John Griggs  <[email protected]>
+
+        [BlackBerry] Adjustments to media controls appearance.
+        https://bugs.webkit.org/show_bug.cgi?id=113816
+        https://przilla.ott.qnx.com/bugzilla/show_bug.cgi?id=316398
+        https://przilla.ott.qnx.com/bugzilla/show_bug.cgi?id=316438
+
+        Updates to the BlackBerry media controls:
+         - extend the timeline slider.
+         - move the volume slider for audio elements up so it does not overlap the main panel.
+         - upstream some other cosmetic changes to media controls that were not previously upstreamed.
+
+        Reviewed by Rob Buis.
+
+        BlackBerry-specific, cosmetic change; No new tests required.
+
+        * platform/blackberry/RenderThemeBlackBerry.cpp:
+        (WebCore::RenderThemeBlackBerry::adjustMediaControlStyle):
+        (WebCore::RenderThemeBlackBerry::paintMediaPlayButton):
+        (WebCore::RenderThemeBlackBerry::paintMediaMuteButton):
+        (WebCore::RenderThemeBlackBerry::paintMediaSliderTrack):
+        (WebCore::RenderThemeBlackBerry::paintMediaVolumeSliderTrack):
+        (WebCore::RenderThemeBlackBerry::paintMediaVolumeSliderThumb):
+
 2013-04-03  Christophe Dumez  <[email protected]>
 
         [Gstreamer] Use gst_buffer_extract() in copyGstreamerBuffersToAudioChannel()

Modified: trunk/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp (147577 => 147578)


--- trunk/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp	2013-04-03 19:53:55 UTC (rev 147577)
+++ trunk/Source/WebCore/platform/blackberry/RenderThemeBlackBerry.cpp	2013-04-03 20:05:43 UTC (rev 147578)
@@ -51,7 +51,7 @@
 // Scale exit-fullscreen button size.
 const float mediaFullscreenButtonHeightRatio = 5 / 11.0;
 const float mediaFullscreenButtonWidthRatio = 3 / 11.0;
-const float mediaSliderOutlineWidth = 2;
+const float mediaSliderEndAdjust = 2;
 const float mediaSliderTrackRadius = 3;
 const float mediaSliderThumbWidth = 25;
 const float mediaSliderThumbHeight = 25;
@@ -846,16 +846,20 @@
     Length controlsHeight(mediaControlsHeight * fullScreenMultiplier, Fixed);
     Length halfControlsWidth(mediaControlsHeight / 2 * fullScreenMultiplier, Fixed);
     Length displayHeight(mediaControlsHeight / 3 * fullScreenMultiplier, Fixed);
+    Length volOffset(mediaControlsHeight * fullScreenMultiplier + 5, Fixed);
     Length padding(mediaControlsHeight / 10 * fullScreenMultiplier, Fixed);
     float fontSize = mediaControlsHeight / 3 * fullScreenMultiplier;
 
     switch (style->appearance()) {
+    case MediaControlsBackgroundPart:
+        if (element->shadowPseudoId() == "-webkit-media-controls-placeholder")
+            style->setHeight(controlsHeight);
+        break;
     case MediaPlayButtonPart:
         style->setWidth(controlsHeight);
         style->setHeight(controlsHeight);
         break;
     case MediaMuteButtonPart:
-        style->setPaddingLeft(padding);
         style->setWidth(controlsHeight);
         style->setHeight(controlsHeight);
         break;
@@ -865,7 +869,6 @@
         style->setHeight(controlsHeight);
         break;
     case MediaEnterFullscreenButtonPart:
-        style->setPaddingRight(padding);
         style->setWidth(controlsHeight);
         style->setHeight(controlsHeight);
         break;
@@ -884,7 +887,7 @@
         break;
     case MediaVolumeSliderContainerPart:
         style->setHeight(controlsHeight);
-        style->setBottom(controlsHeight);
+        style->setBottom(volOffset);
         break;
     default:
         break;
@@ -923,8 +926,17 @@
 
     static Image* mediaPlay = Image::loadPlatformResource("play").leakRef();
     static Image* mediaPause = Image::loadPlatformResource("pause").leakRef();
+    static Image* mediaStop = Image::loadPlatformResource("stop").leakRef();
+    Image* nonPlayImage;
 
-    return paintMediaButton(paintInfo.context, rect, mediaElement->canPlay() ? mediaPlay : mediaPause);
+    // The BlackBerry port sets the movieLoadType to LiveStream if and only if
+    // "stop" must be used instead of "pause".
+    if (mediaElement->movieLoadType() == MediaPlayer::LiveStream)
+        nonPlayImage = mediaStop;
+    else
+        nonPlayImage = mediaPause;
+
+    return paintMediaButton(paintInfo.context, rect, mediaElement->canPlay() ? mediaPlay : nonPlayImage);
 #else
     UNUSED_PARAM(object);
     UNUSED_PARAM(paintInfo);
@@ -964,9 +976,9 @@
     if (!mediaElement)
         return false;
 
-    static Image* divider = Image::loadPlatformResource("speaker").leakRef();
+    static Image* speaker = Image::loadPlatformResource("speaker").leakRef();
 
-    return paintMediaButton(paintInfo.context, rect, divider);
+    return paintMediaButton(paintInfo.context, rect, speaker);
 #else
     UNUSED_PARAM(object);
     UNUSED_PARAM(paintInfo);
@@ -1016,17 +1028,24 @@
     float position = mediaElement->duration() > 0 ? (mediaElement->currentTime() / mediaElement->duration()) : 0;
 
     int intrinsicHeight = ceil(mediaSliderThumbHeight / 4);
-    int x = ceil(rect.x() + (mediaControlsHeight - intrinsicHeight) / 2 * fullScreenMultiplier - fullScreenMultiplier / 2);
+    int x = ceil(rect.x() + mediaSliderEndAdjust * fullScreenMultiplier);
     int y = ceil(rect.y() + (mediaControlsHeight / 2 - intrinsicHeight) / 2 * fullScreenMultiplier + fullScreenMultiplier / 2);
-    int w = ceil(rect.width() - (mediaControlsHeight - intrinsicHeight) * fullScreenMultiplier + fullScreenMultiplier / 2);
+    int w = ceil(rect.width() - mediaSliderEndAdjust * 2 * fullScreenMultiplier);
     int h = ceil(intrinsicHeight * fullScreenMultiplier);
     IntRect rect2(x, y, w, h);
 
-    int wPlayed = ceil(w * position);
-    int wLoaded = ceil((w - mediaSliderThumbWidth * fullScreenMultiplier) * loaded + mediaSliderThumbWidth * fullScreenMultiplier);
+    // We subtract a small amount from the width in the calculation below to
+    // prevent the played bar from poking out past the thumb accidentally.
+    int wPlayed = ceil((w - mediaSliderEndAdjust) * position);
+    // We adjust the buffered bar to make it visible to the right of the thumb.
+    // A small amount is subtracted from the mediaSliderThumbWidth in the first
+    // part of the _expression_ to account for the fact that the slider track's
+    // width was shortened and x position was incremented above (to make sure
+    // its rounded ends get covered by the thumb).
+    int wLoaded = ceil((w - (mediaSliderThumbWidth - mediaSliderEndAdjust) * fullScreenMultiplier) * loaded + mediaSliderThumbWidth * fullScreenMultiplier);
 
     IntRect played(x, y, wPlayed, h);
-    IntRect buffered(x, y, wLoaded, h);
+    IntRect buffered(x, y, wLoaded > w ? w : wLoaded, h);
 #if USE(SKIA)
     // This is to paint main slider bar.
     bool result = paintSliderTrackRect(object, paintInfo, rect2);
@@ -1119,7 +1138,7 @@
 
     int intrinsicHeight = ceil(mediaSliderThumbHeight / 4);
     int x = ceil(rect.x() + (mediaControlsHeight - intrinsicHeight) / 2 * fullScreenMultiplier - fullScreenMultiplier / 2);
-    int y = ceil(rect.y() + (mediaControlsHeight / 2 - intrinsicHeight) / 2 * fullScreenMultiplier + fullScreenMultiplier / 2);
+    int y = ceil(rect.y() + (mediaControlsHeight - intrinsicHeight) / 2 * fullScreenMultiplier + fullScreenMultiplier / 2);
     int w = ceil(rect.width() - (mediaControlsHeight - intrinsicHeight) * fullScreenMultiplier + fullScreenMultiplier / 2);
     int h = ceil(intrinsicHeight * fullScreenMultiplier);
     IntRect rect2(x, y, w, h);
@@ -1157,13 +1176,10 @@
 bool RenderThemeBlackBerry::paintMediaVolumeSliderThumb(RenderObject* object, const PaintInfo& paintInfo, const IntRect& rect)
 {
 #if ENABLE(VIDEO)
-#if USE(SKIA)
     RenderSlider* slider = determineRenderSlider(object);
-    if (!slider)
-        return false;
+    float fullScreenMultiplier = slider ? determineFullScreenMultiplier(toElement(slider->node())) : 1;
 
-    float fullScreenMultiplier = determineFullScreenMultiplier(toElement(slider->node()));
-
+#if USE(SKIA)
     paintInfo.context->save();
     Path mediaThumbRoundedRectangle;
     mediaThumbRoundedRectangle.addRoundedRect(rect, FloatSize(mediaSliderThumbHeight / 2 * fullScreenMultiplier, mediaSliderThumbHeight / 2 * fullScreenMultiplier));
@@ -1178,7 +1194,11 @@
 
     return true;
 #else // GL renderer
-    return paintMediaSliderThumb(object, paintInfo, rect);
+    int intrinsicHeight = ceil(mediaSliderThumbHeight / 4);
+    int y = ceil(rect.y() + (mediaControlsHeight / 2 - intrinsicHeight / 2) / 2 * fullScreenMultiplier);
+    IntRect adjustedRect(rect.x(), y, rect.width(), rect.height());
+
+    return paintMediaSliderThumb(object, paintInfo, adjustedRect);
 #endif // USE(SKIA)
 #else
     UNUSED_PARAM(object);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to