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

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: 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..eac75ab2c736f1d7cb4132ffec13f6190a2adcc9 100644
--- a/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp
+++ b/third_party/WebKit/Source/core/html/shadow/MediaControlElements.cpp
@@ -770,6 +770,14 @@ void MediaControlTimelineElement::defaultEventHandler(Event* event) {
double time = value().toDouble();
+ double duration = mediaElement().duration();
+ double maxAttribute = getFloatingPointAttribute(maxAttr);
+ // 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 (duration < time && time <= maxAttribute && maxAttribute <= duration + 0.5)
+ 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
+
// 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