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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 WebVTTParser::WebVTTParser(WebVTTParserClient* client, Document& document) | 113 WebVTTParser::WebVTTParser(WebVTTParserClient* client, Document& document) |
114 : m_document(&document) | 114 : m_document(&document) |
115 , m_state(Initial) | 115 , m_state(Initial) |
116 , m_decoder(TextResourceDecoder::create("text/plain", UTF8Encoding())) | 116 , m_decoder(TextResourceDecoder::create("text/plain", UTF8Encoding())) |
117 , m_currentStartTime(0) | 117 , m_currentStartTime(0) |
118 , m_currentEndTime(0) | 118 , m_currentEndTime(0) |
119 , m_client(client) | 119 , m_client(client) |
120 { | 120 { |
121 } | 121 } |
122 | 122 |
123 void WebVTTParser::getNewCues(Vector<RefPtr<TextTrackCue> >& outputCues) | 123 void WebVTTParser::getNewCues(Vector<RefPtr<VTTCue> >& outputCues) |
124 { | 124 { |
125 outputCues = m_cuelist; | 125 outputCues = m_cuelist; |
126 m_cuelist.clear(); | 126 m_cuelist.clear(); |
127 } | 127 } |
128 | 128 |
129 void WebVTTParser::getNewRegions(Vector<RefPtr<VTTRegion> >& outputRegions) | 129 void WebVTTParser::getNewRegions(Vector<RefPtr<VTTRegion> >& outputRegions) |
130 { | 130 { |
131 outputRegions = m_regionList; | 131 outputRegions = m_regionList; |
132 m_regionList.clear(); | 132 m_regionList.clear(); |
133 } | 133 } |
(...skipping 231 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 RefPtr<TextTrackCue> cue = TextTrackCue::create(*m_document, m_currentStartT
ime, m_currentEndTime, m_currentContent.toString()); | 375 RefPtr<VTTCue> cue = VTTCue::create(*m_document, m_currentStartTime, m_curre
ntEndTime, m_currentContent.toString()); |
376 cue->setId(m_currentId); | 376 cue->setId(m_currentId); |
377 cue->setCueSettings(m_currentSettings); | 377 cue->setCueSettings(m_currentSettings); |
378 | 378 |
379 m_cuelist.append(cue); | 379 m_cuelist.append(cue); |
380 if (m_client) | 380 if (m_client) |
381 m_client->newCuesParsed(); | 381 m_client->newCuesParsed(); |
382 } | 382 } |
383 | 383 |
384 void WebVTTParser::resetCueValues() | 384 void WebVTTParser::resetCueValues() |
385 { | 385 { |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 } | 558 } |
559 | 559 |
560 void WebVTTParser::skipWhiteSpace(const String& line, unsigned* position) | 560 void WebVTTParser::skipWhiteSpace(const String& line, unsigned* position) |
561 { | 561 { |
562 while (*position < line.length() && isASpace(line[*position])) | 562 while (*position < line.length() && isASpace(line[*position])) |
563 (*position)++; | 563 (*position)++; |
564 } | 564 } |
565 | 565 |
566 } | 566 } |
567 | 567 |
OLD | NEW |