Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: Source/core/html/track/vtt/VTTParser.cpp

Issue 315843004: Oilpan: Replace RefPtrs to Node and its subclasses in core/html with Oilpan transitin types. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/track/vtt/VTTElement.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 { 310 {
311 if (line.isEmpty()) 311 if (line.isEmpty())
312 return Id; 312 return Id;
313 if (line.contains("-->")) 313 if (line.contains("-->"))
314 return recoverCue(line); 314 return recoverCue(line);
315 return BadCue; 315 return BadCue;
316 } 316 }
317 317
318 // A helper class for the construction of a "cue fragment" from the cue text. 318 // A helper class for the construction of a "cue fragment" from the cue text.
319 class VTTTreeBuilder { 319 class VTTTreeBuilder {
320 STACK_ALLOCATED();
320 public: 321 public:
321 VTTTreeBuilder(Document& document) 322 explicit VTTTreeBuilder(Document& document)
322 : m_document(document) { } 323 : m_document(&document) { }
323 324
324 PassRefPtrWillBeRawPtr<DocumentFragment> buildFromString(const String& cueTe xt); 325 PassRefPtrWillBeRawPtr<DocumentFragment> buildFromString(const String& cueTe xt);
325 326
326 private: 327 private:
327 void constructTreeFromToken(Document&); 328 void constructTreeFromToken(Document&);
329 Document& document() const { return *m_document; }
328 330
329 VTTToken m_token; 331 VTTToken m_token;
330 RefPtr<ContainerNode> m_currentNode; 332 RefPtrWillBeMember<ContainerNode> m_currentNode;
331 Vector<AtomicString> m_languageStack; 333 Vector<AtomicString> m_languageStack;
332 Document& m_document; 334 RawPtrWillBeMember<Document> m_document;
333 }; 335 };
334 336
335 PassRefPtrWillBeRawPtr<DocumentFragment> VTTTreeBuilder::buildFromString(const S tring& cueText) 337 PassRefPtrWillBeRawPtr<DocumentFragment> VTTTreeBuilder::buildFromString(const S tring& cueText)
336 { 338 {
337 // Cue text processing based on 339 // Cue text processing based on
338 // 5.4 WebVTT cue text parsing rules, and 340 // 5.4 WebVTT cue text parsing rules, and
339 // 5.5 WebVTT cue text DOM construction rules 341 // 5.5 WebVTT cue text DOM construction rules
340 342
341 RefPtrWillBeRawPtr<DocumentFragment> fragment = DocumentFragment::create(m_d ocument); 343 RefPtrWillBeRawPtr<DocumentFragment> fragment = DocumentFragment::create(doc ument());
342 344
343 if (cueText.isEmpty()) { 345 if (cueText.isEmpty()) {
344 fragment->parserAppendChild(Text::create(m_document, "")); 346 fragment->parserAppendChild(Text::create(document(), ""));
345 return fragment; 347 return fragment;
346 } 348 }
347 349
348 m_currentNode = fragment; 350 m_currentNode = fragment;
349 351
350 VTTTokenizer tokenizer(cueText); 352 VTTTokenizer tokenizer(cueText);
351 m_languageStack.clear(); 353 m_languageStack.clear();
352 354
353 while (tokenizer.nextToken(m_token)) 355 while (tokenizer.nextToken(m_token))
354 constructTreeFromToken(m_document); 356 constructTreeFromToken(document());
355 357
356 return fragment.release(); 358 return fragment.release();
357 } 359 }
358 360
359 PassRefPtrWillBeRawPtr<DocumentFragment> VTTParser::createDocumentFragmentFromCu eText(Document& document, const String& cueText) 361 PassRefPtrWillBeRawPtr<DocumentFragment> VTTParser::createDocumentFragmentFromCu eText(Document& document, const String& cueText)
360 { 362 {
361 VTTTreeBuilder treeBuilder(document); 363 VTTTreeBuilder treeBuilder(document);
362 return treeBuilder.buildFromString(cueText); 364 return treeBuilder.buildFromString(cueText);
363 } 365 }
364 366
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 } 559 }
558 } 560 }
559 561
560 void VTTParser::trace(Visitor* visitor) 562 void VTTParser::trace(Visitor* visitor)
561 { 563 {
562 visitor->trace(m_cueList); 564 visitor->trace(m_cueList);
563 visitor->trace(m_regionList); 565 visitor->trace(m_regionList);
564 } 566 }
565 567
566 } 568 }
OLDNEW
« no previous file with comments | « Source/core/html/track/vtt/VTTElement.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698