| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 } | 499 } |
| 500 | 500 |
| 501 void TextTrackCue::copyWebVTTNodeToDOMTree(ContainerNode* webVTTNode, ContainerN
ode* parent) | 501 void TextTrackCue::copyWebVTTNodeToDOMTree(ContainerNode* webVTTNode, ContainerN
ode* parent) |
| 502 { | 502 { |
| 503 for (Node* node = webVTTNode->firstChild(); node; node = node->nextSibling()
) { | 503 for (Node* node = webVTTNode->firstChild(); node; node = node->nextSibling()
) { |
| 504 RefPtr<Node> clonedNode; | 504 RefPtr<Node> clonedNode; |
| 505 if (node->isWebVTTElement()) | 505 if (node->isWebVTTElement()) |
| 506 clonedNode = toWebVTTElement(node)->createEquivalentHTMLElement(owne
rDocument()); | 506 clonedNode = toWebVTTElement(node)->createEquivalentHTMLElement(owne
rDocument()); |
| 507 else | 507 else |
| 508 clonedNode = node->cloneNode(false); | 508 clonedNode = node->cloneNode(false); |
| 509 parent->appendChild(clonedNode, ASSERT_NO_EXCEPTION); | 509 parent->appendChild(clonedNode, ASSERT_NO_EXCEPTION, DeprecatedAttachNow
); |
| 510 if (node->isContainerNode()) | 510 if (node->isContainerNode()) |
| 511 copyWebVTTNodeToDOMTree(toContainerNode(node), toContainerNode(clone
dNode.get())); | 511 copyWebVTTNodeToDOMTree(toContainerNode(node), toContainerNode(clone
dNode.get())); |
| 512 } | 512 } |
| 513 } | 513 } |
| 514 | 514 |
| 515 PassRefPtr<DocumentFragment> TextTrackCue::getCueAsHTML() | 515 PassRefPtr<DocumentFragment> TextTrackCue::getCueAsHTML() |
| 516 { | 516 { |
| 517 createWebVTTNodeTree(); | 517 createWebVTTNodeTree(); |
| 518 RefPtr<DocumentFragment> clonedFragment = DocumentFragment::create(ownerDocu
ment()); | 518 RefPtr<DocumentFragment> clonedFragment = DocumentFragment::create(ownerDocu
ment()); |
| 519 copyWebVTTNodeToDOMTree(m_webVTTNodeTree.get(), clonedFragment.get()); | 519 copyWebVTTNodeToDOMTree(m_webVTTNodeTree.get(), clonedFragment.get()); |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 | 773 |
| 774 if (!track()->isRendered()) | 774 if (!track()->isRendered()) |
| 775 return; | 775 return; |
| 776 | 776 |
| 777 // Clear the contents of the set. | 777 // Clear the contents of the set. |
| 778 m_cueBackgroundBox->removeChildren(); | 778 m_cueBackgroundBox->removeChildren(); |
| 779 | 779 |
| 780 // Update the two sets containing past and future WebVTT objects. | 780 // Update the two sets containing past and future WebVTT objects. |
| 781 RefPtr<DocumentFragment> referenceTree = createCueRenderingTree(); | 781 RefPtr<DocumentFragment> referenceTree = createCueRenderingTree(); |
| 782 markFutureAndPastNodes(referenceTree.get(), startTime(), movieTime); | 782 markFutureAndPastNodes(referenceTree.get(), startTime(), movieTime); |
| 783 m_cueBackgroundBox->appendChild(referenceTree); | 783 m_cueBackgroundBox->appendChild(referenceTree, ASSERT_NO_EXCEPTION, Deprecat
edAttachNow); |
| 784 } | 784 } |
| 785 | 785 |
| 786 PassRefPtr<TextTrackCueBox> TextTrackCue::getDisplayTree(const IntSize& videoSiz
e) | 786 PassRefPtr<TextTrackCueBox> TextTrackCue::getDisplayTree(const IntSize& videoSiz
e) |
| 787 { | 787 { |
| 788 RefPtr<TextTrackCueBox> displayTree = displayTreeInternal(); | 788 RefPtr<TextTrackCueBox> displayTree = displayTreeInternal(); |
| 789 if (!m_displayTreeShouldChange || !track()->isRendered()) | 789 if (!m_displayTreeShouldChange || !track()->isRendered()) |
| 790 return displayTree; | 790 return displayTree; |
| 791 | 791 |
| 792 // 10.1 - 10.10 | 792 // 10.1 - 10.10 |
| 793 calculateDisplayParameters(); | 793 calculateDisplayParameters(); |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1183 return false; | 1183 return false; |
| 1184 if (m_cueSize != cue.size()) | 1184 if (m_cueSize != cue.size()) |
| 1185 return false; | 1185 return false; |
| 1186 if (align() != cue.align()) | 1186 if (align() != cue.align()) |
| 1187 return false; | 1187 return false; |
| 1188 | 1188 |
| 1189 return true; | 1189 return true; |
| 1190 } | 1190 } |
| 1191 | 1191 |
| 1192 } // namespace WebCore | 1192 } // namespace WebCore |
| OLD | NEW |