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 27 matching lines...) Expand all Loading... |
38 #include "platform/graphics/GraphicsContext.h" | 38 #include "platform/graphics/GraphicsContext.h" |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 static const double kCurrentTimeBufferedDelta = 1.0; | 42 static const double kCurrentTimeBufferedDelta = 1.0; |
43 | 43 |
44 typedef WTF::HashMap<const char*, Image*> MediaControlImageMap; | 44 typedef WTF::HashMap<const char*, Image*> MediaControlImageMap; |
45 static MediaControlImageMap* gMediaControlImageMap = 0; | 45 static MediaControlImageMap* gMediaControlImageMap = 0; |
46 | 46 |
47 // Slider thumb sizes, shard between time and volume. | 47 // Slider thumb sizes, shard between time and volume. |
48 static const int mediaSliderThumbTouchWidthNew = 36; // Touch zone size. | 48 static const int mediaSliderThumbTouchWidth = 36; // Touch zone size. |
49 static const int mediaSliderThumbTouchHeightNew = 48; | 49 static const int mediaSliderThumbTouchHeight = 48; |
50 static const int mediaSliderThumbPaintWidthNew = 12; // Painted area. | 50 static const int mediaSliderThumbPaintWidth = 12; // Painted area. |
51 static const int mediaSliderThumbPaintHeightNew = 12; | 51 static const int mediaSliderThumbPaintHeight = 12; |
52 | 52 |
53 // Overlay play button size. | 53 // Overlay play button size. |
54 static const int mediaOverlayPlayButtonWidthNew = 48; | 54 static const int mediaOverlayPlayButtonWidth = 48; |
55 static const int mediaOverlayPlayButtonHeightNew = 48; | 55 static const int mediaOverlayPlayButtonHeight = 48; |
56 | 56 |
57 // Alpha for disabled elements. | 57 // Alpha for disabled elements. |
58 static const float kDisabledAlpha = 0.4; | 58 static const float kDisabledAlpha = 0.4; |
59 | 59 |
60 static Image* platformResource(const char* name) { | 60 static Image* platformResource(const char* name) { |
61 if (!gMediaControlImageMap) | 61 if (!gMediaControlImageMap) |
62 gMediaControlImageMap = new MediaControlImageMap(); | 62 gMediaControlImageMap = new MediaControlImageMap(); |
63 if (Image* image = gMediaControlImageMap->get(name)) | 63 if (Image* image = gMediaControlImageMap->get(name)) |
64 return image; | 64 return image; |
65 if (Image* image = Image::loadPlatformResource(name).leakRef()) { | 65 if (Image* image = Image::loadPlatformResource(name).leakRef()) { |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 return paintMediaButton(context, rect, image, 0, isEnabled); | 121 return paintMediaButton(context, rect, image, 0, isEnabled); |
122 } | 122 } |
123 | 123 |
124 bool MediaControlsPainter::paintMediaMuteButton(const LayoutObject& object, | 124 bool MediaControlsPainter::paintMediaMuteButton(const LayoutObject& object, |
125 const PaintInfo& paintInfo, | 125 const PaintInfo& paintInfo, |
126 const IntRect& rect) { | 126 const IntRect& rect) { |
127 const HTMLMediaElement* mediaElement = toParentMediaElement(object); | 127 const HTMLMediaElement* mediaElement = toParentMediaElement(object); |
128 if (!mediaElement) | 128 if (!mediaElement) |
129 return false; | 129 return false; |
130 | 130 |
131 // The new UI uses "muted" and "not muted" only. | 131 static Image* soundNotMuted = platformResource("mediaplayerSoundNotMuted"); |
132 static Image* soundLevel3 = platformResource("mediaplayerSoundLevel3New"); | 132 static Image* soundMuted = platformResource("mediaplayerSoundMuted"); |
133 static Image* soundLevel2 = platformResource("mediaplayerSoundLevel3New"); | |
134 static Image* soundLevel1 = platformResource("mediaplayerSoundLevel3New"); | |
135 static Image* soundLevel0 = platformResource("mediaplayerSoundLevel0New"); | |
136 static Image* soundDisabled = platformResource("mediaplayerSoundLevel0New"); | |
137 | 133 |
138 if (!hasSource(mediaElement) || !mediaElement->hasAudio()) | 134 if (!hasSource(mediaElement) || !mediaElement->hasAudio()) { |
139 return paintMediaButton(paintInfo.context, rect, soundDisabled, &object, | 135 return paintMediaButton(paintInfo.context, rect, soundMuted, &object, |
140 false); | 136 false); |
| 137 } |
141 | 138 |
142 if (mediaElement->muted() || mediaElement->volume() <= 0) | 139 if (mediaElement->muted() || mediaElement->volume() <= 0) |
143 return paintMediaButton(paintInfo.context, rect, soundLevel0, &object, | 140 return paintMediaButton(paintInfo.context, rect, soundMuted, &object, true); |
144 true); | |
145 | 141 |
146 if (mediaElement->volume() <= 0.33) | 142 return paintMediaButton(paintInfo.context, rect, soundNotMuted, &object, |
147 return paintMediaButton(paintInfo.context, rect, soundLevel1, &object, | 143 true); |
148 true); | |
149 | |
150 if (mediaElement->volume() <= 0.66) | |
151 return paintMediaButton(paintInfo.context, rect, soundLevel2, &object, | |
152 true); | |
153 | |
154 return paintMediaButton(paintInfo.context, rect, soundLevel3, &object, true); | |
155 } | 144 } |
156 | 145 |
157 bool MediaControlsPainter::paintMediaPlayButton(const LayoutObject& object, | 146 bool MediaControlsPainter::paintMediaPlayButton(const LayoutObject& object, |
158 const PaintInfo& paintInfo, | 147 const PaintInfo& paintInfo, |
159 const IntRect& rect) { | 148 const IntRect& rect) { |
160 const HTMLMediaElement* mediaElement = toParentMediaElement(object); | 149 const HTMLMediaElement* mediaElement = toParentMediaElement(object); |
161 if (!mediaElement) | 150 if (!mediaElement) |
162 return false; | 151 return false; |
163 | 152 |
164 static Image* mediaPlay = platformResource("mediaplayerPlayNew"); | 153 static Image* mediaPlay = platformResource("mediaplayerPlay"); |
165 static Image* mediaPause = platformResource("mediaplayerPauseNew"); | 154 static Image* mediaPause = platformResource("mediaplayerPause"); |
166 // For this case, the new UI draws the normal icon, but the entire panel | |
167 // grays out. | |
168 static Image* mediaPlayDisabled = platformResource("mediaplayerPlayNew"); | |
169 | 155 |
| 156 // Draw the regular play button grayed out. |
170 if (!hasSource(mediaElement)) | 157 if (!hasSource(mediaElement)) |
171 return paintMediaButton(paintInfo.context, rect, mediaPlayDisabled, &object, | 158 return paintMediaButton(paintInfo.context, rect, mediaPlay, &object, false); |
172 false); | |
173 | 159 |
174 Image* image = | 160 Image* image = |
175 !object.node()->isMediaControlElement() || | 161 !object.node()->isMediaControlElement() || |
176 mediaControlElementType(object.node()) == MediaPlayButton | 162 mediaControlElementType(object.node()) == MediaPlayButton |
177 ? mediaPlay | 163 ? mediaPlay |
178 : mediaPause; | 164 : mediaPause; |
179 return paintMediaButton(paintInfo.context, rect, image, &object, true); | 165 return paintMediaButton(paintInfo.context, rect, image, &object, true); |
180 } | 166 } |
181 | 167 |
182 bool MediaControlsPainter::paintMediaOverlayPlayButton( | 168 bool MediaControlsPainter::paintMediaOverlayPlayButton( |
183 const LayoutObject& object, | 169 const LayoutObject& object, |
184 const PaintInfo& paintInfo, | 170 const PaintInfo& paintInfo, |
185 const IntRect& rect) { | 171 const IntRect& rect) { |
186 const HTMLMediaElement* mediaElement = toParentMediaElement(object); | 172 const HTMLMediaElement* mediaElement = toParentMediaElement(object); |
187 if (!mediaElement) | 173 if (!mediaElement) |
188 return false; | 174 return false; |
189 | 175 |
190 if (!hasSource(mediaElement) || !mediaElement->paused()) | 176 if (!hasSource(mediaElement) || !mediaElement->paused()) |
191 return false; | 177 return false; |
192 | 178 |
193 static Image* mediaOverlayPlay = | 179 static Image* mediaOverlayPlay = platformResource("mediaplayerOverlayPlay"); |
194 platformResource("mediaplayerOverlayPlayNew"); | |
195 | 180 |
196 IntRect buttonRect(rect); | 181 IntRect buttonRect(rect); |
197 | 182 |
198 // Overlay play button covers the entire player, so center and draw a | 183 // Overlay play button covers the entire player, so center and draw a |
199 // smaller button. Center in the entire element. | 184 // smaller button. Center in the entire element. |
200 // TODO(liberato): object.enclosingBox()? | 185 // TODO(liberato): object.enclosingBox()? |
201 const LayoutBox* box = mediaElement->layoutObject()->enclosingBox(); | 186 const LayoutBox* box = mediaElement->layoutObject()->enclosingBox(); |
202 if (!box) | 187 if (!box) |
203 return false; | 188 return false; |
204 int mediaHeight = box->pixelSnappedHeight(); | 189 int mediaHeight = box->pixelSnappedHeight(); |
205 buttonRect.setX(rect.center().x() - mediaOverlayPlayButtonWidthNew / 2); | 190 buttonRect.setX(rect.center().x() - mediaOverlayPlayButtonWidth / 2); |
206 buttonRect.setY(rect.center().y() - mediaOverlayPlayButtonHeightNew / 2 + | 191 buttonRect.setY(rect.center().y() - mediaOverlayPlayButtonHeight / 2 + |
207 (mediaHeight - rect.height()) / 2); | 192 (mediaHeight - rect.height()) / 2); |
208 buttonRect.setWidth(mediaOverlayPlayButtonWidthNew); | 193 buttonRect.setWidth(mediaOverlayPlayButtonWidth); |
209 buttonRect.setHeight(mediaOverlayPlayButtonHeightNew); | 194 buttonRect.setHeight(mediaOverlayPlayButtonHeight); |
210 | 195 |
211 return paintMediaButton(paintInfo.context, buttonRect, mediaOverlayPlay); | 196 return paintMediaButton(paintInfo.context, buttonRect, mediaOverlayPlay); |
212 } | 197 } |
213 | 198 |
214 static void paintRoundedSliderBackground(const IntRect& rect, | 199 static void paintRoundedSliderBackground(const IntRect& rect, |
215 const ComputedStyle& style, | 200 const ComputedStyle& style, |
216 GraphicsContext& context, | 201 GraphicsContext& context, |
217 Color sliderBackgroundColor) { | 202 Color sliderBackgroundColor) { |
218 float borderRadius = rect.height() / 2; | 203 float borderRadius = rect.height() / 2; |
219 FloatSize radii(borderRadius, borderRadius); | 204 FloatSize radii(borderRadius, borderRadius); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 const IntRect& rect, | 358 const IntRect& rect, |
374 const ComputedStyle& style, | 359 const ComputedStyle& style, |
375 IntRect& rectOut) { | 360 IntRect& rectOut) { |
376 // Adjust the rectangle to be centered, the right size for the image. | 361 // Adjust the rectangle to be centered, the right size for the image. |
377 // We do this because it's quite hard to get the thumb touch target | 362 // We do this because it's quite hard to get the thumb touch target |
378 // to match. So, we provide the touch target size with | 363 // to match. So, we provide the touch target size with |
379 // adjustMediaSliderThumbSize(), and scale it back when we paint. | 364 // adjustMediaSliderThumbSize(), and scale it back when we paint. |
380 rectOut = rect; | 365 rectOut = rect; |
381 | 366 |
382 const float zoomLevel = style.effectiveZoom(); | 367 const float zoomLevel = style.effectiveZoom(); |
383 const float zoomedPaintWidth = mediaSliderThumbPaintWidthNew * zoomLevel; | 368 const float zoomedPaintWidth = mediaSliderThumbPaintWidth * zoomLevel; |
384 const float zoomedPaintHeight = mediaSliderThumbPaintHeightNew * zoomLevel; | 369 const float zoomedPaintHeight = mediaSliderThumbPaintHeight * zoomLevel; |
385 | 370 |
386 rectOut.setX(rect.center().x() - zoomedPaintWidth / 2); | 371 rectOut.setX(rect.center().x() - zoomedPaintWidth / 2); |
387 rectOut.setY(rect.center().y() - zoomedPaintHeight / 2); | 372 rectOut.setY(rect.center().y() - zoomedPaintHeight / 2); |
388 rectOut.setWidth(zoomedPaintWidth); | 373 rectOut.setWidth(zoomedPaintWidth); |
389 rectOut.setHeight(zoomedPaintHeight); | 374 rectOut.setHeight(zoomedPaintHeight); |
390 } | 375 } |
391 | 376 |
392 bool MediaControlsPainter::paintMediaSliderThumb(const LayoutObject& object, | 377 bool MediaControlsPainter::paintMediaSliderThumb(const LayoutObject& object, |
393 const PaintInfo& paintInfo, | 378 const PaintInfo& paintInfo, |
394 const IntRect& rect) { | 379 const IntRect& rect) { |
395 if (!object.node()) | 380 if (!object.node()) |
396 return false; | 381 return false; |
397 | 382 |
398 const HTMLMediaElement* mediaElement = | 383 const HTMLMediaElement* mediaElement = |
399 toParentMediaElement(object.node()->ownerShadowHost()); | 384 toParentMediaElement(object.node()->ownerShadowHost()); |
400 if (!mediaElement) | 385 if (!mediaElement) |
401 return false; | 386 return false; |
402 | 387 |
403 if (!hasSource(mediaElement)) | 388 if (!hasSource(mediaElement)) |
404 return true; | 389 return true; |
405 | 390 |
406 static Image* mediaSliderThumb = | 391 static Image* mediaSliderThumb = platformResource("mediaplayerSliderThumb"); |
407 platformResource("mediaplayerSliderThumbNew"); | |
408 IntRect paintRect; | 392 IntRect paintRect; |
409 const ComputedStyle& style = object.styleRef(); | 393 const ComputedStyle& style = object.styleRef(); |
410 adjustMediaSliderThumbPaintSize(rect, style, paintRect); | 394 adjustMediaSliderThumbPaintSize(rect, style, paintRect); |
411 return paintMediaButton(paintInfo.context, paintRect, mediaSliderThumb); | 395 return paintMediaButton(paintInfo.context, paintRect, mediaSliderThumb); |
412 } | 396 } |
413 | 397 |
414 bool MediaControlsPainter::paintMediaVolumeSlider(const LayoutObject& object, | 398 bool MediaControlsPainter::paintMediaVolumeSlider(const LayoutObject& object, |
415 const PaintInfo& paintInfo, | 399 const PaintInfo& paintInfo, |
416 const IntRect& rect) { | 400 const IntRect& rect) { |
417 const HTMLMediaElement* mediaElement = toParentMediaElement(object); | 401 const HTMLMediaElement* mediaElement = toParentMediaElement(object); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 | 436 |
453 const HTMLMediaElement* mediaElement = | 437 const HTMLMediaElement* mediaElement = |
454 toParentMediaElement(object.node()->ownerShadowHost()); | 438 toParentMediaElement(object.node()->ownerShadowHost()); |
455 if (!mediaElement) | 439 if (!mediaElement) |
456 return false; | 440 return false; |
457 | 441 |
458 if (!hasSource(mediaElement) || !mediaElement->hasAudio()) | 442 if (!hasSource(mediaElement) || !mediaElement->hasAudio()) |
459 return true; | 443 return true; |
460 | 444 |
461 static Image* mediaVolumeSliderThumb = | 445 static Image* mediaVolumeSliderThumb = |
462 platformResource("mediaplayerVolumeSliderThumbNew"); | 446 platformResource("mediaplayerVolumeSliderThumb"); |
463 | 447 |
464 IntRect paintRect; | 448 IntRect paintRect; |
465 const ComputedStyle& style = object.styleRef(); | 449 const ComputedStyle& style = object.styleRef(); |
466 adjustMediaSliderThumbPaintSize(rect, style, paintRect); | 450 adjustMediaSliderThumbPaintSize(rect, style, paintRect); |
467 return paintMediaButton(paintInfo.context, paintRect, mediaVolumeSliderThumb); | 451 return paintMediaButton(paintInfo.context, paintRect, mediaVolumeSliderThumb); |
468 } | 452 } |
469 | 453 |
470 bool MediaControlsPainter::paintMediaFullscreenButton( | 454 bool MediaControlsPainter::paintMediaFullscreenButton( |
471 const LayoutObject& object, | 455 const LayoutObject& object, |
472 const PaintInfo& paintInfo, | 456 const PaintInfo& paintInfo, |
473 const IntRect& rect) { | 457 const IntRect& rect) { |
474 const HTMLMediaElement* mediaElement = toParentMediaElement(object); | 458 const HTMLMediaElement* mediaElement = toParentMediaElement(object); |
475 if (!mediaElement) | 459 if (!mediaElement) |
476 return false; | 460 return false; |
477 | 461 |
478 // With the new player UI, we have separate assets for enter / exit | |
479 // fullscreen mode. | |
480 static Image* mediaEnterFullscreenButton = | 462 static Image* mediaEnterFullscreenButton = |
481 platformResource("mediaplayerEnterFullscreen"); | 463 platformResource("mediaplayerEnterFullscreen"); |
482 static Image* mediaExitFullscreenButton = | 464 static Image* mediaExitFullscreenButton = |
483 platformResource("mediaplayerExitFullscreen"); | 465 platformResource("mediaplayerExitFullscreen"); |
484 | 466 |
485 bool isEnabled = hasSource(mediaElement); | 467 Image* image = |
486 | 468 (mediaControlElementType(object.node()) == MediaExitFullscreenButton) |
487 if (mediaControlElementType(object.node()) == MediaExitFullscreenButton) | 469 ? mediaExitFullscreenButton |
488 return paintMediaButton(paintInfo.context, rect, mediaExitFullscreenButton, | 470 : mediaEnterFullscreenButton; |
489 &object, isEnabled); | 471 const bool isEnabled = hasSource(mediaElement); |
490 return paintMediaButton(paintInfo.context, rect, mediaEnterFullscreenButton, | 472 return paintMediaButton(paintInfo.context, rect, image, &object, isEnabled); |
491 &object, isEnabled); | |
492 } | 473 } |
493 | 474 |
494 bool MediaControlsPainter::paintMediaToggleClosedCaptionsButton( | 475 bool MediaControlsPainter::paintMediaToggleClosedCaptionsButton( |
495 const LayoutObject& object, | 476 const LayoutObject& object, |
496 const PaintInfo& paintInfo, | 477 const PaintInfo& paintInfo, |
497 const IntRect& rect) { | 478 const IntRect& rect) { |
498 const HTMLMediaElement* mediaElement = toParentMediaElement(object); | 479 const HTMLMediaElement* mediaElement = toParentMediaElement(object); |
499 if (!mediaElement) | 480 if (!mediaElement) |
500 return false; | 481 return false; |
501 | 482 |
502 static Image* mediaClosedCaptionButton = | 483 static Image* mediaClosedCaptionButton = |
503 platformResource("mediaplayerClosedCaptionNew"); | 484 platformResource("mediaplayerClosedCaption"); |
504 static Image* mediaClosedCaptionButtonDisabled = | 485 static Image* mediaClosedCaptionButtonDisabled = |
505 platformResource("mediaplayerClosedCaptionDisabledNew"); | 486 platformResource("mediaplayerClosedCaptionDisabled"); |
506 | 487 |
507 bool isEnabled = mediaElement->hasClosedCaptions(); | 488 Image* image = mediaElement->textTracksVisible() |
508 | 489 ? mediaClosedCaptionButton |
509 if (mediaElement->textTracksVisible()) | 490 : mediaClosedCaptionButtonDisabled; |
510 return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButton, | 491 const bool isEnabled = mediaElement->hasClosedCaptions(); |
511 &object, isEnabled); | 492 return paintMediaButton(paintInfo.context, rect, image, &object, isEnabled); |
512 | |
513 return paintMediaButton(paintInfo.context, rect, | |
514 mediaClosedCaptionButtonDisabled, &object, isEnabled); | |
515 } | 493 } |
516 | 494 |
517 bool MediaControlsPainter::paintMediaCastButton(const LayoutObject& object, | 495 bool MediaControlsPainter::paintMediaCastButton(const LayoutObject& object, |
518 const PaintInfo& paintInfo, | 496 const PaintInfo& paintInfo, |
519 const IntRect& rect) { | 497 const IntRect& rect) { |
520 const HTMLMediaElement* mediaElement = toParentMediaElement(object); | 498 const HTMLMediaElement* mediaElement = toParentMediaElement(object); |
521 if (!mediaElement) | 499 if (!mediaElement) |
522 return false; | 500 return false; |
523 | 501 |
524 static Image* mediaCastOn = platformResource("mediaplayerCastOnNew"); | 502 static Image* mediaCastOn = platformResource("mediaplayerCastOn"); |
525 static Image* mediaCastOff = platformResource("mediaplayerCastOffNew"); | 503 static Image* mediaCastOff = platformResource("mediaplayerCastOff"); |
526 // To ensure that the overlaid cast button is visible when overlaid on pale | 504 // To ensure that the overlaid cast button is visible when overlaid on pale |
527 // videos we use a different version of it for the overlaid case with a | 505 // videos we use a different version of it for the overlaid case with a |
528 // semi-opaque background. | 506 // semi-opaque background. |
529 static Image* mediaOverlayCastOff = | 507 static Image* mediaOverlayCastOff = |
530 platformResource("mediaplayerOverlayCastOffNew"); | 508 platformResource("mediaplayerOverlayCastOff"); |
531 | 509 |
532 bool isEnabled = mediaElement->hasRemoteRoutes(); | 510 bool isEnabled = mediaElement->hasRemoteRoutes(); |
533 | 511 |
534 switch (mediaControlElementType(object.node())) { | 512 switch (mediaControlElementType(object.node())) { |
535 case MediaCastOnButton: | 513 case MediaCastOnButton: |
536 return paintMediaButton(paintInfo.context, rect, mediaCastOn, &object, | 514 return paintMediaButton(paintInfo.context, rect, mediaCastOn, &object, |
537 isEnabled); | 515 isEnabled); |
538 case MediaOverlayCastOnButton: | 516 case MediaOverlayCastOnButton: |
539 return paintMediaButton(paintInfo.context, rect, mediaCastOn); | 517 return paintMediaButton(paintInfo.context, rect, mediaCastOn); |
540 case MediaCastOffButton: | 518 case MediaCastOffButton: |
541 return paintMediaButton(paintInfo.context, rect, mediaCastOff, &object, | 519 return paintMediaButton(paintInfo.context, rect, mediaCastOff, &object, |
542 isEnabled); | 520 isEnabled); |
543 case MediaOverlayCastOffButton: | 521 case MediaOverlayCastOffButton: |
544 return paintMediaButton(paintInfo.context, rect, mediaOverlayCastOff); | 522 return paintMediaButton(paintInfo.context, rect, mediaOverlayCastOff); |
545 default: | 523 default: |
546 ASSERT_NOT_REACHED(); | 524 ASSERT_NOT_REACHED(); |
547 return false; | 525 return false; |
548 } | 526 } |
549 } | 527 } |
550 | 528 |
551 bool MediaControlsPainter::paintMediaTrackSelectionCheckmark( | 529 bool MediaControlsPainter::paintMediaTrackSelectionCheckmark( |
552 const LayoutObject& object, | 530 const LayoutObject& object, |
553 const PaintInfo& paintInfo, | 531 const PaintInfo& paintInfo, |
554 const IntRect& rect) { | 532 const IntRect& rect) { |
555 const HTMLMediaElement* mediaElement = toParentMediaElement(object); | 533 const HTMLMediaElement* mediaElement = toParentMediaElement(object); |
556 if (!mediaElement) | 534 if (!mediaElement) |
557 return false; | 535 return false; |
558 | 536 |
559 static Image* mediaTrackSelectionCheckmark = | 537 static Image* mediaTrackSelectionCheckmark = |
560 platformResource("mediaplayerTrackSelectionCheckmarkNew"); | 538 platformResource("mediaplayerTrackSelectionCheckmark"); |
561 return paintMediaButton(paintInfo.context, rect, | 539 return paintMediaButton(paintInfo.context, rect, |
562 mediaTrackSelectionCheckmark); | 540 mediaTrackSelectionCheckmark); |
563 } | 541 } |
564 | 542 |
565 bool MediaControlsPainter::paintMediaClosedCaptionsIcon( | 543 bool MediaControlsPainter::paintMediaClosedCaptionsIcon( |
566 const LayoutObject& object, | 544 const LayoutObject& object, |
567 const PaintInfo& paintInfo, | 545 const PaintInfo& paintInfo, |
568 const IntRect& rect) { | 546 const IntRect& rect) { |
569 const HTMLMediaElement* mediaElement = toParentMediaElement(object); | 547 const HTMLMediaElement* mediaElement = toParentMediaElement(object); |
570 if (!mediaElement) | 548 if (!mediaElement) |
571 return false; | 549 return false; |
572 | 550 |
573 static Image* mediaClosedCaptionsIcon = | 551 static Image* mediaClosedCaptionsIcon = |
574 platformResource("mediaplayerClosedCaptionsIconNew"); | 552 platformResource("mediaplayerClosedCaptionsIcon"); |
575 return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionsIcon); | 553 return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionsIcon); |
576 } | 554 } |
577 | 555 |
578 bool MediaControlsPainter::paintMediaSubtitlesIcon(const LayoutObject& object, | 556 bool MediaControlsPainter::paintMediaSubtitlesIcon(const LayoutObject& object, |
579 const PaintInfo& paintInfo, | 557 const PaintInfo& paintInfo, |
580 const IntRect& rect) { | 558 const IntRect& rect) { |
581 const HTMLMediaElement* mediaElement = toParentMediaElement(object); | 559 const HTMLMediaElement* mediaElement = toParentMediaElement(object); |
582 if (!mediaElement) | 560 if (!mediaElement) |
583 return false; | 561 return false; |
584 | 562 |
585 static Image* mediaSubtitlesIcon = | 563 static Image* mediaSubtitlesIcon = |
586 platformResource("mediaplayerSubtitlesIconNew"); | 564 platformResource("mediaplayerSubtitlesIcon"); |
587 return paintMediaButton(paintInfo.context, rect, mediaSubtitlesIcon); | 565 return paintMediaButton(paintInfo.context, rect, mediaSubtitlesIcon); |
588 } | 566 } |
589 | 567 |
590 bool MediaControlsPainter::paintMediaOverflowMenu(const LayoutObject& object, | 568 bool MediaControlsPainter::paintMediaOverflowMenu(const LayoutObject& object, |
591 const PaintInfo& paintInfo, | 569 const PaintInfo& paintInfo, |
592 const IntRect& rect) { | 570 const IntRect& rect) { |
593 const HTMLMediaElement* mediaElement = toParentMediaElement(object); | 571 const HTMLMediaElement* mediaElement = toParentMediaElement(object); |
594 if (!mediaElement) | 572 if (!mediaElement) |
595 return false; | 573 return false; |
596 | 574 |
(...skipping 13 matching lines...) Expand all Loading... |
610 bool isEnabled = hasSource(mediaElement); | 588 bool isEnabled = hasSource(mediaElement); |
611 | 589 |
612 static Image* mediaDownloadIcon = platformResource("mediaplayerDownloadIcon"); | 590 static Image* mediaDownloadIcon = platformResource("mediaplayerDownloadIcon"); |
613 return paintMediaButton(paintInfo.context, rect, mediaDownloadIcon, &object, | 591 return paintMediaButton(paintInfo.context, rect, mediaDownloadIcon, &object, |
614 isEnabled); | 592 isEnabled); |
615 } | 593 } |
616 | 594 |
617 void MediaControlsPainter::adjustMediaSliderThumbSize(ComputedStyle& style) { | 595 void MediaControlsPainter::adjustMediaSliderThumbSize(ComputedStyle& style) { |
618 const float zoomLevel = style.effectiveZoom(); | 596 const float zoomLevel = style.effectiveZoom(); |
619 | 597 |
620 style.setWidth(Length( | 598 style.setWidth( |
621 static_cast<int>(mediaSliderThumbTouchWidthNew * zoomLevel), Fixed)); | 599 Length(static_cast<int>(mediaSliderThumbTouchWidth * zoomLevel), Fixed)); |
622 style.setHeight(Length( | 600 style.setHeight( |
623 static_cast<int>(mediaSliderThumbTouchHeightNew * zoomLevel), Fixed)); | 601 Length(static_cast<int>(mediaSliderThumbTouchHeight * zoomLevel), Fixed)); |
624 } | 602 } |
625 | 603 |
626 } // namespace blink | 604 } // namespace blink |
OLD | NEW |