| 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 528 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 539 WTF::Unicode::Separator_Paragraph; | 539 WTF::Unicode::Separator_Paragraph; |
| 540 } | 540 } |
| 541 }; | 541 }; |
| 542 | 542 |
| 543 // Almost the same as determineDirectionality in core/html/HTMLElement.cpp, but | 543 // Almost the same as determineDirectionality in core/html/HTMLElement.cpp, but |
| 544 // that one uses a "plain" TextRunIterator (which only checks for '\n'). | 544 // that one uses a "plain" TextRunIterator (which only checks for '\n'). |
| 545 static TextDirection determineDirectionality(const String& value, | 545 static TextDirection determineDirectionality(const String& value, |
| 546 bool& hasStrongDirectionality) { | 546 bool& hasStrongDirectionality) { |
| 547 TextRun run(value); | 547 TextRun run(value); |
| 548 BidiResolver<VTTTextRunIterator, BidiCharacterRun> bidiResolver; | 548 BidiResolver<VTTTextRunIterator, BidiCharacterRun> bidiResolver; |
| 549 bidiResolver.setStatus(BidiStatus(TextDirection::Ltr, false)); | 549 bidiResolver.setStatus(BidiStatus(TextDirection::kLtr, false)); |
| 550 bidiResolver.setPositionIgnoringNestedIsolates(VTTTextRunIterator(&run, 0)); | 550 bidiResolver.setPositionIgnoringNestedIsolates(VTTTextRunIterator(&run, 0)); |
| 551 return bidiResolver.determineDirectionality(&hasStrongDirectionality); | 551 return bidiResolver.determineDirectionality(&hasStrongDirectionality); |
| 552 } | 552 } |
| 553 | 553 |
| 554 static CSSValueID determineTextDirection(DocumentFragment* vttRoot) { | 554 static CSSValueID determineTextDirection(DocumentFragment* vttRoot) { |
| 555 DCHECK(vttRoot); | 555 DCHECK(vttRoot); |
| 556 | 556 |
| 557 // Apply the Unicode Bidirectional Algorithm's Paragraph Level steps to the | 557 // Apply the Unicode Bidirectional Algorithm's Paragraph Level steps to the |
| 558 // concatenation of the values of each WebVTT Text Object in nodes, in a | 558 // concatenation of the values of each WebVTT Text Object in nodes, in a |
| 559 // pre-order, depth-first traversal, excluding WebVTT Ruby Text Objects and | 559 // pre-order, depth-first traversal, excluding WebVTT Ruby Text Objects and |
| 560 // their descendants. | 560 // their descendants. |
| 561 TextDirection textDirection = TextDirection::Ltr; | 561 TextDirection textDirection = TextDirection::kLtr; |
| 562 Node* node = NodeTraversal::next(*vttRoot); | 562 Node* node = NodeTraversal::next(*vttRoot); |
| 563 while (node) { | 563 while (node) { |
| 564 DCHECK(node->isDescendantOf(vttRoot)); | 564 DCHECK(node->isDescendantOf(vttRoot)); |
| 565 | 565 |
| 566 if (node->isTextNode()) { | 566 if (node->isTextNode()) { |
| 567 bool hasStrongDirectionality; | 567 bool hasStrongDirectionality; |
| 568 textDirection = | 568 textDirection = |
| 569 determineDirectionality(node->nodeValue(), hasStrongDirectionality); | 569 determineDirectionality(node->nodeValue(), hasStrongDirectionality); |
| 570 if (hasStrongDirectionality) | 570 if (hasStrongDirectionality) |
| 571 break; | 571 break; |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1139 } | 1139 } |
| 1140 | 1140 |
| 1141 DEFINE_TRACE(VTTCue) { | 1141 DEFINE_TRACE(VTTCue) { |
| 1142 visitor->trace(m_vttNodeTree); | 1142 visitor->trace(m_vttNodeTree); |
| 1143 visitor->trace(m_cueBackgroundBox); | 1143 visitor->trace(m_cueBackgroundBox); |
| 1144 visitor->trace(m_displayTree); | 1144 visitor->trace(m_displayTree); |
| 1145 TextTrackCue::trace(visitor); | 1145 TextTrackCue::trace(visitor); |
| 1146 } | 1146 } |
| 1147 | 1147 |
| 1148 } // namespace blink | 1148 } // namespace blink |
| OLD | NEW |