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

Unified Diff: Source/core/html/track/vtt/VTTRegion.cpp

Issue 101513002: Add new helper VTTParser::collectDigitsToInt (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 7 years 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 | « Source/core/html/track/vtt/VTTParser.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/track/vtt/VTTRegion.cpp
diff --git a/Source/core/html/track/vtt/VTTRegion.cpp b/Source/core/html/track/vtt/VTTRegion.cpp
index f049721d16908642a21157905b7eb73a405e63d7..18981845a694800b28b165480a20a13a1f296f2b 100644
--- a/Source/core/html/track/vtt/VTTRegion.cpp
+++ b/Source/core/html/track/vtt/VTTRegion.cpp
@@ -238,7 +238,6 @@ void VTTRegion::parseSettingValue(RegionSetting setting, const String& value)
bool isValidSetting;
String numberAsString;
int number;
- unsigned position;
FloatPoint anchorPosition;
switch (setting) {
@@ -253,17 +252,14 @@ void VTTRegion::parseSettingValue(RegionSetting setting, const String& value)
else
WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Width");
break;
- case Height:
- position = 0;
-
- numberAsString = VTTParser::collectDigits(value, &position);
- number = value.toInt(&isValidSetting);
-
- if (isValidSetting && number >= 0)
+ case Height: {
+ unsigned position = 0;
+ if (VTTParser::collectDigitsToInt(value, &position, number) && position == value.length())
m_heightInLines = number;
else
WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Height");
break;
+ }
Mike West 2013/12/03 13:55:41 Why did you add the '{' and '}'?
jochen (gone - plz use gerrit) 2013/12/03 14:48:37 So the unsigned position in line 256 is properly s
case RegionAnchor:
anchorPosition = VTTParser::parseFloatPercentageValuePair(value, ',', isValidSetting);
if (isValidSetting)
« no previous file with comments | « Source/core/html/track/vtt/VTTParser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698