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

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

Issue 143983002: Rework end-of-value field handling in VTTRegion::parseSettingValue (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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 | « Source/core/html/track/vtt/VTTParser.cpp ('k') | Source/core/html/track/vtt/VTTScanner.h » ('j') | 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 1e285ecff0e6d5a7b84d63be26b508496ce8d28c..21c4595a05f926f129bfe3d78e18fbe9b7a6af28 100644
--- a/Source/core/html/track/vtt/VTTRegion.cpp
+++ b/Source/core/html/track/vtt/VTTRegion.cpp
@@ -256,22 +256,32 @@ void VTTRegion::parseSettingValue(RegionSetting setting, const String& value)
break;
}
case Height: {
- unsigned position = 0;
int number;
- if (VTTParser::collectDigitsToInt(value, &position, number) && position == value.length())
+ VTTScanner valueScanner(value);
+ if (valueScanner.scanDigits(number) && valueScanner.isAtEnd())
m_heightInLines = number;
else
WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid Height");
break;
}
- case RegionAnchor:
- if (!VTTParser::parseFloatPercentageValuePair(value, ',', m_regionAnchor))
+ case RegionAnchor: {
+ VTTScanner valueScanner(value);
+ FloatPoint anchor;
+ if (VTTParser::parseFloatPercentageValuePair(valueScanner, ',', anchor) && valueScanner.isAtEnd())
+ m_regionAnchor = anchor;
+ else
WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid RegionAnchor");
break;
- case ViewportAnchor:
- if (!VTTParser::parseFloatPercentageValuePair(value, ',', m_viewportAnchor))
+ }
+ case ViewportAnchor: {
+ VTTScanner valueScanner(value);
+ FloatPoint anchor;
+ if (VTTParser::parseFloatPercentageValuePair(valueScanner, ',', anchor) && valueScanner.isAtEnd())
+ m_viewportAnchor = anchor;
+ else
WTF_LOG(Media, "VTTRegion::parseSettingValue, invalid ViewportAnchor");
break;
+ }
case Scroll:
if (value == scrollUpValueKeyword)
m_scroll = true;
« no previous file with comments | « Source/core/html/track/vtt/VTTParser.cpp ('k') | Source/core/html/track/vtt/VTTScanner.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698