| 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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 | 209 |
| 210 // Draw the buffered range. Since the element may have multiple buffered ran
ges and it'd be | 210 // Draw the buffered range. Since the element may have multiple buffered ran
ges and it'd be |
| 211 // distracting/'busy' to show all of them, show only the buffered range cont
aining the current play head. | 211 // distracting/'busy' to show all of them, show only the buffered range cont
aining the current play head. |
| 212 RefPtr<TimeRanges> bufferedTimeRanges = mediaElement->buffered(); | 212 RefPtr<TimeRanges> bufferedTimeRanges = mediaElement->buffered(); |
| 213 float duration = mediaElement->duration(); | 213 float duration = mediaElement->duration(); |
| 214 float currentTime = mediaElement->currentTime(); | 214 float currentTime = mediaElement->currentTime(); |
| 215 if (std::isnan(duration) || std::isinf(duration) || !duration || std::isnan(
currentTime)) | 215 if (std::isnan(duration) || std::isinf(duration) || !duration || std::isnan(
currentTime)) |
| 216 return true; | 216 return true; |
| 217 | 217 |
| 218 for (unsigned i = 0; i < bufferedTimeRanges->length(); ++i) { | 218 for (unsigned i = 0; i < bufferedTimeRanges->length(); ++i) { |
| 219 float start = bufferedTimeRanges->start(i, ASSERT_NO_EXCEPTION_STATE); | 219 float start = bufferedTimeRanges->start(i, ASSERT_NO_EXCEPTION); |
| 220 float end = bufferedTimeRanges->end(i, ASSERT_NO_EXCEPTION_STATE); | 220 float end = bufferedTimeRanges->end(i, ASSERT_NO_EXCEPTION); |
| 221 if (std::isnan(start) || std::isnan(end) || start > currentTime || end <
currentTime) | 221 if (std::isnan(start) || std::isnan(end) || start > currentTime || end <
currentTime) |
| 222 continue; | 222 continue; |
| 223 int startPosition = int(start * rect.width() / duration); | 223 int startPosition = int(start * rect.width() / duration); |
| 224 int currentPosition = int(currentTime * rect.width() / duration); | 224 int currentPosition = int(currentTime * rect.width() / duration); |
| 225 int endPosition = int(end * rect.width() / duration); | 225 int endPosition = int(end * rect.width() / duration); |
| 226 | 226 |
| 227 // Add half the thumb width proportionally adjusted to the current paint
ing position. | 227 // Add half the thumb width proportionally adjusted to the current paint
ing position. |
| 228 int thumbCenter = mediaSliderThumbWidth / 2; | 228 int thumbCenter = mediaSliderThumbWidth / 2; |
| 229 int addWidth = thumbCenter * (1.0 - 2.0 * currentPosition / rect.width()
); | 229 int addWidth = thumbCenter * (1.0 - 2.0 * currentPosition / rect.width()
); |
| 230 currentPosition += addWidth; | 230 currentPosition += addWidth; |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 { | 443 { |
| 444 return formatChromiumMediaControlsTime(time, time); | 444 return formatChromiumMediaControlsTime(time, time); |
| 445 } | 445 } |
| 446 | 446 |
| 447 String RenderMediaControlsChromium::formatMediaControlsCurrentTime(float current
Time, float duration) | 447 String RenderMediaControlsChromium::formatMediaControlsCurrentTime(float current
Time, float duration) |
| 448 { | 448 { |
| 449 return formatChromiumMediaControlsTime(currentTime, duration); | 449 return formatChromiumMediaControlsTime(currentTime, duration); |
| 450 } | 450 } |
| 451 | 451 |
| 452 } // namespace WebCore | 452 } // namespace WebCore |
| OLD | NEW |