OLD | NEW |
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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 if (node->isVTTElement()) | 428 if (node->isVTTElement()) |
429 clonedNode = toVTTElement(node)->createEquivalentHTMLElement(documen
t()); | 429 clonedNode = toVTTElement(node)->createEquivalentHTMLElement(documen
t()); |
430 else | 430 else |
431 clonedNode = node->cloneNode(false); | 431 clonedNode = node->cloneNode(false); |
432 parent->appendChild(clonedNode); | 432 parent->appendChild(clonedNode); |
433 if (node->isContainerNode()) | 433 if (node->isContainerNode()) |
434 copyVTTNodeToDOMTree(toContainerNode(node), toContainerNode(clonedNo
de)); | 434 copyVTTNodeToDOMTree(toContainerNode(node), toContainerNode(clonedNo
de)); |
435 } | 435 } |
436 } | 436 } |
437 | 437 |
438 PassRefPtrWillBeRawPtr<DocumentFragment> VTTCue::getCueAsHTML() | 438 PassRefPtr<DocumentFragment> VTTCue::getCueAsHTML() |
439 { | 439 { |
440 createVTTNodeTree(); | 440 createVTTNodeTree(); |
441 RefPtrWillBeRawPtr<DocumentFragment> clonedFragment = DocumentFragment::crea
te(document()); | 441 RefPtr<DocumentFragment> clonedFragment = DocumentFragment::create(document(
)); |
442 copyVTTNodeToDOMTree(m_vttNodeTree.get(), clonedFragment.get()); | 442 copyVTTNodeToDOMTree(m_vttNodeTree.get(), clonedFragment.get()); |
443 return clonedFragment.release(); | 443 return clonedFragment.release(); |
444 } | 444 } |
445 | 445 |
446 PassRefPtrWillBeRawPtr<DocumentFragment> VTTCue::createCueRenderingTree() | 446 PassRefPtr<DocumentFragment> VTTCue::createCueRenderingTree() |
447 { | 447 { |
| 448 RefPtr<DocumentFragment> clonedFragment; |
448 createVTTNodeTree(); | 449 createVTTNodeTree(); |
449 RefPtrWillBeRawPtr<DocumentFragment> clonedFragment = DocumentFragment::crea
te(document()); | 450 clonedFragment = DocumentFragment::create(document()); |
450 m_vttNodeTree->cloneChildNodes(clonedFragment.get()); | 451 m_vttNodeTree->cloneChildNodes(clonedFragment.get()); |
451 return clonedFragment.release(); | 452 return clonedFragment.release(); |
452 } | 453 } |
453 | 454 |
454 void VTTCue::setRegionId(const String& regionId) | 455 void VTTCue::setRegionId(const String& regionId) |
455 { | 456 { |
456 if (m_regionId == regionId) | 457 if (m_regionId == regionId) |
457 return; | 458 return; |
458 | 459 |
459 cueWillChange(); | 460 cueWillChange(); |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 // The display tree may contain WebVTT timestamp objects representing | 705 // The display tree may contain WebVTT timestamp objects representing |
705 // timestamps (processing instructions), along with displayable nodes. | 706 // timestamps (processing instructions), along with displayable nodes. |
706 | 707 |
707 if (!track()->isRendered()) | 708 if (!track()->isRendered()) |
708 return; | 709 return; |
709 | 710 |
710 // Clear the contents of the set. | 711 // Clear the contents of the set. |
711 m_cueBackgroundBox->removeChildren(); | 712 m_cueBackgroundBox->removeChildren(); |
712 | 713 |
713 // Update the two sets containing past and future WebVTT objects. | 714 // Update the two sets containing past and future WebVTT objects. |
714 RefPtrWillBeRawPtr<DocumentFragment> referenceTree = createCueRenderingTree(
); | 715 RefPtr<DocumentFragment> referenceTree = createCueRenderingTree(); |
715 markFutureAndPastNodes(referenceTree.get(), startTime(), movieTime); | 716 markFutureAndPastNodes(referenceTree.get(), startTime(), movieTime); |
716 m_cueBackgroundBox->appendChild(referenceTree, ASSERT_NO_EXCEPTION); | 717 m_cueBackgroundBox->appendChild(referenceTree, ASSERT_NO_EXCEPTION); |
717 } | 718 } |
718 | 719 |
719 PassRefPtrWillBeRawPtr<VTTCueBox> VTTCue::getDisplayTree(const IntSize& videoSiz
e) | 720 PassRefPtrWillBeRawPtr<VTTCueBox> VTTCue::getDisplayTree(const IntSize& videoSiz
e) |
720 { | 721 { |
721 RefPtrWillBeRawPtr<VTTCueBox> displayTree(ensureDisplayTree()); | 722 RefPtrWillBeRawPtr<VTTCueBox> displayTree(ensureDisplayTree()); |
722 if (!m_displayTreeShouldChange || !track()->isRendered()) | 723 if (!m_displayTreeShouldChange || !track()->isRendered()) |
723 return displayTree.release(); | 724 return displayTree.release(); |
724 | 725 |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 | 1099 |
1099 void VTTCue::trace(Visitor* visitor) | 1100 void VTTCue::trace(Visitor* visitor) |
1100 { | 1101 { |
1101 visitor->trace(m_vttNodeTree); | 1102 visitor->trace(m_vttNodeTree); |
1102 visitor->trace(m_cueBackgroundBox); | 1103 visitor->trace(m_cueBackgroundBox); |
1103 visitor->trace(m_displayTree); | 1104 visitor->trace(m_displayTree); |
1104 TextTrackCue::trace(visitor); | 1105 TextTrackCue::trace(visitor); |
1105 } | 1106 } |
1106 | 1107 |
1107 } // namespace WebCore | 1108 } // namespace WebCore |
OLD | NEW |