Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 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 752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 763 mediaControls().endScrubbing(); | 763 mediaControls().endScrubbing(); |
| 764 } | 764 } |
| 765 | 765 |
| 766 MediaControlInputElement::defaultEventHandler(event); | 766 MediaControlInputElement::defaultEventHandler(event); |
| 767 | 767 |
| 768 if (event->type() != EventTypeNames::input) | 768 if (event->type() != EventTypeNames::input) |
| 769 return; | 769 return; |
| 770 | 770 |
| 771 double time = value().toDouble(); | 771 double time = value().toDouble(); |
| 772 | 772 |
| 773 double duration = mediaElement().duration(); | |
| 774 double maxAttribute = getFloatingPointAttribute(maxAttr); | |
| 775 // Workaround for floating point error - it's possible for this element's max | |
| 776 // attribute to be rounded to a value slightly higher than the duration. If | |
| 777 // this happens and scrubber is dragged near the max, seek to duration. | |
| 778 if (duration < time && time <= maxAttribute && maxAttribute <= duration + 0.5) | |
| 779 time = duration; | |
|
mlamouri (slow - plz ping)
2017/02/27 17:48:12
I do not understand why this isn't:
```
if (durati
johnme
2017/02/28 18:02:55
Done.
I was guarding against the case where media
| |
| 780 | |
| 773 // FIXME: This will need to take the timeline offset into consideration | 781 // FIXME: This will need to take the timeline offset into consideration |
| 774 // once that concept is supported, see https://crbug.com/312699 | 782 // once that concept is supported, see https://crbug.com/312699 |
| 775 if (mediaElement().seekable()->contain(time)) | 783 if (mediaElement().seekable()->contain(time)) |
| 776 mediaElement().setCurrentTime(time); | 784 mediaElement().setCurrentTime(time); |
| 777 | 785 |
| 778 LayoutSliderItem slider = LayoutSliderItem(toLayoutSlider(layoutObject())); | 786 LayoutSliderItem slider = LayoutSliderItem(toLayoutSlider(layoutObject())); |
| 779 if (!slider.isNull() && slider.inDragMode()) | 787 if (!slider.isNull() && slider.inDragMode()) |
| 780 mediaControls().updateCurrentTimeDisplay(); | 788 mediaControls().updateCurrentTimeDisplay(); |
| 781 } | 789 } |
| 782 | 790 |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1046 MediaControlCurrentTimeDisplayElement* | 1054 MediaControlCurrentTimeDisplayElement* |
| 1047 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { | 1055 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { |
| 1048 MediaControlCurrentTimeDisplayElement* element = | 1056 MediaControlCurrentTimeDisplayElement* element = |
| 1049 new MediaControlCurrentTimeDisplayElement(mediaControls); | 1057 new MediaControlCurrentTimeDisplayElement(mediaControls); |
| 1050 element->setShadowPseudoId( | 1058 element->setShadowPseudoId( |
| 1051 AtomicString("-webkit-media-controls-current-time-display")); | 1059 AtomicString("-webkit-media-controls-current-time-display")); |
| 1052 return element; | 1060 return element; |
| 1053 } | 1061 } |
| 1054 | 1062 |
| 1055 } // namespace blink | 1063 } // namespace blink |
| OLD | NEW |