| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Apple Inc. | 2 * Copyright (C) 2009 Apple Inc. |
| 3 * Copyright (C) 2009 Google Inc. | 3 * Copyright (C) 2009 Google Inc. |
| 4 * All rights reserved. | 4 * All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 } | 54 } |
| 55 | 55 |
| 56 static bool hasSource(const HTMLMediaElement* mediaElement) | 56 static bool hasSource(const HTMLMediaElement* mediaElement) |
| 57 { | 57 { |
| 58 return mediaElement->networkState() != HTMLMediaElement::NETWORK_EMPTY | 58 return mediaElement->networkState() != HTMLMediaElement::NETWORK_EMPTY |
| 59 && mediaElement->networkState() != HTMLMediaElement::NETWORK_NO_SOURCE; | 59 && mediaElement->networkState() != HTMLMediaElement::NETWORK_NO_SOURCE; |
| 60 } | 60 } |
| 61 | 61 |
| 62 static bool paintMediaButton(GraphicsContext* context, const IntRect& rect, Imag
e* image) | 62 static bool paintMediaButton(GraphicsContext* context, const IntRect& rect, Imag
e* image) |
| 63 { | 63 { |
| 64 context->drawImage(image, ColorSpaceDeviceRGB, rect); | 64 context->drawImage(image, rect); |
| 65 return true; | 65 return true; |
| 66 } | 66 } |
| 67 | 67 |
| 68 static bool paintMediaMuteButton(RenderObject* object, const PaintInfo& paintInf
o, const IntRect& rect) | 68 static bool paintMediaMuteButton(RenderObject* object, const PaintInfo& paintInf
o, const IntRect& rect) |
| 69 { | 69 { |
| 70 HTMLMediaElement* mediaElement = toParentMediaElement(object); | 70 HTMLMediaElement* mediaElement = toParentMediaElement(object); |
| 71 if (!mediaElement) | 71 if (!mediaElement) |
| 72 return false; | 72 return false; |
| 73 | 73 |
| 74 static Image* soundLevel3 = platformResource("mediaplayerSoundLevel3"); | 74 static Image* soundLevel3 = platformResource("mediaplayerSoundLevel3"); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 static Image* mediaSliderThumb = platformResource("mediaplayerSliderThumb"); | 126 static Image* mediaSliderThumb = platformResource("mediaplayerSliderThumb"); |
| 127 return mediaSliderThumb; | 127 return mediaSliderThumb; |
| 128 } | 128 } |
| 129 | 129 |
| 130 static void paintRoundedSliderBackground(const IntRect& rect, const RenderStyle*
style, GraphicsContext* context) | 130 static void paintRoundedSliderBackground(const IntRect& rect, const RenderStyle*
style, GraphicsContext* context) |
| 131 { | 131 { |
| 132 int borderRadius = rect.height() / 2; | 132 int borderRadius = rect.height() / 2; |
| 133 IntSize radii(borderRadius, borderRadius); | 133 IntSize radii(borderRadius, borderRadius); |
| 134 Color sliderBackgroundColor = Color(11, 11, 11); | 134 Color sliderBackgroundColor = Color(11, 11, 11); |
| 135 context->save(); | 135 context->save(); |
| 136 context->fillRoundedRect(rect, radii, radii, radii, radii, sliderBackgroundC
olor, ColorSpaceDeviceRGB); | 136 context->fillRoundedRect(rect, radii, radii, radii, radii, sliderBackgroundC
olor); |
| 137 context->restore(); | 137 context->restore(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 static void paintSliderRangeHighlight(const IntRect& rect, const RenderStyle* st
yle, GraphicsContext* context, int startPosition, int endPosition, Color startCo
lor, Color endColor) | 140 static void paintSliderRangeHighlight(const IntRect& rect, const RenderStyle* st
yle, GraphicsContext* context, int startPosition, int endPosition, Color startCo
lor, Color endColor) |
| 141 { | 141 { |
| 142 // Calculate border radius; need to avoid being smaller than half the slider
height | 142 // Calculate border radius; need to avoid being smaller than half the slider
height |
| 143 // because of https://bugs.webkit.org/show_bug.cgi?id=30143. | 143 // because of https://bugs.webkit.org/show_bug.cgi?id=30143. |
| 144 int borderRadius = rect.height() / 2; | 144 int borderRadius = rect.height() / 2; |
| 145 IntSize radii(borderRadius, borderRadius); | 145 IntSize radii(borderRadius, borderRadius); |
| 146 | 146 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 175 sliderBottomLeft.move(0, highlightRect.height()); | 175 sliderBottomLeft.move(0, highlightRect.height()); |
| 176 RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderBottomLeft
); | 176 RefPtr<Gradient> gradient = Gradient::create(sliderTopLeft, sliderBottomLeft
); |
| 177 gradient->addColorStop(0.0, startColor); | 177 gradient->addColorStop(0.0, startColor); |
| 178 gradient->addColorStop(1.0, endColor); | 178 gradient->addColorStop(1.0, endColor); |
| 179 | 179 |
| 180 // Fill highlight rectangle with gradient, potentially rounded if on left or
right edge. | 180 // Fill highlight rectangle with gradient, potentially rounded if on left or
right edge. |
| 181 context->save(); | 181 context->save(); |
| 182 context->setFillGradient(gradient); | 182 context->setFillGradient(gradient); |
| 183 | 183 |
| 184 if (startOffset < borderRadius && endOffset < borderRadius) | 184 if (startOffset < borderRadius && endOffset < borderRadius) |
| 185 context->fillRoundedRect(highlightRect, radii, radii, radii, radii, star
tColor, ColorSpaceDeviceRGB); | 185 context->fillRoundedRect(highlightRect, radii, radii, radii, radii, star
tColor); |
| 186 else if (startOffset < borderRadius) | 186 else if (startOffset < borderRadius) |
| 187 context->fillRoundedRect(highlightRect, radii, IntSize(0, 0), radii, Int
Size(0, 0), startColor, ColorSpaceDeviceRGB); | 187 context->fillRoundedRect(highlightRect, radii, IntSize(0, 0), radii, Int
Size(0, 0), startColor); |
| 188 else if (endOffset < borderRadius) | 188 else if (endOffset < borderRadius) |
| 189 context->fillRoundedRect(highlightRect, IntSize(0, 0), radii, IntSize(0,
0), radii, startColor, ColorSpaceDeviceRGB); | 189 context->fillRoundedRect(highlightRect, IntSize(0, 0), radii, IntSize(0,
0), radii, startColor); |
| 190 else | 190 else |
| 191 context->fillRect(highlightRect); | 191 context->fillRect(highlightRect); |
| 192 | 192 |
| 193 context->restore(); | 193 context->restore(); |
| 194 } | 194 } |
| 195 | 195 |
| 196 const int mediaSliderThumbWidth = 32; | 196 const int mediaSliderThumbWidth = 32; |
| 197 | 197 |
| 198 static bool paintMediaSlider(RenderObject* object, const PaintInfo& paintInfo, c
onst IntRect& rect) | 198 static bool paintMediaSlider(RenderObject* object, const PaintInfo& paintInfo, c
onst IntRect& rect) |
| 199 { | 199 { |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 { | 442 { |
| 443 return formatChromiumMediaControlsTime(time, time); | 443 return formatChromiumMediaControlsTime(time, time); |
| 444 } | 444 } |
| 445 | 445 |
| 446 String RenderMediaControlsChromium::formatMediaControlsCurrentTime(float current
Time, float duration) | 446 String RenderMediaControlsChromium::formatMediaControlsCurrentTime(float current
Time, float duration) |
| 447 { | 447 { |
| 448 return formatChromiumMediaControlsTime(currentTime, duration); | 448 return formatChromiumMediaControlsTime(currentTime, duration); |
| 449 } | 449 } |
| 450 | 450 |
| 451 } // namespace WebCore | 451 } // namespace WebCore |
| OLD | NEW |