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 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
621 void TextTrackCue::determineTextDirection() | 621 void TextTrackCue::determineTextDirection() |
622 { | 622 { |
623 DEFINE_STATIC_LOCAL(const String, rtTag, ("rt")); | 623 DEFINE_STATIC_LOCAL(const String, rtTag, ("rt")); |
624 createWebVTTNodeTree(); | 624 createWebVTTNodeTree(); |
625 | 625 |
626 // Apply the Unicode Bidirectional Algorithm's Paragraph Level steps to the | 626 // Apply the Unicode Bidirectional Algorithm's Paragraph Level steps to the |
627 // concatenation of the values of each WebVTT Text Object in nodes, in a | 627 // concatenation of the values of each WebVTT Text Object in nodes, in a |
628 // pre-order, depth-first traversal, excluding WebVTT Ruby Text Objects and | 628 // pre-order, depth-first traversal, excluding WebVTT Ruby Text Objects and |
629 // their descendants. | 629 // their descendants. |
630 StringBuilder paragraphBuilder; | 630 StringBuilder paragraphBuilder; |
631 for (Node* node = m_webVTTNodeTree->firstChild(); node; node = NodeTraversal
::next(node, m_webVTTNodeTree.get())) { | 631 for (Node* node = m_webVTTNodeTree->firstChild(); node; node = NodeTraversal
::next(*node, m_webVTTNodeTree.get())) { |
632 if (!node->isTextNode() || node->localName() == rtTag) | 632 if (!node->isTextNode() || node->localName() == rtTag) |
633 continue; | 633 continue; |
634 | 634 |
635 paragraphBuilder.append(node->nodeValue()); | 635 paragraphBuilder.append(node->nodeValue()); |
636 } | 636 } |
637 | 637 |
638 String paragraph = paragraphBuilder.toString(); | 638 String paragraph = paragraphBuilder.toString(); |
639 if (!paragraph.length()) | 639 if (!paragraph.length()) |
640 return; | 640 return; |
641 | 641 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 | 780 |
781 void TextTrackCue::markFutureAndPastNodes(ContainerNode* root, double previousTi
mestamp, double movieTime) | 781 void TextTrackCue::markFutureAndPastNodes(ContainerNode* root, double previousTi
mestamp, double movieTime) |
782 { | 782 { |
783 DEFINE_STATIC_LOCAL(const String, timestampTag, ("timestamp")); | 783 DEFINE_STATIC_LOCAL(const String, timestampTag, ("timestamp")); |
784 | 784 |
785 bool isPastNode = true; | 785 bool isPastNode = true; |
786 double currentTimestamp = previousTimestamp; | 786 double currentTimestamp = previousTimestamp; |
787 if (currentTimestamp > movieTime) | 787 if (currentTimestamp > movieTime) |
788 isPastNode = false; | 788 isPastNode = false; |
789 | 789 |
790 for (Node* child = root->firstChild(); child; child = NodeTraversal::next(ch
ild, root)) { | 790 for (Node* child = root->firstChild(); child; child = NodeTraversal::next(*c
hild, root)) { |
791 if (child->nodeName() == timestampTag) { | 791 if (child->nodeName() == timestampTag) { |
792 unsigned position = 0; | 792 unsigned position = 0; |
793 String timestamp = child->nodeValue(); | 793 String timestamp = child->nodeValue(); |
794 double currentTimestamp = WebVTTParser::collectTimeStamp(timestamp,
&position); | 794 double currentTimestamp = WebVTTParser::collectTimeStamp(timestamp,
&position); |
795 ASSERT(currentTimestamp != -1); | 795 ASSERT(currentTimestamp != -1); |
796 | 796 |
797 if (currentTimestamp > movieTime) | 797 if (currentTimestamp > movieTime) |
798 isPastNode = false; | 798 isPastNode = false; |
799 } | 799 } |
800 | 800 |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 return false; | 1224 return false; |
1225 if (m_cueSize != cue.size()) | 1225 if (m_cueSize != cue.size()) |
1226 return false; | 1226 return false; |
1227 if (align() != cue.align()) | 1227 if (align() != cue.align()) |
1228 return false; | 1228 return false; |
1229 | 1229 |
1230 return true; | 1230 return true; |
1231 } | 1231 } |
1232 | 1232 |
1233 } // namespace WebCore | 1233 } // namespace WebCore |
OLD | NEW |