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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 if (m_regionList[i]->id() == region->id()) { | 433 if (m_regionList[i]->id() == region->id()) { |
434 m_regionList.remove(i); | 434 m_regionList.remove(i); |
435 break; | 435 break; |
436 } | 436 } |
437 } | 437 } |
438 | 438 |
439 // Step 12.5.11 | 439 // Step 12.5.11 |
440 m_regionList.append(region); | 440 m_regionList.append(region); |
441 } | 441 } |
442 | 442 |
443 bool VTTParser::collectTimeStamp(const String& line, unsigned* position, double&
timeStamp) | 443 bool VTTParser::collectTimeStamp(const String& line, double& timeStamp) |
444 { | 444 { |
445 VTTLegacyScanner input(line, position); | 445 VTTScanner input(line); |
446 return collectTimeStamp(input, timeStamp); | 446 return collectTimeStamp(input, timeStamp); |
447 } | 447 } |
448 | 448 |
449 bool VTTParser::collectTimeStamp(VTTScanner& input, double& timeStamp) | 449 bool VTTParser::collectTimeStamp(VTTScanner& input, double& timeStamp) |
450 { | 450 { |
451 // Collect a WebVTT timestamp (5.3 WebVTT cue timings and settings parsing.) | 451 // Collect a WebVTT timestamp (5.3 WebVTT cue timings and settings parsing.) |
452 // Steps 1 - 4 - Initial checks, let most significant units be minutes. | 452 // Steps 1 - 4 - Initial checks, let most significant units be minutes. |
453 enum Mode { Minutes, Hours }; | 453 enum Mode { Minutes, Hours }; |
454 Mode mode = Minutes; | 454 Mode mode = Minutes; |
455 | 455 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 break; | 576 break; |
577 } | 577 } |
578 } | 578 } |
579 if (nodeType == VTTNodeTypeLanguage) | 579 if (nodeType == VTTNodeTypeLanguage) |
580 m_languageStack.removeLast(); | 580 m_languageStack.removeLast(); |
581 if (m_currentNode->parentNode()) | 581 if (m_currentNode->parentNode()) |
582 m_currentNode = m_currentNode->parentNode(); | 582 m_currentNode = m_currentNode->parentNode(); |
583 break; | 583 break; |
584 } | 584 } |
585 case VTTTokenTypes::TimestampTag: { | 585 case VTTTokenTypes::TimestampTag: { |
586 unsigned position = 0; | |
587 String charactersString = m_token.characters(); | 586 String charactersString = m_token.characters(); |
588 double parsedTimeStamp; | 587 double parsedTimeStamp; |
589 if (VTTParser::collectTimeStamp(charactersString, &position, parsedTimeS
tamp)) | 588 if (VTTParser::collectTimeStamp(charactersString, parsedTimeStamp)) |
590 m_currentNode->parserAppendChild(ProcessingInstruction::create(docum
ent, "timestamp", charactersString)); | 589 m_currentNode->parserAppendChild(ProcessingInstruction::create(docum
ent, "timestamp", charactersString)); |
591 break; | 590 break; |
592 } | 591 } |
593 default: | 592 default: |
594 break; | 593 break; |
595 } | 594 } |
596 } | 595 } |
597 | 596 |
598 } | 597 } |
599 | 598 |
OLD | NEW |