Chromium Code Reviews| 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 "core/paint/MediaControlsPainter.h" | 28 #include "core/paint/MediaControlsPainter.h" |
| 29 | 29 |
| 30 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 30 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 31 #include "core/html/HTMLMediaElement.h" | 31 #include "core/html/HTMLMediaElement.h" |
| 32 #include "core/html/TimeRanges.h" | 32 #include "core/html/TimeRanges.h" |
| 33 #include "core/html/shadow/MediaControlElementTypes.h" | 33 #include "core/html/shadow/MediaControlElementTypes.h" |
| 34 #include "core/html/shadow/MediaControls.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 const double kCurrentTimeBufferedDelta = 1.0; | 42 static const double kCurrentTimeBufferedDelta = 1.0; |
| 42 | 43 |
| 43 typedef WTF::HashMap<const char*, Image*> MediaControlImageMap; | 44 typedef WTF::HashMap<const char*, Image*> MediaControlImageMap; |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 318 | 319 |
| 319 // Paint the slider bar in the "no data buffered" state. | 320 // Paint the slider bar in the "no data buffered" state. |
| 320 Color sliderBackgroundColor; | 321 Color sliderBackgroundColor; |
| 321 if (!useNewUi) | 322 if (!useNewUi) |
| 322 sliderBackgroundColor = Color(11, 11, 11); | 323 sliderBackgroundColor = Color(11, 11, 11); |
| 323 else | 324 else |
| 324 sliderBackgroundColor = Color(0xda, 0xda, 0xda); | 325 sliderBackgroundColor = Color(0xda, 0xda, 0xda); |
| 325 | 326 |
| 326 paintRoundedSliderBackground(rect, style, context, sliderBackgroundColor); | 327 paintRoundedSliderBackground(rect, style, context, sliderBackgroundColor); |
| 327 | 328 |
| 329 TimeRanges* bufferedTimeRanges = mediaElement->mediaControls()->bufferedRang esForPainting(); | |
|
liberato (no reviews please)
2016/08/29 15:25:34
could one use mediaElement->buffered() here as wel
Xianzhu
2016/08/29 18:04:14
This is required in the under-invalidation checkin
| |
| 330 if (!bufferedTimeRanges) | |
| 331 return; | |
| 332 | |
| 328 // Draw the buffered range. Since the element may have multiple buffered ran ges and it'd be | 333 // Draw the buffered range. Since the element may have multiple buffered ran ges and it'd be |
| 329 // distracting/'busy' to show all of them, show only the buffered range cont aining the current play head. | 334 // distracting/'busy' to show all of them, show only the buffered range cont aining the current play head. |
| 330 TimeRanges* bufferedTimeRanges = mediaElement->buffered(); | |
| 331 float duration = mediaElement->duration(); | 335 float duration = mediaElement->duration(); |
| 332 float currentTime = mediaElement->currentTime(); | 336 float currentTime = mediaElement->currentTime(); |
| 333 if (std::isnan(duration) || std::isinf(duration) || !duration || std::isnan( currentTime)) | 337 if (std::isnan(duration) || std::isinf(duration) || !duration || std::isnan( currentTime)) |
| 334 return; | 338 return; |
| 335 | 339 |
| 336 for (unsigned i = 0; i < bufferedTimeRanges->length(); ++i) { | 340 for (unsigned i = 0; i < bufferedTimeRanges->length(); ++i) { |
| 337 float start = bufferedTimeRanges->start(i, ASSERT_NO_EXCEPTION); | 341 float start = bufferedTimeRanges->start(i, ASSERT_NO_EXCEPTION); |
| 338 float end = bufferedTimeRanges->end(i, ASSERT_NO_EXCEPTION); | 342 float end = bufferedTimeRanges->end(i, ASSERT_NO_EXCEPTION); |
| 339 // The delta is there to avoid corner cases when buffered | 343 // The delta is there to avoid corner cases when buffered |
| 340 // ranges is out of sync with current time because of | 344 // ranges is out of sync with current time because of |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 632 } | 636 } |
| 633 | 637 |
| 634 float zoomLevel = style.effectiveZoom(); | 638 float zoomLevel = style.effectiveZoom(); |
| 635 if (thumbImage) { | 639 if (thumbImage) { |
| 636 style.setWidth(Length(static_cast<int>(width * zoomLevel), Fixed)); | 640 style.setWidth(Length(static_cast<int>(width * zoomLevel), Fixed)); |
| 637 style.setHeight(Length(static_cast<int>(height * zoomLevel), Fixed)); | 641 style.setHeight(Length(static_cast<int>(height * zoomLevel), Fixed)); |
| 638 } | 642 } |
| 639 } | 643 } |
| 640 | 644 |
| 641 } // namespace blink | 645 } // namespace blink |
| OLD | NEW |