Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp

Issue 2707043004: Media Controls: Fix seek to end when max attr is rounded up (Closed)
Patch Set: Simplify time>duration check Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 // Workaround for floating point error - it's possible for this element's max
775 // attribute to be rounded to a value slightly higher than the duration. If
776 // this happens and scrubber is dragged near the max, seek to duration.
777 if (time > duration)
778 time = duration;
779
773 // FIXME: This will need to take the timeline offset into consideration 780 // FIXME: This will need to take the timeline offset into consideration
774 // once that concept is supported, see https://crbug.com/312699 781 // once that concept is supported, see https://crbug.com/312699
775 if (mediaElement().seekable()->contain(time)) 782 if (mediaElement().seekable()->contain(time))
776 mediaElement().setCurrentTime(time); 783 mediaElement().setCurrentTime(time);
777 784
778 LayoutSliderItem slider = LayoutSliderItem(toLayoutSlider(layoutObject())); 785 LayoutSliderItem slider = LayoutSliderItem(toLayoutSlider(layoutObject()));
779 if (!slider.isNull() && slider.inDragMode()) 786 if (!slider.isNull() && slider.inDragMode())
780 mediaControls().updateCurrentTimeDisplay(); 787 mediaControls().updateCurrentTimeDisplay();
781 } 788 }
782 789
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 MediaControlCurrentTimeDisplayElement* 1053 MediaControlCurrentTimeDisplayElement*
1047 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) { 1054 MediaControlCurrentTimeDisplayElement::create(MediaControls& mediaControls) {
1048 MediaControlCurrentTimeDisplayElement* element = 1055 MediaControlCurrentTimeDisplayElement* element =
1049 new MediaControlCurrentTimeDisplayElement(mediaControls); 1056 new MediaControlCurrentTimeDisplayElement(mediaControls);
1050 element->setShadowPseudoId( 1057 element->setShadowPseudoId(
1051 AtomicString("-webkit-media-controls-current-time-display")); 1058 AtomicString("-webkit-media-controls-current-time-display"));
1052 return element; 1059 return element;
1053 } 1060 }
1054 1061
1055 } // namespace blink 1062 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/html/shadow/MediaControlsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698