Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 27 matching lines...) Expand all Loading... | |
| 38 #include "core/html/track/vtt/VTTScanner.h" | 38 #include "core/html/track/vtt/VTTScanner.h" |
| 39 #include "platform/RuntimeEnabledFeatures.h" | 39 #include "platform/RuntimeEnabledFeatures.h" |
| 40 #include "platform/text/SegmentedString.h" | 40 #include "platform/text/SegmentedString.h" |
| 41 #include "wtf/text/CharacterNames.h" | 41 #include "wtf/text/CharacterNames.h" |
| 42 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
| 43 | 43 |
| 44 namespace blink { | 44 namespace blink { |
| 45 | 45 |
| 46 using namespace HTMLNames; | 46 using namespace HTMLNames; |
| 47 | 47 |
| 48 const double secondsPerHour = 3600; | |
| 49 const double secondsPerMinute = 60; | |
| 50 const double secondsPerMillisecond = 0.001; | |
| 51 const unsigned fileIdentifierLength = 6; | 48 const unsigned fileIdentifierLength = 6; |
| 52 | 49 |
| 53 bool VTTParser::parseFloatPercentageValue(VTTScanner& valueScanner, | 50 bool VTTParser::parseFloatPercentageValue(VTTScanner& valueScanner, |
| 54 float& percentage) { | 51 float& percentage) { |
| 55 float number; | 52 float number; |
| 56 if (!valueScanner.scanFloat(number)) | 53 if (!valueScanner.scanFloat(number)) |
| 57 return false; | 54 return false; |
| 58 // '%' must be present and at the end of the setting value. | 55 // '%' must be present and at the end of the setting value. |
| 59 if (!valueScanner.scan('%')) | 56 if (!valueScanner.scan('%')) |
| 60 return false; | 57 return false; |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 398 } | 395 } |
| 399 | 396 |
| 400 bool VTTParser::collectTimeStamp(const String& line, double& timeStamp) { | 397 bool VTTParser::collectTimeStamp(const String& line, double& timeStamp) { |
| 401 VTTScanner input(line); | 398 VTTScanner input(line); |
| 402 return collectTimeStamp(input, timeStamp); | 399 return collectTimeStamp(input, timeStamp); |
| 403 } | 400 } |
| 404 | 401 |
| 405 bool VTTParser::collectTimeStamp(VTTScanner& input, double& timeStamp) { | 402 bool VTTParser::collectTimeStamp(VTTScanner& input, double& timeStamp) { |
| 406 // Collect a WebVTT timestamp (5.3 WebVTT cue timings and settings parsing.) | 403 // Collect a WebVTT timestamp (5.3 WebVTT cue timings and settings parsing.) |
| 407 // Steps 1 - 4 - Initial checks, let most significant units be minutes. | 404 // Steps 1 - 4 - Initial checks, let most significant units be minutes. |
| 405 const int secondsPerHour = 3600; | |
| 406 const int secondsPerMinute = 60; | |
| 407 const double secondsPerMillisecond = 0.001; | |
|
fs
2017/03/02 15:52:15
Ditto.
| |
| 408 enum Mode { Minutes, Hours }; | 408 enum Mode { Minutes, Hours }; |
| 409 Mode mode = Minutes; | 409 Mode mode = Minutes; |
| 410 | 410 |
| 411 // Steps 5 - 7 - Collect a sequence of characters that are 0-9. | 411 // Steps 5 - 7 - Collect a sequence of characters that are 0-9. |
| 412 // If not 2 characters or value is greater than 59, interpret as hours. | 412 // If not 2 characters or value is greater than 59, interpret as hours. |
| 413 int value1; | 413 int value1; |
| 414 unsigned value1Digits = input.scanDigits(value1); | 414 unsigned value1Digits = input.scanDigits(value1); |
| 415 if (!value1Digits) | 415 if (!value1Digits) |
| 416 return false; | 416 return false; |
| 417 if (value1Digits != 2 || value1 > 59) | 417 if (value1Digits != 2 || value1 > 59) |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 } | 559 } |
| 560 | 560 |
| 561 DEFINE_TRACE(VTTParser) { | 561 DEFINE_TRACE(VTTParser) { |
| 562 visitor->trace(m_document); | 562 visitor->trace(m_document); |
| 563 visitor->trace(m_client); | 563 visitor->trace(m_client); |
| 564 visitor->trace(m_cueList); | 564 visitor->trace(m_cueList); |
| 565 visitor->trace(m_regionMap); | 565 visitor->trace(m_regionMap); |
| 566 } | 566 } |
| 567 | 567 |
| 568 } // namespace blink | 568 } // namespace blink |
| OLD | NEW |