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

Unified 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, 10 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp
diff --git a/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp b/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp
index 567a7a7586c5d42f09d9217ab8a3fbba13960162..ff8d47b2985330d24408d1c417a86a6299e07758 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp
@@ -770,6 +770,13 @@ void MediaControlTimelineElement::defaultEventHandler(Event* event) {
double time = value().toDouble();
+ double duration = mediaElement().duration();
+ // Workaround for floating point error - it's possible for this element's max
+ // attribute to be rounded to a value slightly higher than the duration. If
+ // this happens and scrubber is dragged near the max, seek to duration.
+ if (time > duration)
+ time = duration;
+
// FIXME: This will need to take the timeline offset into consideration
// once that concept is supported, see https://crbug.com/312699
if (mediaElement().seekable()->contain(time))
« 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