| 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 } | 192 } |
| 193 | 193 |
| 194 const int mediaSliderThumbWidth = 32; | 194 const int mediaSliderThumbWidth = 32; |
| 195 | 195 |
| 196 static bool paintMediaSlider(RenderObject* object, const PaintInfo& paintInfo, c
onst IntRect& rect) | 196 static bool paintMediaSlider(RenderObject* object, const PaintInfo& paintInfo, c
onst IntRect& rect) |
| 197 { | 197 { |
| 198 HTMLMediaElement* mediaElement = toParentMediaElement(object); | 198 HTMLMediaElement* mediaElement = toParentMediaElement(object); |
| 199 if (!mediaElement) | 199 if (!mediaElement) |
| 200 return false; | 200 return false; |
| 201 | 201 |
| 202 RenderStyle* style = object->style(); | 202 const RenderStyle* style = object->style(); |
| 203 GraphicsContext* context = paintInfo.context; | 203 GraphicsContext* context = paintInfo.context; |
| 204 | 204 |
| 205 paintRoundedSliderBackground(rect, style, context); | 205 paintRoundedSliderBackground(rect, style, context); |
| 206 | 206 |
| 207 // Draw the buffered range. Since the element may have multiple buffered ran
ges and it'd be | 207 // Draw the buffered range. Since the element may have multiple buffered ran
ges and it'd be |
| 208 // distracting/'busy' to show all of them, show only the buffered range cont
aining the current play head. | 208 // distracting/'busy' to show all of them, show only the buffered range cont
aining the current play head. |
| 209 RefPtrWillBeRawPtr<TimeRanges> bufferedTimeRanges = mediaElement->buffered()
; | 209 RefPtrWillBeRawPtr<TimeRanges> bufferedTimeRanges = mediaElement->buffered()
; |
| 210 float duration = mediaElement->duration(); | 210 float duration = mediaElement->duration(); |
| 211 float currentTime = mediaElement->currentTime(); | 211 float currentTime = mediaElement->currentTime(); |
| 212 if (std::isnan(duration) || std::isinf(duration) || !duration || std::isnan(
currentTime)) | 212 if (std::isnan(duration) || std::isinf(duration) || !duration || std::isnan(
currentTime)) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 | 263 |
| 264 const int mediaVolumeSliderThumbWidth = 24; | 264 const int mediaVolumeSliderThumbWidth = 24; |
| 265 | 265 |
| 266 static bool paintMediaVolumeSlider(RenderObject* object, const PaintInfo& paintI
nfo, const IntRect& rect) | 266 static bool paintMediaVolumeSlider(RenderObject* object, const PaintInfo& paintI
nfo, const IntRect& rect) |
| 267 { | 267 { |
| 268 HTMLMediaElement* mediaElement = toParentMediaElement(object); | 268 HTMLMediaElement* mediaElement = toParentMediaElement(object); |
| 269 if (!mediaElement) | 269 if (!mediaElement) |
| 270 return false; | 270 return false; |
| 271 | 271 |
| 272 GraphicsContext* context = paintInfo.context; | 272 GraphicsContext* context = paintInfo.context; |
| 273 RenderStyle* style = object->style(); | 273 const RenderStyle* style = object->style(); |
| 274 | 274 |
| 275 paintRoundedSliderBackground(rect, style, context); | 275 paintRoundedSliderBackground(rect, style, context); |
| 276 | 276 |
| 277 // Calculate volume position for white background rectangle. | 277 // Calculate volume position for white background rectangle. |
| 278 float volume = mediaElement->volume(); | 278 float volume = mediaElement->volume(); |
| 279 if (std::isnan(volume) || volume < 0) | 279 if (std::isnan(volume) || volume < 0) |
| 280 return true; | 280 return true; |
| 281 if (volume > 1) | 281 if (volume > 1) |
| 282 volume = 1; | 282 volume = 1; |
| 283 if (!hasSource(mediaElement) || !mediaElement->hasAudio() || mediaElement->m
uted()) | 283 if (!hasSource(mediaElement) || !mediaElement->hasAudio() || mediaElement->m
uted()) |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 { | 468 { |
| 469 return formatChromiumMediaControlsTime(time, time); | 469 return formatChromiumMediaControlsTime(time, time); |
| 470 } | 470 } |
| 471 | 471 |
| 472 String RenderMediaControls::formatMediaControlsCurrentTime(float currentTime, fl
oat duration) | 472 String RenderMediaControls::formatMediaControlsCurrentTime(float currentTime, fl
oat duration) |
| 473 { | 473 { |
| 474 return formatChromiumMediaControlsTime(currentTime, duration); | 474 return formatChromiumMediaControlsTime(currentTime, duration); |
| 475 } | 475 } |
| 476 | 476 |
| 477 } // namespace blink | 477 } // namespace blink |
| OLD | NEW |