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

Unified Diff: third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp

Issue 2725313002: The WebVTT 'line' settings should be parsed as a float (Closed)
Patch Set: Updated expectations 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 | « third_party/WebKit/LayoutTests/media/track/track-webvtt-tc017-line-position.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp
diff --git a/third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp b/third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp
index ec2b0ea67d18c4ed21e7c843d3595bac83922b69..17a9100e349ae52a0b800403d768b0643815e1a3 100644
--- a/third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp
+++ b/third_party/WebKit/Source/core/html/track/vtt/VTTCue.cpp
@@ -983,23 +983,38 @@ void VTTCue::parseSettings(const VTTRegionMap* regionMap,
// If parse a percentage string from linepos doesn't fail, let
// number be the returned percentage, otherwise jump to the step
// labeled next setting.
- bool isPercentage = scanPercentage(input, number);
- if (!isPercentage) {
+ bool isPercentage = input.scanPercentage(number);
+ if (isPercentage) {
+ if (isInvalidPercentage(number))
+ break;
+ } else {
// Otherwise
//
// 1. If linepos contains any characters other than U+002D
- // HYPHEN-MINUS characters (-) and ASCII digits, then jump to
- // the step labeled next setting.
- // 2. If any character in linepos other than the first character is
- // a U+002D HYPHEN-MINUS character (-), then jump to the step
+ // HYPHEN-MINUS characters (-), ASCII digits, and U+002E DOT
+ // character (.), then jump to the step labeled next setting.
+ //
+ // 2. If any character in linepos other than the first character is a
+ // U+002D HYPHEN-MINUS character (-), then jump to the step
// labeled next setting.
+ //
+ // 3. If there are more than one U+002E DOT characters (.), then jump
+ // to the step labeled next setting.
+ //
+ // 4. If there is a U+002E DOT character (.) and the character before
+ // or the character after is not an ASCII digit, or if the U+002E
+ // DOT character (.) is the first or the last character, then jump
+ // to the step labeled next setting.
+ //
+ // 5. Interpret linepos as a (potentially signed) real number, and
foolip 2017/03/03 15:13:57 Hmm, strictly speaking I guess this is ambiguous f
fs 2017/03/03 15:21:03 Discussed this with the spec editor earlier today
foolip 2017/03/03 15:25:35 Yay :)
+ // let number be that number.
bool isNegative = input.scan('-');
- int intLinePosition;
- if (!input.scanDigits(intLinePosition))
+ if (!input.scanFloat(number))
break;
- // 3. Interpret linepos as a (potentially signed) integer, and let
- // number be that number.
- number = isNegative ? -intLinePosition : intLinePosition;
+ // Negate number if it was preceded by a hyphen-minus - unless it's
+ // zero.
+ if (isNegative && number)
+ number = -number;
}
if (!input.isAt(valueRun.end()))
break;
« no previous file with comments | « third_party/WebKit/LayoutTests/media/track/track-webvtt-tc017-line-position.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698