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

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

Issue 923563002: Fold VTTCue::createCueRenderingTree into VTTCue::updateDisplayTree (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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/VTTCue.h ('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) 2013, Opera Software ASA. All rights reserved. 2 * Copyright (c) 2013, Opera Software ASA. 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 } 483 }
484 484
485 PassRefPtrWillBeRawPtr<DocumentFragment> VTTCue::getCueAsHTML() 485 PassRefPtrWillBeRawPtr<DocumentFragment> VTTCue::getCueAsHTML()
486 { 486 {
487 createVTTNodeTree(); 487 createVTTNodeTree();
488 RefPtrWillBeRawPtr<DocumentFragment> clonedFragment = DocumentFragment::crea te(document()); 488 RefPtrWillBeRawPtr<DocumentFragment> clonedFragment = DocumentFragment::crea te(document());
489 copyVTTNodeToDOMTree(m_vttNodeTree.get(), clonedFragment.get()); 489 copyVTTNodeToDOMTree(m_vttNodeTree.get(), clonedFragment.get());
490 return clonedFragment.release(); 490 return clonedFragment.release();
491 } 491 }
492 492
493 PassRefPtrWillBeRawPtr<DocumentFragment> VTTCue::createCueRenderingTree()
494 {
495 createVTTNodeTree();
496 RefPtrWillBeRawPtr<DocumentFragment> clonedFragment = DocumentFragment::crea te(document());
497 m_vttNodeTree->cloneChildNodes(clonedFragment.get());
498 return clonedFragment.release();
499 }
500
501 void VTTCue::setRegionId(const String& regionId) 493 void VTTCue::setRegionId(const String& regionId)
502 { 494 {
503 if (m_regionId == regionId) 495 if (m_regionId == regionId)
504 return; 496 return;
505 497
506 cueWillChange(); 498 cueWillChange();
507 m_regionId = regionId; 499 m_regionId = regionId;
508 cueDidChange(); 500 cueDidChange();
509 } 501 }
510 502
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 // The display tree may contain WebVTT timestamp objects representing 789 // The display tree may contain WebVTT timestamp objects representing
798 // timestamps (processing instructions), along with displayable nodes. 790 // timestamps (processing instructions), along with displayable nodes.
799 791
800 if (!track()->isRendered()) 792 if (!track()->isRendered())
801 return; 793 return;
802 794
803 // Clear the contents of the set. 795 // Clear the contents of the set.
804 m_cueBackgroundBox->removeChildren(); 796 m_cueBackgroundBox->removeChildren();
805 797
806 // Update the two sets containing past and future WebVTT objects. 798 // Update the two sets containing past and future WebVTT objects.
807 RefPtrWillBeRawPtr<DocumentFragment> referenceTree = createCueRenderingTree( ); 799 createVTTNodeTree();
800 RefPtrWillBeRawPtr<DocumentFragment> referenceTree = DocumentFragment::creat e(document());
801 m_vttNodeTree->cloneChildNodes(referenceTree.get());
808 markFutureAndPastNodes(referenceTree.get(), startTime(), movieTime); 802 markFutureAndPastNodes(referenceTree.get(), startTime(), movieTime);
809 m_cueBackgroundBox->appendChild(referenceTree, ASSERT_NO_EXCEPTION); 803 m_cueBackgroundBox->appendChild(referenceTree, ASSERT_NO_EXCEPTION);
810 } 804 }
811 805
812 PassRefPtrWillBeRawPtr<VTTCueBox> VTTCue::getDisplayTree() 806 PassRefPtrWillBeRawPtr<VTTCueBox> VTTCue::getDisplayTree()
813 { 807 {
814 RefPtrWillBeRawPtr<VTTCueBox> displayTree(ensureDisplayTree()); 808 RefPtrWillBeRawPtr<VTTCueBox> displayTree(ensureDisplayTree());
815 if (!m_displayTreeShouldChange || !track()->isRendered()) 809 if (!m_displayTreeShouldChange || !track()->isRendered())
816 return displayTree.release(); 810 return displayTree.release();
817 811
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 1128
1135 void VTTCue::trace(Visitor* visitor) 1129 void VTTCue::trace(Visitor* visitor)
1136 { 1130 {
1137 visitor->trace(m_vttNodeTree); 1131 visitor->trace(m_vttNodeTree);
1138 visitor->trace(m_cueBackgroundBox); 1132 visitor->trace(m_cueBackgroundBox);
1139 visitor->trace(m_displayTree); 1133 visitor->trace(m_displayTree);
1140 TextTrackCue::trace(visitor); 1134 TextTrackCue::trace(visitor);
1141 } 1135 }
1142 1136
1143 } // namespace blink 1137 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/track/vtt/VTTCue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698