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 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 } | 323 } |
324 | 324 |
325 PassRefPtr<DocumentFragment> WebVTTParser::createDocumentFragmentFromCueText(co
nst String& text) | 325 PassRefPtr<DocumentFragment> WebVTTParser::createDocumentFragmentFromCueText(co
nst String& text) |
326 { | 326 { |
327 // Cue text processing based on | 327 // Cue text processing based on |
328 // 4.8.10.13.4 WebVTT cue text parsing rules and | 328 // 4.8.10.13.4 WebVTT cue text parsing rules and |
329 // 4.8.10.13.5 WebVTT cue text DOM construction rules. | 329 // 4.8.10.13.5 WebVTT cue text DOM construction rules. |
330 | 330 |
331 ASSERT(m_scriptExecutionContext->isDocument()); | 331 ASSERT(m_scriptExecutionContext->isDocument()); |
332 Document* document = toDocument(m_scriptExecutionContext); | 332 Document* document = toDocument(m_scriptExecutionContext); |
| 333 ASSERT(document); |
333 | 334 |
334 RefPtr<DocumentFragment> fragment = DocumentFragment::create(document); | 335 RefPtr<DocumentFragment> fragment = DocumentFragment::create(*document); |
335 | 336 |
336 if (!text.length()) { | 337 if (!text.length()) { |
337 fragment->parserAppendChild(Text::create(document, "")); | 338 fragment->parserAppendChild(Text::create(document, "")); |
338 return fragment; | 339 return fragment; |
339 } | 340 } |
340 | 341 |
341 m_currentNode = fragment; | 342 m_currentNode = fragment; |
342 m_tokenizer->reset(); | 343 m_tokenizer->reset(); |
343 m_token.clear(); | 344 m_token.clear(); |
344 | 345 |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
565 unsigned oldPosition = *position; | 566 unsigned oldPosition = *position; |
566 while (*position < length && data[*position] != '\r' && data[*position] != '
\n') | 567 while (*position < length && data[*position] != '\r' && data[*position] != '
\n') |
567 (*position)++; | 568 (*position)++; |
568 String line = String::fromUTF8(data + oldPosition, *position - oldPosition); | 569 String line = String::fromUTF8(data + oldPosition, *position - oldPosition); |
569 skipLineTerminator(data, length, position); | 570 skipLineTerminator(data, length, position); |
570 return line; | 571 return line; |
571 } | 572 } |
572 | 573 |
573 } | 574 } |
574 | 575 |
OLD | NEW |