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

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

Issue 140503004: Make VTTRegion::setRegionSettings use VTTScanner (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/VTTRegion.h ('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 ca48163a2a3927251ba0c7bbe9b4b1c6911a6ddb..40bf0ef4ec60b49828f3fae5aad2eae8286a7b2c 100644
--- a/Source/core/html/track/vtt/VTTRegion.cpp
+++ b/Source/core/html/track/vtt/VTTRegion.cpp
@@ -191,19 +191,31 @@ void VTTRegion::updateParametersFromRegion(VTTRegion* region)
setScroll(region->scroll(), ASSERT_NO_EXCEPTION);
}
-void VTTRegion::setRegionSettings(const String& input)
+void VTTRegion::setRegionSettings(const String& inputString)
{
- m_settings = input;
- unsigned position = 0;
+ m_settings = inputString;
- while (position < input.length()) {
- while (position < input.length() && VTTParser::isValidSettingDelimiter(input[position]))
- position++;
+ VTTScanner input(inputString);
- if (position >= input.length())
+ while (!input.isAtEnd()) {
+ input.skipWhile<VTTParser::isValidSettingDelimiter>();
+
+ if (input.isAtEnd())
break;
- parseSetting(input, &position);
+ // Scan the name part.
+ RegionSetting name = scanSettingName(input);
+
+ // Verify that we're looking at a '='.
+ if (name == None || !input.scan('=')) {
+ input.skipUntil<VTTParser::isASpace>();
+ continue;
+ }
+
+ // Scan the value part.
+ VTTScanner::Run valueRun = input.collectUntil<VTTParser::isASpace>();
+ parseSettingValue(name, input.extractString(valueRun));
+ input.skipRun(valueRun);
}
}
@@ -270,25 +282,6 @@ void VTTRegion::parseSettingValue(RegionSetting setting, const String& value)
}
}
-void VTTRegion::parseSetting(const String& inputString, unsigned* position)
-{
- VTTLegacyScanner input(inputString, position);
-
- // Scan the name part.
- RegionSetting name = scanSettingName(input);
-
- // Verify that we're looking at a '='.
- if (!input.scan('=')) {
- input.skipUntil<VTTParser::isASpace>();
- return;
- }
-
- // Scan the value part.
- VTTScanner::Run valueRun = input.collectUntil<VTTParser::isASpace>();
- parseSettingValue(name, input.extractString(valueRun));
- input.skipRun(valueRun);
-}
-
const AtomicString& VTTRegion::textTrackCueContainerShadowPseudoId()
{
DEFINE_STATIC_LOCAL(const AtomicString, trackRegionCueContainerPseudoId,
« no previous file with comments | « Source/core/html/track/vtt/VTTRegion.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698