| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 215     // direction is vertical growing left, then let writing-mode be | 215     // direction is vertical growing left, then let writing-mode be | 
| 216     // 'vertical-rl'. Otherwise, the text track cue writing direction is | 216     // 'vertical-rl'. Otherwise, the text track cue writing direction is | 
| 217     // vertical growing right; let writing-mode be 'vertical-lr'. | 217     // vertical growing right; let writing-mode be 'vertical-lr'. | 
| 218     m_displayWritingModeMap[Horizontal] = CSSValueHorizontalTb; | 218     m_displayWritingModeMap[Horizontal] = CSSValueHorizontalTb; | 
| 219     m_displayWritingModeMap[VerticalGrowingLeft] = CSSValueVerticalRl; | 219     m_displayWritingModeMap[VerticalGrowingLeft] = CSSValueVerticalRl; | 
| 220     m_displayWritingModeMap[VerticalGrowingRight] = CSSValueVerticalLr; | 220     m_displayWritingModeMap[VerticalGrowingRight] = CSSValueVerticalLr; | 
| 221 } | 221 } | 
| 222 | 222 | 
| 223 TextTrackCue::~TextTrackCue() | 223 TextTrackCue::~TextTrackCue() | 
| 224 { | 224 { | 
| 225     displayTreeInternal()->remove(ASSERT_NO_EXCEPTION_STATE); | 225     displayTreeInternal()->remove(ASSERT_NO_EXCEPTION); | 
| 226 } | 226 } | 
| 227 | 227 | 
| 228 PassRefPtr<TextTrackCueBox> TextTrackCue::createDisplayTree() | 228 PassRefPtr<TextTrackCueBox> TextTrackCue::createDisplayTree() | 
| 229 { | 229 { | 
| 230     return TextTrackCueBox::create(ownerDocument(), this); | 230     return TextTrackCueBox::create(ownerDocument(), this); | 
| 231 } | 231 } | 
| 232 | 232 | 
| 233 PassRefPtr<TextTrackCueBox> TextTrackCue::displayTreeInternal() | 233 PassRefPtr<TextTrackCueBox> TextTrackCue::displayTreeInternal() | 
| 234 { | 234 { | 
| 235     if (!m_displayTree) | 235     if (!m_displayTree) | 
| (...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 498 } | 498 } | 
| 499 | 499 | 
| 500 void TextTrackCue::copyWebVTTNodeToDOMTree(ContainerNode* webVTTNode, ContainerN
      ode* parent) | 500 void TextTrackCue::copyWebVTTNodeToDOMTree(ContainerNode* webVTTNode, ContainerN
      ode* parent) | 
| 501 { | 501 { | 
| 502     for (Node* node = webVTTNode->firstChild(); node; node = node->nextSibling()
      ) { | 502     for (Node* node = webVTTNode->firstChild(); node; node = node->nextSibling()
      ) { | 
| 503         RefPtr<Node> clonedNode; | 503         RefPtr<Node> clonedNode; | 
| 504         if (node->isWebVTTElement()) | 504         if (node->isWebVTTElement()) | 
| 505             clonedNode = toWebVTTElement(node)->createEquivalentHTMLElement(owne
      rDocument()); | 505             clonedNode = toWebVTTElement(node)->createEquivalentHTMLElement(owne
      rDocument()); | 
| 506         else | 506         else | 
| 507             clonedNode = node->cloneNode(false); | 507             clonedNode = node->cloneNode(false); | 
| 508         parent->appendChild(clonedNode, ASSERT_NO_EXCEPTION_STATE); | 508         parent->appendChild(clonedNode, ASSERT_NO_EXCEPTION); | 
| 509         if (node->isContainerNode()) | 509         if (node->isContainerNode()) | 
| 510             copyWebVTTNodeToDOMTree(toContainerNode(node), toContainerNode(clone
      dNode.get())); | 510             copyWebVTTNodeToDOMTree(toContainerNode(node), toContainerNode(clone
      dNode.get())); | 
| 511     } | 511     } | 
| 512 } | 512 } | 
| 513 | 513 | 
| 514 PassRefPtr<DocumentFragment> TextTrackCue::getCueAsHTML() | 514 PassRefPtr<DocumentFragment> TextTrackCue::getCueAsHTML() | 
| 515 { | 515 { | 
| 516     createWebVTTNodeTree(); | 516     createWebVTTNodeTree(); | 
| 517     RefPtr<DocumentFragment> clonedFragment = DocumentFragment::create(ownerDocu
      ment()); | 517     RefPtr<DocumentFragment> clonedFragment = DocumentFragment::create(ownerDocu
      ment()); | 
| 518     copyWebVTTNodeToDOMTree(m_webVTTNodeTree.get(), clonedFragment.get()); | 518     copyWebVTTNodeToDOMTree(m_webVTTNodeTree.get(), clonedFragment.get()); | 
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 797     displayTree->removeChildren(); | 797     displayTree->removeChildren(); | 
| 798 | 798 | 
| 799     // The document tree is the tree of WebVTT Node Objects rooted at nodes. | 799     // The document tree is the tree of WebVTT Node Objects rooted at nodes. | 
| 800 | 800 | 
| 801     // The children of the nodes must be wrapped in an anonymous box whose | 801     // The children of the nodes must be wrapped in an anonymous box whose | 
| 802     // 'display' property has the value 'inline'. This is the WebVTT cue | 802     // 'display' property has the value 'inline'. This is the WebVTT cue | 
| 803     // background box. | 803     // background box. | 
| 804 | 804 | 
| 805     // Note: This is contained by default in m_cueBackgroundBox. | 805     // Note: This is contained by default in m_cueBackgroundBox. | 
| 806     m_cueBackgroundBox->setPseudo(cueShadowPseudoId()); | 806     m_cueBackgroundBox->setPseudo(cueShadowPseudoId()); | 
| 807     displayTree->appendChild(m_cueBackgroundBox, ASSERT_NO_EXCEPTION_STATE, Atta
      chLazily); | 807     displayTree->appendChild(m_cueBackgroundBox, ASSERT_NO_EXCEPTION, AttachLazi
      ly); | 
| 808 | 808 | 
| 809     // FIXME(BUG 79916): Runs of children of WebVTT Ruby Objects that are not | 809     // FIXME(BUG 79916): Runs of children of WebVTT Ruby Objects that are not | 
| 810     // WebVTT Ruby Text Objects must be wrapped in anonymous boxes whose | 810     // WebVTT Ruby Text Objects must be wrapped in anonymous boxes whose | 
| 811     // 'display' property has the value 'ruby-base'. | 811     // 'display' property has the value 'ruby-base'. | 
| 812 | 812 | 
| 813     // FIXME(BUG 79916): Text runs must be wrapped according to the CSS | 813     // FIXME(BUG 79916): Text runs must be wrapped according to the CSS | 
| 814     // line-wrapping rules, except that additionally, regardless of the value of | 814     // line-wrapping rules, except that additionally, regardless of the value of | 
| 815     // the 'white-space' property, lines must be wrapped at the edge of their | 815     // the 'white-space' property, lines must be wrapped at the edge of their | 
| 816     // containing blocks, even if doing so requires splitting a word where there | 816     // containing blocks, even if doing so requires splitting a word where there | 
| 817     // is no line breaking opportunity. (Thus, normally text wraps as needed, | 817     // is no line breaking opportunity. (Thus, normally text wraps as needed, | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
| 828 | 828 | 
| 829 void TextTrackCue::removeDisplayTree() | 829 void TextTrackCue::removeDisplayTree() | 
| 830 { | 830 { | 
| 831 #if ENABLE(WEBVTT_REGIONS) | 831 #if ENABLE(WEBVTT_REGIONS) | 
| 832     // The region needs to be informed about the cue removal. | 832     // The region needs to be informed about the cue removal. | 
| 833     TextTrackRegion* region = m_track->regions()->getRegionById(m_regionId); | 833     TextTrackRegion* region = m_track->regions()->getRegionById(m_regionId); | 
| 834     if (region) | 834     if (region) | 
| 835         region->willRemoveTextTrackCueBox(m_displayTree.get()); | 835         region->willRemoveTextTrackCueBox(m_displayTree.get()); | 
| 836 #endif | 836 #endif | 
| 837 | 837 | 
| 838     displayTreeInternal()->remove(ASSERT_NO_EXCEPTION_STATE); | 838     displayTreeInternal()->remove(ASSERT_NO_EXCEPTION); | 
| 839 } | 839 } | 
| 840 | 840 | 
| 841 std::pair<double, double> TextTrackCue::getPositionCoordinates() const | 841 std::pair<double, double> TextTrackCue::getPositionCoordinates() const | 
| 842 { | 842 { | 
| 843     // This method is used for setting x and y when snap to lines is not set. | 843     // This method is used for setting x and y when snap to lines is not set. | 
| 844     std::pair<double, double> coordinates; | 844     std::pair<double, double> coordinates; | 
| 845 | 845 | 
| 846     if (m_writingDirection == Horizontal && m_displayDirection == CSSValueLtr) { | 846     if (m_writingDirection == Horizontal && m_displayDirection == CSSValueLtr) { | 
| 847         coordinates.first = m_textPosition; | 847         coordinates.first = m_textPosition; | 
| 848         coordinates.second = m_computedLinePosition; | 848         coordinates.second = m_computedLinePosition; | 
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1182         return false; | 1182         return false; | 
| 1183     if (m_cueSize != cue.size()) | 1183     if (m_cueSize != cue.size()) | 
| 1184         return false; | 1184         return false; | 
| 1185     if (align() != cue.align()) | 1185     if (align() != cue.align()) | 
| 1186         return false; | 1186         return false; | 
| 1187 | 1187 | 
| 1188     return true; | 1188     return true; | 
| 1189 } | 1189 } | 
| 1190 | 1190 | 
| 1191 } // namespace WebCore | 1191 } // namespace WebCore | 
| OLD | NEW | 
|---|