| 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 13 matching lines...) Expand all Loading... |
| 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 26 */ | 26 */ |
| 27 | 27 |
| 28 #include "config.h" | 28 #include "config.h" |
| 29 #include "core/paint/MediaControlsPainter.h" | 29 #include "core/paint/MediaControlsPainter.h" |
| 30 | 30 |
| 31 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 31 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 32 #include "core/html/HTMLMediaElement.h" | 32 #include "core/html/HTMLMediaElement.h" |
| 33 #include "core/html/TimeRanges.h" | 33 #include "core/html/TimeRanges.h" |
| 34 #include "core/html/shadow/MediaControlElementTypes.h" |
| 34 #include "core/paint/PaintInfo.h" | 35 #include "core/paint/PaintInfo.h" |
| 35 #include "core/style/ComputedStyle.h" | 36 #include "core/style/ComputedStyle.h" |
| 36 #include "platform/graphics/Gradient.h" | 37 #include "platform/graphics/Gradient.h" |
| 37 #include "platform/graphics/GraphicsContext.h" | 38 #include "platform/graphics/GraphicsContext.h" |
| 38 | 39 |
| 39 namespace blink { | 40 namespace blink { |
| 40 | 41 |
| 41 static double kCurrentTimeBufferedDelta = 1.0; | 42 static double kCurrentTimeBufferedDelta = 1.0; |
| 42 | 43 |
| 43 typedef WTF::HashMap<const char*, Image*> MediaControlImageMap; | 44 typedef WTF::HashMap<const char*, Image*> MediaControlImageMap; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 62 return mediaElement->networkState() != HTMLMediaElement::NETWORK_EMPTY | 63 return mediaElement->networkState() != HTMLMediaElement::NETWORK_EMPTY |
| 63 && mediaElement->networkState() != HTMLMediaElement::NETWORK_NO_SOURCE; | 64 && mediaElement->networkState() != HTMLMediaElement::NETWORK_NO_SOURCE; |
| 64 } | 65 } |
| 65 | 66 |
| 66 static bool paintMediaButton(GraphicsContext* context, const IntRect& rect, Imag
e* image) | 67 static bool paintMediaButton(GraphicsContext* context, const IntRect& rect, Imag
e* image) |
| 67 { | 68 { |
| 68 context->drawImage(image, rect); | 69 context->drawImage(image, rect); |
| 69 return true; | 70 return true; |
| 70 } | 71 } |
| 71 | 72 |
| 72 static bool paintMediaMuteButton(LayoutObject* object, const PaintInfo& paintInf
o, const IntRect& rect) | 73 bool MediaControlsPainter::paintMediaMuteButton(LayoutObject* object, const Pain
tInfo& paintInfo, const IntRect& rect) |
| 73 { | 74 { |
| 74 HTMLMediaElement* mediaElement = toParentMediaElement(object); | 75 HTMLMediaElement* mediaElement = toParentMediaElement(object); |
| 75 if (!mediaElement) | 76 if (!mediaElement) |
| 76 return false; | 77 return false; |
| 77 | 78 |
| 78 static Image* soundLevel3 = platformResource("mediaplayerSoundLevel3"); | 79 static Image* soundLevel3 = platformResource("mediaplayerSoundLevel3"); |
| 79 static Image* soundLevel2 = platformResource("mediaplayerSoundLevel2"); | 80 static Image* soundLevel2 = platformResource("mediaplayerSoundLevel2"); |
| 80 static Image* soundLevel1 = platformResource("mediaplayerSoundLevel1"); | 81 static Image* soundLevel1 = platformResource("mediaplayerSoundLevel1"); |
| 81 static Image* soundLevel0 = platformResource("mediaplayerSoundLevel0"); | 82 static Image* soundLevel0 = platformResource("mediaplayerSoundLevel0"); |
| 82 static Image* soundDisabled = platformResource("mediaplayerSoundDisabled"); | 83 static Image* soundDisabled = platformResource("mediaplayerSoundDisabled"); |
| 83 | 84 |
| 84 if (!hasSource(mediaElement) || !mediaElement->hasAudio()) | 85 if (!hasSource(mediaElement) || !mediaElement->hasAudio()) |
| 85 return paintMediaButton(paintInfo.context, rect, soundDisabled); | 86 return paintMediaButton(paintInfo.context, rect, soundDisabled); |
| 86 | 87 |
| 87 if (mediaElement->muted() || mediaElement->volume() <= 0) | 88 if (mediaElement->muted() || mediaElement->volume() <= 0) |
| 88 return paintMediaButton(paintInfo.context, rect, soundLevel0); | 89 return paintMediaButton(paintInfo.context, rect, soundLevel0); |
| 89 | 90 |
| 90 if (mediaElement->volume() <= 0.33) | 91 if (mediaElement->volume() <= 0.33) |
| 91 return paintMediaButton(paintInfo.context, rect, soundLevel1); | 92 return paintMediaButton(paintInfo.context, rect, soundLevel1); |
| 92 | 93 |
| 93 if (mediaElement->volume() <= 0.66) | 94 if (mediaElement->volume() <= 0.66) |
| 94 return paintMediaButton(paintInfo.context, rect, soundLevel2); | 95 return paintMediaButton(paintInfo.context, rect, soundLevel2); |
| 95 | 96 |
| 96 return paintMediaButton(paintInfo.context, rect, soundLevel3); | 97 return paintMediaButton(paintInfo.context, rect, soundLevel3); |
| 97 } | 98 } |
| 98 | 99 |
| 99 static bool paintMediaPlayButton(LayoutObject* object, const PaintInfo& paintInf
o, const IntRect& rect) | 100 bool MediaControlsPainter::paintMediaPlayButton(LayoutObject* object, const Pain
tInfo& paintInfo, const IntRect& rect) |
| 100 { | 101 { |
| 101 HTMLMediaElement* mediaElement = toParentMediaElement(object); | 102 HTMLMediaElement* mediaElement = toParentMediaElement(object); |
| 102 if (!mediaElement) | 103 if (!mediaElement) |
| 103 return false; | 104 return false; |
| 104 | 105 |
| 105 static Image* mediaPlay = platformResource("mediaplayerPlay"); | 106 static Image* mediaPlay = platformResource("mediaplayerPlay"); |
| 106 static Image* mediaPause = platformResource("mediaplayerPause"); | 107 static Image* mediaPause = platformResource("mediaplayerPause"); |
| 107 static Image* mediaPlayDisabled = platformResource("mediaplayerPlayDisabled"
); | 108 static Image* mediaPlayDisabled = platformResource("mediaplayerPlayDisabled"
); |
| 108 | 109 |
| 109 if (!hasSource(mediaElement)) | 110 if (!hasSource(mediaElement)) |
| 110 return paintMediaButton(paintInfo.context, rect, mediaPlayDisabled); | 111 return paintMediaButton(paintInfo.context, rect, mediaPlayDisabled); |
| 111 | 112 |
| 112 Image * image = !object->node()->isMediaControlElement() || mediaControlElem
entType(object->node()) == MediaPlayButton ? mediaPlay : mediaPause; | 113 Image * image = !object->node()->isMediaControlElement() || mediaControlElem
entType(object->node()) == MediaPlayButton ? mediaPlay : mediaPause; |
| 113 return paintMediaButton(paintInfo.context, rect, image); | 114 return paintMediaButton(paintInfo.context, rect, image); |
| 114 } | 115 } |
| 115 | 116 |
| 116 static bool paintMediaOverlayPlayButton(LayoutObject* object, const PaintInfo& p
aintInfo, const IntRect& rect) | 117 bool MediaControlsPainter::paintMediaOverlayPlayButton(LayoutObject* object, con
st PaintInfo& paintInfo, const IntRect& rect) |
| 117 { | 118 { |
| 118 HTMLMediaElement* mediaElement = toParentMediaElement(object); | 119 HTMLMediaElement* mediaElement = toParentMediaElement(object); |
| 119 if (!mediaElement) | 120 if (!mediaElement) |
| 120 return false; | 121 return false; |
| 121 | 122 |
| 122 if (!hasSource(mediaElement) || !mediaElement->togglePlayStateWillPlay()) | 123 if (!hasSource(mediaElement) || !mediaElement->togglePlayStateWillPlay()) |
| 123 return false; | 124 return false; |
| 124 | 125 |
| 125 static Image* mediaOverlayPlay = platformResource("mediaplayerOverlayPlay"); | 126 static Image* mediaOverlayPlay = platformResource("mediaplayerOverlayPlay"); |
| 126 return paintMediaButton(paintInfo.context, rect, mediaOverlayPlay); | 127 return paintMediaButton(paintInfo.context, rect, mediaOverlayPlay); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 else if (endOffset < borderRadius) | 190 else if (endOffset < borderRadius) |
| 190 context->fillRoundedRect(FloatRoundedRect(highlightRect, IntSize(0, 0),
radii, IntSize(0, 0), radii), startColor); | 191 context->fillRoundedRect(FloatRoundedRect(highlightRect, IntSize(0, 0),
radii, IntSize(0, 0), radii), startColor); |
| 191 else | 192 else |
| 192 context->fillRect(highlightRect); | 193 context->fillRect(highlightRect); |
| 193 | 194 |
| 194 context->restore(); | 195 context->restore(); |
| 195 } | 196 } |
| 196 | 197 |
| 197 const int mediaSliderThumbWidth = 32; | 198 const int mediaSliderThumbWidth = 32; |
| 198 | 199 |
| 199 static bool paintMediaSlider(LayoutObject* object, const PaintInfo& paintInfo, c
onst IntRect& rect) | 200 bool MediaControlsPainter::paintMediaSlider(LayoutObject* object, const PaintInf
o& paintInfo, const IntRect& rect) |
| 200 { | 201 { |
| 201 HTMLMediaElement* mediaElement = toParentMediaElement(object); | 202 HTMLMediaElement* mediaElement = toParentMediaElement(object); |
| 202 if (!mediaElement) | 203 if (!mediaElement) |
| 203 return false; | 204 return false; |
| 204 | 205 |
| 205 const ComputedStyle& style = object->styleRef(); | 206 const ComputedStyle& style = object->styleRef(); |
| 206 GraphicsContext* context = paintInfo.context; | 207 GraphicsContext* context = paintInfo.context; |
| 207 | 208 |
| 208 paintRoundedSliderBackground(rect, style, context); | 209 paintRoundedSliderBackground(rect, style, context); |
| 209 | 210 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 | 250 |
| 250 if (endPosition > currentPosition) | 251 if (endPosition > currentPosition) |
| 251 paintSliderRangeHighlight(rect, style, context, currentPosition, end
Position, startColor, endColor); | 252 paintSliderRangeHighlight(rect, style, context, currentPosition, end
Position, startColor, endColor); |
| 252 | 253 |
| 253 return true; | 254 return true; |
| 254 } | 255 } |
| 255 | 256 |
| 256 return true; | 257 return true; |
| 257 } | 258 } |
| 258 | 259 |
| 259 static bool paintMediaSliderThumb(LayoutObject* object, const PaintInfo& paintIn
fo, const IntRect& rect) | 260 bool MediaControlsPainter::paintMediaSliderThumb(LayoutObject* object, const Pai
ntInfo& paintInfo, const IntRect& rect) |
| 260 { | 261 { |
| 261 if (!object->node()) | 262 if (!object->node()) |
| 262 return false; | 263 return false; |
| 263 | 264 |
| 264 HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadow
Host()); | 265 HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadow
Host()); |
| 265 if (!mediaElement) | 266 if (!mediaElement) |
| 266 return false; | 267 return false; |
| 267 | 268 |
| 268 if (!hasSource(mediaElement)) | 269 if (!hasSource(mediaElement)) |
| 269 return true; | 270 return true; |
| 270 | 271 |
| 271 Image* mediaSliderThumb = getMediaSliderThumb(); | 272 Image* mediaSliderThumb = getMediaSliderThumb(); |
| 272 return paintMediaButton(paintInfo.context, rect, mediaSliderThumb); | 273 return paintMediaButton(paintInfo.context, rect, mediaSliderThumb); |
| 273 } | 274 } |
| 274 | 275 |
| 275 const int mediaVolumeSliderThumbWidth = 24; | 276 const int mediaVolumeSliderThumbWidth = 24; |
| 276 | 277 |
| 277 static bool paintMediaVolumeSlider(LayoutObject* object, const PaintInfo& paintI
nfo, const IntRect& rect) | 278 bool MediaControlsPainter::paintMediaVolumeSlider(LayoutObject* object, const Pa
intInfo& paintInfo, const IntRect& rect) |
| 278 { | 279 { |
| 279 HTMLMediaElement* mediaElement = toParentMediaElement(object); | 280 HTMLMediaElement* mediaElement = toParentMediaElement(object); |
| 280 if (!mediaElement) | 281 if (!mediaElement) |
| 281 return false; | 282 return false; |
| 282 | 283 |
| 283 GraphicsContext* context = paintInfo.context; | 284 GraphicsContext* context = paintInfo.context; |
| 284 const ComputedStyle& style = object->styleRef(); | 285 const ComputedStyle& style = object->styleRef(); |
| 285 | 286 |
| 286 paintRoundedSliderBackground(rect, style, context); | 287 paintRoundedSliderBackground(rect, style, context); |
| 287 | 288 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 304 } | 305 } |
| 305 | 306 |
| 306 Color startColor = Color(195, 195, 195); | 307 Color startColor = Color(195, 195, 195); |
| 307 Color endColor = Color(217, 217, 217); | 308 Color endColor = Color(217, 217, 217); |
| 308 | 309 |
| 309 paintSliderRangeHighlight(rect, style, context, 0.0, fillWidth, startColor,
endColor); | 310 paintSliderRangeHighlight(rect, style, context, 0.0, fillWidth, startColor,
endColor); |
| 310 | 311 |
| 311 return true; | 312 return true; |
| 312 } | 313 } |
| 313 | 314 |
| 314 static bool paintMediaVolumeSliderThumb(LayoutObject* object, const PaintInfo& p
aintInfo, const IntRect& rect) | 315 bool MediaControlsPainter::paintMediaVolumeSliderThumb(LayoutObject* object, con
st PaintInfo& paintInfo, const IntRect& rect) |
| 315 { | 316 { |
| 316 if (!object->node()) | 317 if (!object->node()) |
| 317 return false; | 318 return false; |
| 318 | 319 |
| 319 HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadow
Host()); | 320 HTMLMediaElement* mediaElement = toParentMediaElement(object->node()->shadow
Host()); |
| 320 if (!mediaElement) | 321 if (!mediaElement) |
| 321 return false; | 322 return false; |
| 322 | 323 |
| 323 if (!hasSource(mediaElement) || !mediaElement->hasAudio()) | 324 if (!hasSource(mediaElement) || !mediaElement->hasAudio()) |
| 324 return true; | 325 return true; |
| 325 | 326 |
| 326 static Image* mediaVolumeSliderThumb = platformResource("mediaplayerVolumeSl
iderThumb"); | 327 static Image* mediaVolumeSliderThumb = platformResource("mediaplayerVolumeSl
iderThumb"); |
| 327 return paintMediaButton(paintInfo.context, rect, mediaVolumeSliderThumb); | 328 return paintMediaButton(paintInfo.context, rect, mediaVolumeSliderThumb); |
| 328 } | 329 } |
| 329 | 330 |
| 330 static bool paintMediaFullscreenButton(LayoutObject* object, const PaintInfo& pa
intInfo, const IntRect& rect) | 331 bool MediaControlsPainter::paintMediaFullscreenButton(LayoutObject* object, cons
t PaintInfo& paintInfo, const IntRect& rect) |
| 331 { | 332 { |
| 332 HTMLMediaElement* mediaElement = toParentMediaElement(object); | 333 HTMLMediaElement* mediaElement = toParentMediaElement(object); |
| 333 if (!mediaElement) | 334 if (!mediaElement) |
| 334 return false; | 335 return false; |
| 335 | 336 |
| 336 static Image* mediaFullscreenButton = platformResource("mediaplayerFullscree
n"); | 337 static Image* mediaFullscreenButton = platformResource("mediaplayerFullscree
n"); |
| 337 return paintMediaButton(paintInfo.context, rect, mediaFullscreenButton); | 338 return paintMediaButton(paintInfo.context, rect, mediaFullscreenButton); |
| 338 } | 339 } |
| 339 | 340 |
| 340 static bool paintMediaToggleClosedCaptionsButton(LayoutObject* object, const Pai
ntInfo& paintInfo, const IntRect& rect) | 341 bool MediaControlsPainter::paintMediaToggleClosedCaptionsButton(LayoutObject* ob
ject, const PaintInfo& paintInfo, const IntRect& rect) |
| 341 { | 342 { |
| 342 HTMLMediaElement* mediaElement = toParentMediaElement(object); | 343 HTMLMediaElement* mediaElement = toParentMediaElement(object); |
| 343 if (!mediaElement) | 344 if (!mediaElement) |
| 344 return false; | 345 return false; |
| 345 | 346 |
| 346 static Image* mediaClosedCaptionButton = platformResource("mediaplayerClosed
Caption"); | 347 static Image* mediaClosedCaptionButton = platformResource("mediaplayerClosed
Caption"); |
| 347 static Image* mediaClosedCaptionButtonDisabled = platformResource("mediaplay
erClosedCaptionDisabled"); | 348 static Image* mediaClosedCaptionButtonDisabled = platformResource("mediaplay
erClosedCaptionDisabled"); |
| 348 | 349 |
| 349 if (mediaElement->closedCaptionsVisible()) | 350 if (mediaElement->closedCaptionsVisible()) |
| 350 return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButto
n); | 351 return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButto
n); |
| 351 | 352 |
| 352 return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButtonDis
abled); | 353 return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButtonDis
abled); |
| 353 } | 354 } |
| 354 static bool paintMediaCastButton(LayoutObject* object, const PaintInfo& paintInf
o, const IntRect& rect) | 355 |
| 356 bool MediaControlsPainter::paintMediaCastButton(LayoutObject* object, const Pain
tInfo& paintInfo, const IntRect& rect) |
| 355 { | 357 { |
| 356 HTMLMediaElement* mediaElement = toParentMediaElement(object); | 358 HTMLMediaElement* mediaElement = toParentMediaElement(object); |
| 357 if (!mediaElement) | 359 if (!mediaElement) |
| 358 return false; | 360 return false; |
| 359 | 361 |
| 360 static Image* mediaCastOn = platformResource("mediaplayerCastOn"); | 362 static Image* mediaCastOn = platformResource("mediaplayerCastOn"); |
| 361 static Image* mediaCastOff = platformResource("mediaplayerCastOff"); | 363 static Image* mediaCastOff = platformResource("mediaplayerCastOff"); |
| 362 // To ensure that the overlaid cast button is visible when overlaid on pale
videos we use a | 364 // To ensure that the overlaid cast button is visible when overlaid on pale
videos we use a |
| 363 // different version of it for the overlaid case with a semi-opaque backgrou
nd. | 365 // different version of it for the overlaid case with a semi-opaque backgrou
nd. |
| 364 static Image* mediaOverlayCastOff = platformResource("mediaplayerOverlayCast
Off"); | 366 static Image* mediaOverlayCastOff = platformResource("mediaplayerOverlayCast
Off"); |
| 365 | 367 |
| 366 switch (mediaControlElementType(object->node())) { | 368 switch (mediaControlElementType(object->node())) { |
| 367 case MediaCastOnButton: | 369 case MediaCastOnButton: |
| 368 case MediaOverlayCastOnButton: | 370 case MediaOverlayCastOnButton: |
| 369 return paintMediaButton(paintInfo.context, rect, mediaCastOn); | 371 return paintMediaButton(paintInfo.context, rect, mediaCastOn); |
| 370 case MediaCastOffButton: | 372 case MediaCastOffButton: |
| 371 return paintMediaButton(paintInfo.context, rect, mediaCastOff); | 373 return paintMediaButton(paintInfo.context, rect, mediaCastOff); |
| 372 case MediaOverlayCastOffButton: | 374 case MediaOverlayCastOffButton: |
| 373 return paintMediaButton(paintInfo.context, rect, mediaOverlayCastOff); | 375 return paintMediaButton(paintInfo.context, rect, mediaOverlayCastOff); |
| 374 default: | 376 default: |
| 375 ASSERT_NOT_REACHED(); | 377 ASSERT_NOT_REACHED(); |
| 376 return false; | 378 return false; |
| 377 } | 379 } |
| 378 } | 380 } |
| 379 | 381 |
| 380 bool MediaControlsPainter::paintMediaControlsPart(MediaControlElementType part,
LayoutObject* object, const PaintInfo& paintInfo, const IntRect& rect) | |
| 381 { | |
| 382 switch (part) { | |
| 383 case MediaMuteButton: | |
| 384 case MediaUnMuteButton: | |
| 385 return paintMediaMuteButton(object, paintInfo, rect); | |
| 386 case MediaPauseButton: | |
| 387 case MediaPlayButton: | |
| 388 return paintMediaPlayButton(object, paintInfo, rect); | |
| 389 case MediaShowClosedCaptionsButton: | |
| 390 return paintMediaToggleClosedCaptionsButton(object, paintInfo, rect); | |
| 391 case MediaSlider: | |
| 392 return paintMediaSlider(object, paintInfo, rect); | |
| 393 case MediaSliderThumb: | |
| 394 return paintMediaSliderThumb(object, paintInfo, rect); | |
| 395 case MediaVolumeSlider: | |
| 396 return paintMediaVolumeSlider(object, paintInfo, rect); | |
| 397 case MediaVolumeSliderThumb: | |
| 398 return paintMediaVolumeSliderThumb(object, paintInfo, rect); | |
| 399 case MediaEnterFullscreenButton: | |
| 400 case MediaExitFullscreenButton: | |
| 401 return paintMediaFullscreenButton(object, paintInfo, rect); | |
| 402 case MediaOverlayPlayButton: | |
| 403 return paintMediaOverlayPlayButton(object, paintInfo, rect); | |
| 404 case MediaCastOffButton: | |
| 405 case MediaCastOnButton: | |
| 406 case MediaOverlayCastOffButton: | |
| 407 case MediaOverlayCastOnButton: | |
| 408 return paintMediaCastButton(object, paintInfo, rect); | |
| 409 case MediaVolumeSliderContainer: | |
| 410 case MediaTimelineContainer: | |
| 411 case MediaCurrentTimeDisplay: | |
| 412 case MediaTimeRemainingDisplay: | |
| 413 case MediaControlsPanel: | |
| 414 case MediaHideClosedCaptionsButton: | |
| 415 case MediaFullScreenVolumeSlider: | |
| 416 case MediaFullScreenVolumeSliderThumb: | |
| 417 ASSERT_NOT_REACHED(); | |
| 418 break; | |
| 419 } | |
| 420 return false; | |
| 421 } | |
| 422 | |
| 423 const int mediaSliderThumbHeight = 24; | 382 const int mediaSliderThumbHeight = 24; |
| 424 const int mediaVolumeSliderThumbHeight = 24; | 383 const int mediaVolumeSliderThumbHeight = 24; |
| 425 | 384 |
| 426 void MediaControlsPainter::adjustMediaSliderThumbSize(ComputedStyle& style) | 385 void MediaControlsPainter::adjustMediaSliderThumbSize(ComputedStyle& style) |
| 427 { | 386 { |
| 428 static Image* mediaSliderThumb = platformResource("mediaplayerSliderThumb"); | 387 static Image* mediaSliderThumb = platformResource("mediaplayerSliderThumb"); |
| 429 static Image* mediaVolumeSliderThumb = platformResource("mediaplayerVolumeSl
iderThumb"); | 388 static Image* mediaVolumeSliderThumb = platformResource("mediaplayerVolumeSl
iderThumb"); |
| 430 int width = 0; | 389 int width = 0; |
| 431 int height = 0; | 390 int height = 0; |
| 432 | 391 |
| 433 Image* thumbImage = 0; | 392 Image* thumbImage = 0; |
| 434 if (style.appearance() == MediaSliderThumbPart) { | 393 if (style.appearance() == MediaSliderThumbPart) { |
| 435 thumbImage = mediaSliderThumb; | 394 thumbImage = mediaSliderThumb; |
| 436 width = mediaSliderThumbWidth; | 395 width = mediaSliderThumbWidth; |
| 437 height = mediaSliderThumbHeight; | 396 height = mediaSliderThumbHeight; |
| 438 } else if (style.appearance() == MediaVolumeSliderThumbPart) { | 397 } else if (style.appearance() == MediaVolumeSliderThumbPart) { |
| 439 thumbImage = mediaVolumeSliderThumb; | 398 thumbImage = mediaVolumeSliderThumb; |
| 440 width = mediaVolumeSliderThumbWidth; | 399 width = mediaVolumeSliderThumbWidth; |
| 441 height = mediaVolumeSliderThumbHeight; | 400 height = mediaVolumeSliderThumbHeight; |
| 442 } | 401 } |
| 443 | 402 |
| 444 float zoomLevel = style.effectiveZoom(); | 403 float zoomLevel = style.effectiveZoom(); |
| 445 if (thumbImage) { | 404 if (thumbImage) { |
| 446 style.setWidth(Length(static_cast<int>(width * zoomLevel), Fixed)); | 405 style.setWidth(Length(static_cast<int>(width * zoomLevel), Fixed)); |
| 447 style.setHeight(Length(static_cast<int>(height * zoomLevel), Fixed)); | 406 style.setHeight(Length(static_cast<int>(height * zoomLevel), Fixed)); |
| 448 } | 407 } |
| 449 } | 408 } |
| 450 | 409 |
| 451 } // namespace blink | 410 } // namespace blink |
| OLD | NEW |