| 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 14 matching lines...) Expand all Loading... |
| 25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 25 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 27 * OF THE POSSIBILITY OF SUCH DAMAGE. | 27 * OF THE POSSIBILITY OF SUCH DAMAGE. |
| 28 */ | 28 */ |
| 29 | 29 |
| 30 #include "config.h" | 30 #include "config.h" |
| 31 #include "core/html/track/vtt/VTTCue.h" | 31 #include "core/html/track/vtt/VTTCue.h" |
| 32 | 32 |
| 33 #include "bindings/core/v8/ExceptionMessages.h" | 33 #include "bindings/core/v8/ExceptionMessages.h" |
| 34 #include "bindings/core/v8/ExceptionStatePlaceholder.h" | 34 #include "bindings/core/v8/ExceptionStatePlaceholder.h" |
| 35 #include "bindings/core/v8/UnionTypesCore.h" |
| 35 #include "core/CSSPropertyNames.h" | 36 #include "core/CSSPropertyNames.h" |
| 36 #include "core/CSSValueKeywords.h" | 37 #include "core/CSSValueKeywords.h" |
| 37 #include "core/dom/DocumentFragment.h" | 38 #include "core/dom/DocumentFragment.h" |
| 38 #include "core/dom/NodeTraversal.h" | 39 #include "core/dom/NodeTraversal.h" |
| 39 #include "core/events/Event.h" | 40 #include "core/events/Event.h" |
| 40 #include "core/frame/UseCounter.h" | 41 #include "core/frame/UseCounter.h" |
| 41 #include "core/html/HTMLDivElement.h" | 42 #include "core/html/HTMLDivElement.h" |
| 42 #include "core/html/track/TextTrack.h" | 43 #include "core/html/track/TextTrack.h" |
| 43 #include "core/html/track/TextTrackCueList.h" | 44 #include "core/html/track/TextTrackCueList.h" |
| 44 #include "core/html/track/vtt/VTTElement.h" | 45 #include "core/html/track/vtt/VTTElement.h" |
| 45 #include "core/html/track/vtt/VTTParser.h" | 46 #include "core/html/track/vtt/VTTParser.h" |
| 46 #include "core/html/track/vtt/VTTRegionList.h" | 47 #include "core/html/track/vtt/VTTRegionList.h" |
| 47 #include "core/html/track/vtt/VTTScanner.h" | 48 #include "core/html/track/vtt/VTTScanner.h" |
| 48 #include "core/rendering/RenderVTTCue.h" | 49 #include "core/rendering/RenderVTTCue.h" |
| 49 #include "platform/FloatConversion.h" | 50 #include "platform/FloatConversion.h" |
| 50 #include "platform/RuntimeEnabledFeatures.h" | 51 #include "platform/RuntimeEnabledFeatures.h" |
| 51 #include "platform/text/BidiResolver.h" | 52 #include "platform/text/BidiResolver.h" |
| 52 #include "platform/text/TextRunIterator.h" | 53 #include "platform/text/TextRunIterator.h" |
| 53 #include "wtf/MathExtras.h" | 54 #include "wtf/MathExtras.h" |
| 54 #include "wtf/text/StringBuilder.h" | 55 #include "wtf/text/StringBuilder.h" |
| 55 | 56 |
| 56 namespace blink { | 57 namespace blink { |
| 57 | 58 |
| 58 static const float undefinedPosition = -1; | |
| 59 static const float undefinedSize = -1; | 59 static const float undefinedSize = -1; |
| 60 | 60 |
| 61 static const CSSValueID displayWritingModeMap[] = { | 61 static const CSSValueID displayWritingModeMap[] = { |
| 62 CSSValueHorizontalTb, CSSValueVerticalRl, CSSValueVerticalLr | 62 CSSValueHorizontalTb, CSSValueVerticalRl, CSSValueVerticalLr |
| 63 }; | 63 }; |
| 64 static_assert(WTF_ARRAY_LENGTH(displayWritingModeMap) == VTTCue::NumberOfWriting
Directions, | 64 static_assert(WTF_ARRAY_LENGTH(displayWritingModeMap) == VTTCue::NumberOfWriting
Directions, |
| 65 "displayWritingModeMap should have the same number of elements as VTTCue::Nu
mberOfWritingDirections"); | 65 "displayWritingModeMap should have the same number of elements as VTTCue::Nu
mberOfWritingDirections"); |
| 66 | 66 |
| 67 static const CSSValueID displayAlignmentMap[] = { | 67 static const CSSValueID displayAlignmentMap[] = { |
| 68 CSSValueStart, CSSValueCenter, CSSValueEnd, CSSValueLeft, CSSValueRight | 68 CSSValueStart, CSSValueCenter, CSSValueEnd, CSSValueLeft, CSSValueRight |
| 69 }; | 69 }; |
| 70 static_assert(WTF_ARRAY_LENGTH(displayAlignmentMap) == VTTCue::NumberOfAlignment
s, | 70 static_assert(WTF_ARRAY_LENGTH(displayAlignmentMap) == VTTCue::NumberOfAlignment
s, |
| 71 "displayAlignmentMap should have the same number of elements as VTTCue::Numb
erOfAlignments"); | 71 "displayAlignmentMap should have the same number of elements as VTTCue::Numb
erOfAlignments"); |
| 72 | 72 |
| 73 static const String& autoKeyword() |
| 74 { |
| 75 DEFINE_STATIC_LOCAL(const String, autoString, ("auto")); |
| 76 return autoString; |
| 77 } |
| 78 |
| 73 static const String& startKeyword() | 79 static const String& startKeyword() |
| 74 { | 80 { |
| 75 DEFINE_STATIC_LOCAL(const String, start, ("start")); | 81 DEFINE_STATIC_LOCAL(const String, start, ("start")); |
| 76 return start; | 82 return start; |
| 77 } | 83 } |
| 78 | 84 |
| 79 static const String& middleKeyword() | 85 static const String& middleKeyword() |
| 80 { | 86 { |
| 81 DEFINE_STATIC_LOCAL(const String, middle, ("middle")); | 87 DEFINE_STATIC_LOCAL(const String, middle, ("middle")); |
| 82 return middle; | 88 return middle; |
| (...skipping 27 matching lines...) Expand all Loading... |
| 110 DEFINE_STATIC_LOCAL(const String, verticalrl, ("rl")); | 116 DEFINE_STATIC_LOCAL(const String, verticalrl, ("rl")); |
| 111 return verticalrl; | 117 return verticalrl; |
| 112 } | 118 } |
| 113 | 119 |
| 114 static const String& verticalGrowingRightKeyword() | 120 static const String& verticalGrowingRightKeyword() |
| 115 { | 121 { |
| 116 DEFINE_STATIC_LOCAL(const String, verticallr, ("lr")); | 122 DEFINE_STATIC_LOCAL(const String, verticallr, ("lr")); |
| 117 return verticallr; | 123 return verticallr; |
| 118 } | 124 } |
| 119 | 125 |
| 126 static bool isInvalidPercentage(double value) |
| 127 { |
| 128 ASSERT(std::isfinite(value)); |
| 129 return value < 0 || value > 100; |
| 130 } |
| 131 |
| 120 static bool isInvalidPercentage(double value, ExceptionState& exceptionState) | 132 static bool isInvalidPercentage(double value, ExceptionState& exceptionState) |
| 121 { | 133 { |
| 122 ASSERT(std::isfinite(value)); | 134 if (isInvalidPercentage(value)) { |
| 123 if (value < 0 || value > 100) { | |
| 124 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xOutsideRange<double>("value", value, 0, ExceptionMessages::InclusiveBound, 100,
ExceptionMessages::InclusiveBound)); | 135 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::inde
xOutsideRange<double>("value", value, 0, ExceptionMessages::InclusiveBound, 100,
ExceptionMessages::InclusiveBound)); |
| 125 return true; | 136 return true; |
| 126 } | 137 } |
| 127 return false; | 138 return false; |
| 128 } | 139 } |
| 129 | 140 |
| 130 VTTCueBox::VTTCueBox(Document& document, VTTCue* cue) | 141 VTTCueBox::VTTCueBox(Document& document, VTTCue* cue) |
| 131 : HTMLDivElement(document) | 142 : HTMLDivElement(document) |
| 132 , m_cue(cue) | 143 , m_cue(cue) |
| 133 { | 144 { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 215 |
| 205 void VTTCueBox::trace(Visitor* visitor) | 216 void VTTCueBox::trace(Visitor* visitor) |
| 206 { | 217 { |
| 207 visitor->trace(m_cue); | 218 visitor->trace(m_cue); |
| 208 HTMLDivElement::trace(visitor); | 219 HTMLDivElement::trace(visitor); |
| 209 } | 220 } |
| 210 | 221 |
| 211 VTTCue::VTTCue(Document& document, double startTime, double endTime, const Strin
g& text) | 222 VTTCue::VTTCue(Document& document, double startTime, double endTime, const Strin
g& text) |
| 212 : TextTrackCue(startTime, endTime) | 223 : TextTrackCue(startTime, endTime) |
| 213 , m_text(text) | 224 , m_text(text) |
| 214 , m_linePosition(undefinedPosition) | 225 , m_linePosition(std::numeric_limits<float>::quiet_NaN()) |
| 215 , m_computedLinePosition(undefinedPosition) | 226 , m_computedLinePosition(std::numeric_limits<float>::quiet_NaN()) |
| 216 , m_textPosition(50) | 227 , m_textPosition(50) |
| 217 , m_cueSize(100) | 228 , m_cueSize(100) |
| 218 , m_writingDirection(Horizontal) | 229 , m_writingDirection(Horizontal) |
| 219 , m_cueAlignment(Middle) | 230 , m_cueAlignment(Middle) |
| 220 , m_vttNodeTree(nullptr) | 231 , m_vttNodeTree(nullptr) |
| 221 , m_cueBackgroundBox(HTMLDivElement::create(document)) | 232 , m_cueBackgroundBox(HTMLDivElement::create(document)) |
| 222 , m_displayDirection(CSSValueLtr) | 233 , m_displayDirection(CSSValueLtr) |
| 223 , m_displaySize(undefinedSize) | 234 , m_displaySize(undefinedSize) |
| 224 , m_snapToLines(true) | 235 , m_snapToLines(true) |
| 225 , m_displayTreeShouldChange(true) | 236 , m_displayTreeShouldChange(true) |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 void VTTCue::setSnapToLines(bool value) | 310 void VTTCue::setSnapToLines(bool value) |
| 300 { | 311 { |
| 301 if (m_snapToLines == value) | 312 if (m_snapToLines == value) |
| 302 return; | 313 return; |
| 303 | 314 |
| 304 cueWillChange(); | 315 cueWillChange(); |
| 305 m_snapToLines = value; | 316 m_snapToLines = value; |
| 306 cueDidChange(); | 317 cueDidChange(); |
| 307 } | 318 } |
| 308 | 319 |
| 309 void VTTCue::setLine(double position, ExceptionState& exceptionState) | 320 bool VTTCue::lineIsAuto() const |
| 310 { | 321 { |
| 311 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-line | 322 return std::isnan(m_linePosition); |
| 312 // On setting, if the text track cue snap-to-lines flag is not set, and the
new | 323 } |
| 313 // value is negative or greater than 100, then throw an IndexSizeError excep
tion. | 324 |
| 314 if (!m_snapToLines && (position < 0 || position > 100)) { | 325 void VTTCue::line(DoubleOrAutoKeyword& result) const |
| 315 exceptionState.throwDOMException(IndexSizeError, "The snap-to-lines flag
is not set, and the value provided (" + String::number(position) + ") is not be
tween 0 and 100."); | 326 { |
| 327 if (lineIsAuto()) |
| 328 result.setAutoKeyword(autoKeyword()); |
| 329 else |
| 330 result.setDouble(m_linePosition); |
| 331 } |
| 332 |
| 333 void VTTCue::setLine(const DoubleOrAutoKeyword& position, ExceptionState& except
ionState) |
| 334 { |
| 335 // FIXME: Expecting bindings code to handle this case: https://crbug.com/450
252. |
| 336 if (position.isDouble() && !std::isfinite(position.getAsDouble())) { |
| 337 exceptionState.throwTypeError("The provided double value is non-finite."
); |
| 316 return; | 338 return; |
| 317 } | 339 } |
| 318 | 340 |
| 319 // Otherwise, set the text track cue line position to the new value. | 341 // http://dev.w3.org/html5/webvtt/#dfn-vttcue-line |
| 320 float floatPosition = narrowPrecisionToFloat(position); | 342 // On setting, the text track cue line position must be set to the new |
| 321 if (m_linePosition == floatPosition) | 343 // value; if the new value is the string "auto", then it must be |
| 322 return; | 344 // interpreted as the special value auto. |
| 345 // ("auto" is translated to NaN.) |
| 346 float floatPosition; |
| 347 if (position.isAutoKeyword()) { |
| 348 if (lineIsAuto()) |
| 349 return; |
| 350 floatPosition = std::numeric_limits<float>::quiet_NaN(); |
| 351 } else { |
| 352 ASSERT(position.isDouble()); |
| 353 floatPosition = narrowPrecisionToFloat(position.getAsDouble()); |
| 354 if (m_linePosition == floatPosition) |
| 355 return; |
| 356 } |
| 323 | 357 |
| 324 cueWillChange(); | 358 cueWillChange(); |
| 325 m_linePosition = floatPosition; | 359 m_linePosition = floatPosition; |
| 326 m_computedLinePosition = calculateComputedLinePosition(); | 360 m_computedLinePosition = calculateComputedLinePosition(); |
| 327 cueDidChange(); | 361 cueDidChange(); |
| 328 } | 362 } |
| 329 | 363 |
| 330 void VTTCue::setPosition(double position, ExceptionState& exceptionState) | 364 void VTTCue::setPosition(double position, ExceptionState& exceptionState) |
| 331 { | 365 { |
| 332 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-position | 366 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-position |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 cueDidChange(); | 499 cueDidChange(); |
| 466 } | 500 } |
| 467 | 501 |
| 468 void VTTCue::notifyRegionWhenRemovingDisplayTree(bool notifyRegion) | 502 void VTTCue::notifyRegionWhenRemovingDisplayTree(bool notifyRegion) |
| 469 { | 503 { |
| 470 m_notifyRegion = notifyRegion; | 504 m_notifyRegion = notifyRegion; |
| 471 } | 505 } |
| 472 | 506 |
| 473 float VTTCue::calculateComputedLinePosition() | 507 float VTTCue::calculateComputedLinePosition() |
| 474 { | 508 { |
| 475 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#text-track-cue-computed-line-position | 509 // http://dev.w3.org/html5/webvtt/#dfn-text-track-cue-computed-line-position |
| 510 // A text track cue has a text track cue computed line position whose value |
| 511 // is that returned by the following algorithm, which is defined in terms |
| 512 // of the other aspects of the cue: |
| 476 | 513 |
| 477 // If the text track cue line position is numeric, then that is the text | 514 // 1. If the text track cue line position is numeric, the text track cue |
| 478 // track cue computed line position. | 515 // snap-to-lines flag of the text track cue is not set, and the text |
| 479 if (m_linePosition != undefinedPosition) | 516 // track cue line position is negative or greater than 100, then return |
| 517 // 100 and abort these steps. |
| 518 if (!lineIsAuto() && !m_snapToLines && isInvalidPercentage(m_linePosition)) |
| 519 return 100; |
| 520 |
| 521 // 2. If the text track cue line position is numeric, return the value of |
| 522 // the text track cue line position and abort these steps. (Either the |
| 523 // text track cue snap-to-lines flag is set, so any value, not just |
| 524 // those in the range 0..100, is valid, or the value is in the range |
| 525 // 0..100 and is thus valid regardless of the value of that flag.) |
| 526 if (!lineIsAuto()) |
| 480 return m_linePosition; | 527 return m_linePosition; |
| 481 | 528 |
| 482 // If the text track cue snap-to-lines flag of the text track cue is not | 529 // 3. If the text track cue snap-to-lines flag of the text track cue is not |
| 483 // set, the text track cue computed line position is the value 100; | 530 // set, return the value 100 and abort these steps. (The text track cue |
| 531 // line position is the special value auto.) |
| 484 if (!m_snapToLines) | 532 if (!m_snapToLines) |
| 485 return 100; | 533 return 100; |
| 486 | 534 |
| 487 // Otherwise, it is the value returned by the following algorithm: | 535 // 4. Let cue be the text track cue. |
| 488 | 536 // 5. If cue is not in a list of cues of a text track, or if that text |
| 489 // If cue is not associated with a text track, return -1 and abort these | 537 // track is not in the list of text tracks of a media element, return -1 |
| 490 // steps. | 538 // and abort these steps. |
| 491 if (!track()) | 539 if (!track()) |
| 492 return -1; | 540 return -1; |
| 493 | 541 |
| 494 // Let n be the number of text tracks whose text track mode is showing or | 542 // 6. Let track be the text track whose list of cues the cue is in. |
| 495 // showing by default and that are in the media element's list of text | 543 // 7. Let n be the number of text tracks whose text track mode is showing |
| 496 // tracks before track. | 544 // and that are in the media element's list of text tracks before track. |
| 497 int n = track()->trackIndexRelativeToRenderedTracks(); | 545 int n = track()->trackIndexRelativeToRenderedTracks(); |
| 498 | 546 |
| 499 // Increment n by one. | 547 // 8. Increment n by one. / 9. Negate n. / 10. Return n. |
| 500 n++; | 548 n++; |
| 501 | |
| 502 // Negate n. | |
| 503 n = -n; | 549 n = -n; |
| 504 | |
| 505 return n; | 550 return n; |
| 506 } | 551 } |
| 507 | 552 |
| 508 class VTTTextRunIterator : public TextRunIterator { | 553 class VTTTextRunIterator : public TextRunIterator { |
| 509 public: | 554 public: |
| 510 VTTTextRunIterator() { } | 555 VTTTextRunIterator() { } |
| 511 VTTTextRunIterator(const TextRun* textRun, unsigned offset) : TextRunIterato
r(textRun, offset) { } | 556 VTTTextRunIterator(const TextRun* textRun, unsigned offset) : TextRunIterato
r(textRun, offset) { } |
| 512 | 557 |
| 513 bool atParagraphSeparator() const | 558 bool atParagraphSeparator() const |
| 514 { | 559 { |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 781 void VTTCue::updateDisplay(const IntSize& videoSize, HTMLDivElement& container) | 826 void VTTCue::updateDisplay(const IntSize& videoSize, HTMLDivElement& container) |
| 782 { | 827 { |
| 783 UseCounter::count(document(), UseCounter::VTTCueRender); | 828 UseCounter::count(document(), UseCounter::VTTCueRender); |
| 784 | 829 |
| 785 if (m_writingDirection != Horizontal) | 830 if (m_writingDirection != Horizontal) |
| 786 UseCounter::count(document(), UseCounter::VTTCueRenderVertical); | 831 UseCounter::count(document(), UseCounter::VTTCueRenderVertical); |
| 787 | 832 |
| 788 if (!m_snapToLines) | 833 if (!m_snapToLines) |
| 789 UseCounter::count(document(), UseCounter::VTTCueRenderSnapToLinesFalse); | 834 UseCounter::count(document(), UseCounter::VTTCueRenderSnapToLinesFalse); |
| 790 | 835 |
| 791 if (m_linePosition != undefinedPosition) | 836 if (!lineIsAuto()) |
| 792 UseCounter::count(document(), UseCounter::VTTCueRenderLineNotAuto); | 837 UseCounter::count(document(), UseCounter::VTTCueRenderLineNotAuto); |
| 793 | 838 |
| 794 if (m_textPosition != 50) | 839 if (m_textPosition != 50) |
| 795 UseCounter::count(document(), UseCounter::VTTCueRenderPositionNot50); | 840 UseCounter::count(document(), UseCounter::VTTCueRenderPositionNot50); |
| 796 | 841 |
| 797 if (m_cueSize != 100) | 842 if (m_cueSize != 100) |
| 798 UseCounter::count(document(), UseCounter::VTTCueRenderSizeNot100); | 843 UseCounter::count(document(), UseCounter::VTTCueRenderSizeNot100); |
| 799 | 844 |
| 800 if (m_cueAlignment != Middle) | 845 if (m_cueAlignment != Middle) |
| 801 UseCounter::count(document(), UseCounter::VTTCueRenderAlignNotMiddle); | 846 UseCounter::count(document(), UseCounter::VTTCueRenderAlignNotMiddle); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 822 if (!container.contains(regionNode.get())) | 867 if (!container.contains(regionNode.get())) |
| 823 container.appendChild(regionNode); | 868 container.appendChild(regionNode); |
| 824 | 869 |
| 825 region->appendVTTCueBox(displayBox); | 870 region->appendVTTCueBox(displayBox); |
| 826 } | 871 } |
| 827 } | 872 } |
| 828 | 873 |
| 829 FloatPoint VTTCue::getPositionCoordinates() const | 874 FloatPoint VTTCue::getPositionCoordinates() const |
| 830 { | 875 { |
| 831 // This method is used for setting x and y when snap to lines is not set. | 876 // This method is used for setting x and y when snap to lines is not set. |
| 877 ASSERT(std::isfinite(m_computedLinePosition)); |
| 832 | 878 |
| 833 if (m_writingDirection == Horizontal && m_displayDirection == CSSValueLtr) | 879 if (m_writingDirection == Horizontal && m_displayDirection == CSSValueLtr) |
| 834 return FloatPoint(m_textPosition, m_computedLinePosition); | 880 return FloatPoint(m_textPosition, m_computedLinePosition); |
| 835 | 881 |
| 836 if (m_writingDirection == Horizontal && m_displayDirection == CSSValueRtl) | 882 if (m_writingDirection == Horizontal && m_displayDirection == CSSValueRtl) |
| 837 return FloatPoint(100 - m_textPosition, m_computedLinePosition); | 883 return FloatPoint(100 - m_textPosition, m_computedLinePosition); |
| 838 | 884 |
| 839 if (m_writingDirection == VerticalGrowingLeft) | 885 if (m_writingDirection == VerticalGrowingLeft) |
| 840 return FloatPoint(100 - m_computedLinePosition, m_textPosition); | 886 return FloatPoint(100 - m_computedLinePosition, m_textPosition); |
| 841 | 887 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1031 // Make sure the entire run is consumed. | 1077 // Make sure the entire run is consumed. |
| 1032 input.skipRun(valueRun); | 1078 input.skipRun(valueRun); |
| 1033 } | 1079 } |
| 1034 | 1080 |
| 1035 // If cue's line position is not auto or cue's size is not 100 or cue's | 1081 // If cue's line position is not auto or cue's size is not 100 or cue's |
| 1036 // writing direction is not horizontal, but cue's region identifier is not | 1082 // writing direction is not horizontal, but cue's region identifier is not |
| 1037 // the empty string, let cue's region identifier be the empty string. | 1083 // the empty string, let cue's region identifier be the empty string. |
| 1038 if (m_regionId.isEmpty()) | 1084 if (m_regionId.isEmpty()) |
| 1039 return; | 1085 return; |
| 1040 | 1086 |
| 1041 if (m_linePosition != undefinedPosition || m_cueSize != 100 || m_writingDire
ction != Horizontal) | 1087 if (!lineIsAuto() || m_cueSize != 100 || m_writingDirection != Horizontal) |
| 1042 m_regionId = emptyString(); | 1088 m_regionId = emptyString(); |
| 1043 } | 1089 } |
| 1044 | 1090 |
| 1045 CSSValueID VTTCue::getCSSAlignment() const | 1091 CSSValueID VTTCue::getCSSAlignment() const |
| 1046 { | 1092 { |
| 1047 return displayAlignmentMap[m_cueAlignment]; | 1093 return displayAlignmentMap[m_cueAlignment]; |
| 1048 } | 1094 } |
| 1049 | 1095 |
| 1050 CSSValueID VTTCue::getCSSWritingDirection() const | 1096 CSSValueID VTTCue::getCSSWritingDirection() const |
| 1051 { | 1097 { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 | 1131 |
| 1086 void VTTCue::trace(Visitor* visitor) | 1132 void VTTCue::trace(Visitor* visitor) |
| 1087 { | 1133 { |
| 1088 visitor->trace(m_vttNodeTree); | 1134 visitor->trace(m_vttNodeTree); |
| 1089 visitor->trace(m_cueBackgroundBox); | 1135 visitor->trace(m_cueBackgroundBox); |
| 1090 visitor->trace(m_displayTree); | 1136 visitor->trace(m_displayTree); |
| 1091 TextTrackCue::trace(visitor); | 1137 TextTrackCue::trace(visitor); |
| 1092 } | 1138 } |
| 1093 | 1139 |
| 1094 } // namespace blink | 1140 } // namespace blink |
| OLD | NEW |