| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 } | 61 } |
| 62 | 62 |
| 63 static bool paintMediaButton(GraphicsContext* context, const IntRect& rect, Imag
e* image) | 63 static bool paintMediaButton(GraphicsContext* context, const IntRect& rect, Imag
e* image) |
| 64 { | 64 { |
| 65 context->drawImage(image, rect); | 65 context->drawImage(image, rect); |
| 66 return true; | 66 return true; |
| 67 } | 67 } |
| 68 | 68 |
| 69 static bool paintMediaMuteButton(RenderObject* object, const PaintInfo& paintInf
o, const IntRect& rect) | 69 static bool paintMediaMuteButton(RenderObject* object, const PaintInfo& paintInf
o, const IntRect& rect) |
| 70 { | 70 { |
| 71 HTMLMediaElement* mediaElement = toParentMediaElement(object); | 71 /*HTMLMediaElement* mediaElement = toParentMediaElement(object); |
| 72 if (!mediaElement) | 72 if (!mediaElement) |
| 73 return false; | 73 return false; |
| 74 | 74 |
| 75 static Image* soundLevel3 = platformResource("mediaplayerSoundLevel3"); | 75 static Image* soundLevel3 = platformResource("mediaplayerSoundLevel3"); |
| 76 static Image* soundLevel2 = platformResource("mediaplayerSoundLevel2"); | 76 static Image* soundLevel2 = platformResource("mediaplayerSoundLevel2"); |
| 77 static Image* soundLevel1 = platformResource("mediaplayerSoundLevel1"); | 77 static Image* soundLevel1 = platformResource("mediaplayerSoundLevel1"); |
| 78 static Image* soundLevel0 = platformResource("mediaplayerSoundLevel0"); | 78 static Image* soundLevel0 = platformResource("mediaplayerSoundLevel0"); |
| 79 static Image* soundDisabled = platformResource("mediaplayerSoundDisabled"); | 79 static Image* soundDisabled = platformResource("mediaplayerSoundDisabled"); |
| 80 | 80 |
| 81 if (!hasSource(mediaElement) || !mediaElement->hasAudio()) | 81 if (!hasSource(mediaElement) || !mediaElement->hasAudio()) |
| 82 return paintMediaButton(paintInfo.context, rect, soundDisabled); | 82 return paintMediaButton(paintInfo.context, rect, soundDisabled); |
| 83 | 83 |
| 84 if (mediaElement->muted() || mediaElement->volume() <= 0) | 84 if (mediaElement->muted() || mediaElement->volume() <= 0) |
| 85 return paintMediaButton(paintInfo.context, rect, soundLevel0); | 85 return paintMediaButton(paintInfo.context, rect, soundLevel0); |
| 86 | 86 |
| 87 if (mediaElement->volume() <= 0.33) | 87 if (mediaElement->volume() <= 0.33) |
| 88 return paintMediaButton(paintInfo.context, rect, soundLevel1); | 88 return paintMediaButton(paintInfo.context, rect, soundLevel1); |
| 89 | 89 |
| 90 if (mediaElement->volume() <= 0.66) | 90 if (mediaElement->volume() <= 0.66) |
| 91 return paintMediaButton(paintInfo.context, rect, soundLevel2); | 91 return paintMediaButton(paintInfo.context, rect, soundLevel2); |
| 92 | 92 |
| 93 return paintMediaButton(paintInfo.context, rect, soundLevel3); | 93 return paintMediaButton(paintInfo.context, rect, soundLevel3);*/ |
| 94 return true; |
| 94 } | 95 } |
| 95 | 96 |
| 96 static bool paintMediaPlayButton(RenderObject* object, const PaintInfo& paintInf
o, const IntRect& rect) | 97 static bool paintMediaPlayButton(RenderObject* object, const PaintInfo& paintInf
o, const IntRect& rect) |
| 97 { | 98 { |
| 98 HTMLMediaElement* mediaElement = toParentMediaElement(object); | 99 /*HTMLMediaElement* mediaElement = toParentMediaElement(object); |
| 99 if (!mediaElement) | 100 if (!mediaElement) |
| 100 return false; | 101 return false; |
| 101 | 102 |
| 102 static Image* mediaPlay = platformResource("mediaplayerPlay"); | 103 static Image* mediaPlay = platformResource("mediaplayerPlay"); |
| 103 static Image* mediaPause = platformResource("mediaplayerPause"); | 104 static Image* mediaPause = platformResource("mediaplayerPause"); |
| 104 static Image* mediaPlayDisabled = platformResource("mediaplayerPlayDisabled"
); | 105 static Image* mediaPlayDisabled = platformResource("mediaplayerPlayDisabled"
); |
| 105 | 106 |
| 106 if (!hasSource(mediaElement)) | 107 if (!hasSource(mediaElement)) |
| 107 return paintMediaButton(paintInfo.context, rect, mediaPlayDisabled); | 108 return paintMediaButton(paintInfo.context, rect, mediaPlayDisabled); |
| 108 | 109 |
| 109 return paintMediaButton(paintInfo.context, rect, mediaControlElementType(obj
ect->node()) == MediaPlayButton ? mediaPlay : mediaPause); | 110 return paintMediaButton(paintInfo.context, rect, mediaControlElementType
(object->node()) == MediaPlayButton ? mediaPlay : mediaPause);*/ |
| 111 return true; |
| 110 } | 112 } |
| 111 | 113 |
| 112 static bool paintMediaOverlayPlayButton(RenderObject* object, const PaintInfo& p
aintInfo, const IntRect& rect) | 114 static bool paintMediaOverlayPlayButton(RenderObject* object, const PaintInfo& p
aintInfo, const IntRect& rect) |
| 113 { | 115 { |
| 114 HTMLMediaElement* mediaElement = toParentMediaElement(object); | 116 HTMLMediaElement* mediaElement = toParentMediaElement(object); |
| 115 if (!mediaElement) | 117 if (!mediaElement) |
| 116 return false; | 118 return false; |
| 117 | 119 |
| 118 if (!hasSource(mediaElement) || !mediaElement->togglePlayStateWillPlay()) | 120 if (!hasSource(mediaElement) || !mediaElement->togglePlayStateWillPlay()) |
| 119 return false; | 121 return false; |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 HTMLMediaElement* mediaElement = toParentMediaElement(object); | 318 HTMLMediaElement* mediaElement = toParentMediaElement(object); |
| 317 if (!mediaElement) | 319 if (!mediaElement) |
| 318 return false; | 320 return false; |
| 319 | 321 |
| 320 static Image* mediaFullscreenButton = platformResource("mediaplayerFullscree
n"); | 322 static Image* mediaFullscreenButton = platformResource("mediaplayerFullscree
n"); |
| 321 return paintMediaButton(paintInfo.context, rect, mediaFullscreenButton); | 323 return paintMediaButton(paintInfo.context, rect, mediaFullscreenButton); |
| 322 } | 324 } |
| 323 | 325 |
| 324 static bool paintMediaToggleClosedCaptionsButton(RenderObject* object, const Pai
ntInfo& paintInfo, const IntRect& rect) | 326 static bool paintMediaToggleClosedCaptionsButton(RenderObject* object, const Pai
ntInfo& paintInfo, const IntRect& rect) |
| 325 { | 327 { |
| 326 HTMLMediaElement* mediaElement = toParentMediaElement(object); | 328 /*HTMLMediaElement* mediaElement = toParentMediaElement(object); |
| 327 if (!mediaElement) | 329 if (!mediaElement) |
| 328 return false; | 330 return false; |
| 329 | 331 |
| 330 static Image* mediaClosedCaptionButton = platformResource("mediaplayerClosed
Caption"); | 332 static Image* mediaClosedCaptionButton = platformResource("mediaplayerClosed
Caption"); |
| 331 static Image* mediaClosedCaptionButtonDisabled = platformResource("mediaplay
erClosedCaptionDisabled"); | 333 static Image* mediaClosedCaptionButtonDisabled = platformResource("mediaplay
erClosedCaptionDisabled"); |
| 332 | 334 |
| 333 if (mediaElement->closedCaptionsVisible()) | 335 if (mediaElement->closedCaptionsVisible()) |
| 334 return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButto
n); | 336 return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButto
n); |
| 335 | 337 |
| 336 return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButtonDis
abled); | 338 return paintMediaButton(paintInfo.context, rect, mediaClosedCaptionButto
nDisabled);*/ |
| 339 return true; |
| 337 } | 340 } |
| 338 | 341 |
| 339 | 342 |
| 340 bool RenderMediaControls::paintMediaControlsPart(MediaControlElementType part, R
enderObject* object, const PaintInfo& paintInfo, const IntRect& rect) | 343 bool RenderMediaControls::paintMediaControlsPart(MediaControlElementType part, R
enderObject* object, const PaintInfo& paintInfo, const IntRect& rect) |
| 341 { | 344 { |
| 342 switch (part) { | 345 switch (part) { |
| 343 case MediaMuteButton: | 346 case MediaMuteButton: |
| 344 case MediaUnMuteButton: | 347 case MediaUnMuteButton: |
| 345 return paintMediaMuteButton(object, paintInfo, rect); | 348 return paintMediaMuteButton(object, paintInfo, rect); |
| 346 case MediaPauseButton: | 349 case MediaPauseButton: |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 434 { | 437 { |
| 435 return formatChromiumMediaControlsTime(time, time); | 438 return formatChromiumMediaControlsTime(time, time); |
| 436 } | 439 } |
| 437 | 440 |
| 438 String RenderMediaControls::formatMediaControlsCurrentTime(float currentTime, fl
oat duration) | 441 String RenderMediaControls::formatMediaControlsCurrentTime(float currentTime, fl
oat duration) |
| 439 { | 442 { |
| 440 return formatChromiumMediaControlsTime(currentTime, duration); | 443 return formatChromiumMediaControlsTime(currentTime, duration); |
| 441 } | 444 } |
| 442 | 445 |
| 443 } // namespace blink | 446 } // namespace blink |
| OLD | NEW |