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 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 } | 365 } |
366 | 366 |
367 PassRefPtr<DocumentFragment> WebVTTParser::createDocumentFragmentFromCueText(Doc
ument& document, const String& cueText) | 367 PassRefPtr<DocumentFragment> WebVTTParser::createDocumentFragmentFromCueText(Doc
ument& document, const String& cueText) |
368 { | 368 { |
369 WebVTTTreeBuilder treeBuilder(document); | 369 WebVTTTreeBuilder treeBuilder(document); |
370 return treeBuilder.buildFromString(cueText); | 370 return treeBuilder.buildFromString(cueText); |
371 } | 371 } |
372 | 372 |
373 void WebVTTParser::createNewCue() | 373 void WebVTTParser::createNewCue() |
374 { | 374 { |
375 if (!m_currentContent.length()) | |
376 return; | |
377 | |
378 RefPtr<TextTrackCue> cue = TextTrackCue::create(*m_document, m_currentStartT
ime, m_currentEndTime, m_currentContent.toString()); | 375 RefPtr<TextTrackCue> cue = TextTrackCue::create(*m_document, m_currentStartT
ime, m_currentEndTime, m_currentContent.toString()); |
379 cue->setId(m_currentId); | 376 cue->setId(m_currentId); |
380 cue->setCueSettings(m_currentSettings); | 377 cue->setCueSettings(m_currentSettings); |
381 | 378 |
382 m_cuelist.append(cue); | 379 m_cuelist.append(cue); |
383 if (m_client) | 380 if (m_client) |
384 m_client->newCuesParsed(); | 381 m_client->newCuesParsed(); |
385 } | 382 } |
386 | 383 |
387 void WebVTTParser::resetCueValues() | 384 void WebVTTParser::resetCueValues() |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 } | 558 } |
562 | 559 |
563 void WebVTTParser::skipWhiteSpace(const String& line, unsigned* position) | 560 void WebVTTParser::skipWhiteSpace(const String& line, unsigned* position) |
564 { | 561 { |
565 while (*position < line.length() && isASpace(line[*position])) | 562 while (*position < line.length() && isASpace(line[*position])) |
566 (*position)++; | 563 (*position)++; |
567 } | 564 } |
568 | 565 |
569 } | 566 } |
570 | 567 |
OLD | NEW |