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

Side by Side Diff: Source/core/html/track/vtt/VTTParser.cpp

Issue 137033002: Use VTTScanner for VTT region settings parsing (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 unified diff | Download patch
« no previous file with comments | « Source/core/html/track/vtt/VTTParser.h ('k') | Source/core/html/track/vtt/VTTRegion.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 (*position)++; 53 (*position)++;
54 return *position - startPosition; 54 return *position - startPosition;
55 } 55 }
56 56
57 unsigned VTTParser::collectDigitsToInt(const String& input, unsigned* position, int& number) 57 unsigned VTTParser::collectDigitsToInt(const String& input, unsigned* position, int& number)
58 { 58 {
59 VTTLegacyScanner inputScanner(input, position); 59 VTTLegacyScanner inputScanner(input, position);
60 return inputScanner.scanDigits(number); 60 return inputScanner.scanDigits(number);
61 } 61 }
62 62
63 String VTTParser::collectWord(const String& input, unsigned* position)
64 {
65 StringBuilder string;
66 while (*position < input.length() && !isASpace(input[*position]))
67 string.append(input[(*position)++]);
68 return string.toString();
69 }
70
71 bool VTTParser::parseFloatPercentageValue(const String& value, float& percentage ) 63 bool VTTParser::parseFloatPercentageValue(const String& value, float& percentage )
72 { 64 {
73 // '%' must be present and at the end of the setting value. 65 // '%' must be present and at the end of the setting value.
74 if (value.isEmpty() || value[value.length() - 1] != '%') 66 if (value.isEmpty() || value[value.length() - 1] != '%')
75 return false; 67 return false;
76 68
77 unsigned position = 0; 69 unsigned position = 0;
78 unsigned digitsBeforeDot = scanDigits(value, &position); 70 unsigned digitsBeforeDot = scanDigits(value, &position);
79 unsigned digitsAfterDot = 0; 71 unsigned digitsAfterDot = 0;
80 if (value[position] == '.') { 72 if (value[position] == '.') {
(...skipping 508 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 m_currentNode->parserAppendChild(ProcessingInstruction::create(docum ent, "timestamp", charactersString)); 581 m_currentNode->parserAppendChild(ProcessingInstruction::create(docum ent, "timestamp", charactersString));
590 break; 582 break;
591 } 583 }
592 default: 584 default:
593 break; 585 break;
594 } 586 }
595 } 587 }
596 588
597 } 589 }
598 590
OLDNEW
« no previous file with comments | « Source/core/html/track/vtt/VTTParser.h ('k') | Source/core/html/track/vtt/VTTRegion.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698