Chromium Code Reviews| 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(0) |
| 215 , m_computedLinePosition(undefinedPosition) | 226 , m_computedLinePosition(0) |
|
philipj_slow
2015/01/20 14:52:31
Since this is a valid line position, maybe initial
fs
2015/01/20 16:35:16
Makes sense. Done. (Not in calculateDisplayParamet
philipj_slow
2015/01/20 20:53:36
My idea was to actually assert that calculateCompu
fs
2015/01/21 09:00:12
I don't worry too much about at least (it mostly r
| |
| 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) |
| 236 , m_lineIsAuto(true) | |
| 225 , m_displayTreeShouldChange(true) | 237 , m_displayTreeShouldChange(true) |
| 226 , m_notifyRegion(true) | 238 , m_notifyRegion(true) |
| 227 { | 239 { |
| 228 UseCounter::count(document, UseCounter::VTTCue); | 240 UseCounter::count(document, UseCounter::VTTCue); |
| 229 } | 241 } |
| 230 | 242 |
| 231 VTTCue::~VTTCue() | 243 VTTCue::~VTTCue() |
| 232 { | 244 { |
| 233 // Using oilpan, if m_displayTree is in the document it will strongly keep | 245 // Using oilpan, if m_displayTree is in the document it will strongly keep |
| 234 // the cue alive. Thus, if the cue is dead, either m_displayTree is not in | 246 // the cue alive. Thus, if the cue is dead, either m_displayTree is not in |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 void VTTCue::setSnapToLines(bool value) | 311 void VTTCue::setSnapToLines(bool value) |
| 300 { | 312 { |
| 301 if (m_snapToLines == value) | 313 if (m_snapToLines == value) |
| 302 return; | 314 return; |
| 303 | 315 |
| 304 cueWillChange(); | 316 cueWillChange(); |
| 305 m_snapToLines = value; | 317 m_snapToLines = value; |
| 306 cueDidChange(); | 318 cueDidChange(); |
| 307 } | 319 } |
| 308 | 320 |
| 309 void VTTCue::setLine(double position, ExceptionState& exceptionState) | 321 void VTTCue::line(DoubleOrAutoKeyword& result) const |
| 310 { | 322 { |
| 311 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele ment.html#dom-texttrackcue-line | 323 if (m_lineIsAuto) |
| 312 // On setting, if the text track cue snap-to-lines flag is not set, and the new | 324 result.setAutoKeyword(autoKeyword()); |
| 313 // value is negative or greater than 100, then throw an IndexSizeError excep tion. | 325 else |
| 314 if (!m_snapToLines && (position < 0 || position > 100)) { | 326 result.setDouble(m_linePosition); |
| 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."); | 327 } |
| 316 return; | |
| 317 } | |
| 318 | 328 |
| 319 // Otherwise, set the text track cue line position to the new value. | 329 void VTTCue::setLine(const DoubleOrAutoKeyword& position) |
| 320 float floatPosition = narrowPrecisionToFloat(position); | 330 { |
| 321 if (m_linePosition == floatPosition) | 331 // http://dev.w3.org/html5/webvtt/#dfn-vttcue-line |
| 332 // On setting, the text track cue line position must be set to the new | |
| 333 // value; if the new value is the string "auto", then it must be | |
| 334 // interpreted as the special value auto. | |
| 335 bool lineIsAuto = position.isAutoKeyword(); | |
| 336 float floatPosition = m_linePosition; | |
| 337 if (position.isDouble()) | |
| 338 floatPosition = narrowPrecisionToFloat(position.getAsDouble()); | |
| 339 | |
| 340 if (m_lineIsAuto == lineIsAuto && m_linePosition == floatPosition) | |
| 322 return; | 341 return; |
| 323 | 342 |
| 324 cueWillChange(); | 343 cueWillChange(); |
| 344 m_lineIsAuto = lineIsAuto; | |
| 325 m_linePosition = floatPosition; | 345 m_linePosition = floatPosition; |
| 326 m_computedLinePosition = calculateComputedLinePosition(); | 346 m_computedLinePosition = calculateComputedLinePosition(); |
| 327 cueDidChange(); | 347 cueDidChange(); |
| 328 } | 348 } |
| 329 | 349 |
| 330 void VTTCue::setPosition(double position, ExceptionState& exceptionState) | 350 void VTTCue::setPosition(double position, ExceptionState& exceptionState) |
| 331 { | 351 { |
| 332 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele ment.html#dom-texttrackcue-position | 352 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele ment.html#dom-texttrackcue-position |
| 333 // On setting, if the new value is negative or greater than 100, then throw an IndexSizeError exception. | 353 // On setting, if the new value is negative or greater than 100, then throw an IndexSizeError exception. |
| 334 // Otherwise, set the text track cue text position to the new value. | 354 // Otherwise, set the text track cue text position to the new value. |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 465 cueDidChange(); | 485 cueDidChange(); |
| 466 } | 486 } |
| 467 | 487 |
| 468 void VTTCue::notifyRegionWhenRemovingDisplayTree(bool notifyRegion) | 488 void VTTCue::notifyRegionWhenRemovingDisplayTree(bool notifyRegion) |
| 469 { | 489 { |
| 470 m_notifyRegion = notifyRegion; | 490 m_notifyRegion = notifyRegion; |
| 471 } | 491 } |
| 472 | 492 |
| 473 float VTTCue::calculateComputedLinePosition() | 493 float VTTCue::calculateComputedLinePosition() |
| 474 { | 494 { |
| 475 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele ment.html#text-track-cue-computed-line-position | 495 // http://dev.w3.org/html5/webvtt/#dfn-text-track-cue-computed-line-position |
| 496 // A text track cue has a text track cue computed line position whose value | |
| 497 // is that returned by the following algorithm, which is defined in terms | |
| 498 // of the other aspects of the cue: | |
| 476 | 499 |
| 477 // If the text track cue line position is numeric, then that is the text | 500 // 1. If the text track cue line position is numeric, the text track cue |
| 478 // track cue computed line position. | 501 // snap-to-lines flag of the text track cue is not set, and the text |
| 479 if (m_linePosition != undefinedPosition) | 502 // track cue line position is negative or greater than 100, then return |
| 503 // 100 and abort these steps. | |
| 504 if (!m_lineIsAuto && !m_snapToLines && isInvalidPercentage(m_linePosition)) | |
| 505 return 100; | |
| 506 | |
| 507 // 2. If the text track cue line position is numeric, return the value of | |
| 508 // the text track cue line position and abort these steps. (Either the | |
| 509 // text track cue snap-to-lines flag is set, so any value, not just | |
| 510 // those in the range 0..100, is valid, or the value is in the range | |
| 511 // 0..100 and is thus valid regardless of the value of that flag.) | |
| 512 if (!m_lineIsAuto) | |
| 480 return m_linePosition; | 513 return m_linePosition; |
| 481 | 514 |
| 482 // If the text track cue snap-to-lines flag of the text track cue is not | 515 // 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; | 516 // set, return the value 100 and abort these steps. (The text track cue |
| 517 // line position is the special value auto.) | |
| 484 if (!m_snapToLines) | 518 if (!m_snapToLines) |
| 485 return 100; | 519 return 100; |
| 486 | 520 |
| 487 // Otherwise, it is the value returned by the following algorithm: | 521 // 4. Let cue be the text track cue. |
| 488 | 522 // 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 | 523 // track is not in the list of text tracks of a media element, return -1 |
| 490 // steps. | 524 // and abort these steps. |
| 491 if (!track()) | 525 if (!track()) |
| 492 return -1; | 526 return -1; |
| 493 | 527 |
| 494 // Let n be the number of text tracks whose text track mode is showing or | 528 // 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 | 529 // 7. Let n be the number of text tracks whose text track mode is showing |
| 496 // tracks before track. | 530 // and that are in the media element's list of text tracks before track. |
| 497 int n = track()->trackIndexRelativeToRenderedTracks(); | 531 int n = track()->trackIndexRelativeToRenderedTracks(); |
| 498 | 532 |
| 499 // Increment n by one. | 533 // 8. Increment n by one. / 9. Negate n. / 10. Return n. |
| 500 n++; | 534 n++; |
| 501 | |
| 502 // Negate n. | |
| 503 n = -n; | 535 n = -n; |
| 504 | |
| 505 return n; | 536 return n; |
| 506 } | 537 } |
| 507 | 538 |
| 508 class VTTTextRunIterator : public TextRunIterator { | 539 class VTTTextRunIterator : public TextRunIterator { |
| 509 public: | 540 public: |
| 510 VTTTextRunIterator() { } | 541 VTTTextRunIterator() { } |
| 511 VTTTextRunIterator(const TextRun* textRun, unsigned offset) : TextRunIterato r(textRun, offset) { } | 542 VTTTextRunIterator(const TextRun* textRun, unsigned offset) : TextRunIterato r(textRun, offset) { } |
| 512 | 543 |
| 513 bool atParagraphSeparator() const | 544 bool atParagraphSeparator() const |
| 514 { | 545 { |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 781 void VTTCue::updateDisplay(const IntSize& videoSize, HTMLDivElement& container) | 812 void VTTCue::updateDisplay(const IntSize& videoSize, HTMLDivElement& container) |
| 782 { | 813 { |
| 783 UseCounter::count(document(), UseCounter::VTTCueRender); | 814 UseCounter::count(document(), UseCounter::VTTCueRender); |
| 784 | 815 |
| 785 if (m_writingDirection != Horizontal) | 816 if (m_writingDirection != Horizontal) |
| 786 UseCounter::count(document(), UseCounter::VTTCueRenderVertical); | 817 UseCounter::count(document(), UseCounter::VTTCueRenderVertical); |
| 787 | 818 |
| 788 if (!m_snapToLines) | 819 if (!m_snapToLines) |
| 789 UseCounter::count(document(), UseCounter::VTTCueRenderSnapToLinesFalse); | 820 UseCounter::count(document(), UseCounter::VTTCueRenderSnapToLinesFalse); |
| 790 | 821 |
| 791 if (m_linePosition != undefinedPosition) | 822 if (!m_lineIsAuto) |
| 792 UseCounter::count(document(), UseCounter::VTTCueRenderLineNotAuto); | 823 UseCounter::count(document(), UseCounter::VTTCueRenderLineNotAuto); |
| 793 | 824 |
| 794 if (m_textPosition != 50) | 825 if (m_textPosition != 50) |
| 795 UseCounter::count(document(), UseCounter::VTTCueRenderPositionNot50); | 826 UseCounter::count(document(), UseCounter::VTTCueRenderPositionNot50); |
| 796 | 827 |
| 797 if (m_cueSize != 100) | 828 if (m_cueSize != 100) |
| 798 UseCounter::count(document(), UseCounter::VTTCueRenderSizeNot100); | 829 UseCounter::count(document(), UseCounter::VTTCueRenderSizeNot100); |
| 799 | 830 |
| 800 if (m_cueAlignment != Middle) | 831 if (m_cueAlignment != Middle) |
| 801 UseCounter::count(document(), UseCounter::VTTCueRenderAlignNotMiddle); | 832 UseCounter::count(document(), UseCounter::VTTCueRenderAlignNotMiddle); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 970 if (linePosition < 0 || linePosition > 100) | 1001 if (linePosition < 0 || linePosition > 100) |
| 971 break; | 1002 break; |
| 972 // 10 - If '%' then set snap-to-lines flag to false. | 1003 // 10 - If '%' then set snap-to-lines flag to false. |
| 973 m_snapToLines = false; | 1004 m_snapToLines = false; |
| 974 } else { | 1005 } else { |
| 975 if (isNegative) | 1006 if (isNegative) |
| 976 linePosition = -linePosition; | 1007 linePosition = -linePosition; |
| 977 m_snapToLines = true; | 1008 m_snapToLines = true; |
| 978 } | 1009 } |
| 979 m_linePosition = linePosition; | 1010 m_linePosition = linePosition; |
| 1011 m_lineIsAuto = false; | |
| 980 break; | 1012 break; |
| 981 } | 1013 } |
| 982 case Position: { | 1014 case Position: { |
| 983 int number; | 1015 int number; |
| 984 // Steps 1 - 6. | 1016 // Steps 1 - 6. |
| 985 if (!scanPercentage(input, valueRun, number)) | 1017 if (!scanPercentage(input, valueRun, number)) |
| 986 break; | 1018 break; |
| 987 | 1019 |
| 988 // 7. Let cue's text track cue text position be number. | 1020 // 7. Let cue's text track cue text position be number. |
| 989 m_textPosition = number; | 1021 m_textPosition = number; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1031 // Make sure the entire run is consumed. | 1063 // Make sure the entire run is consumed. |
| 1032 input.skipRun(valueRun); | 1064 input.skipRun(valueRun); |
| 1033 } | 1065 } |
| 1034 | 1066 |
| 1035 // If cue's line position is not auto or cue's size is not 100 or cue's | 1067 // 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 | 1068 // 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. | 1069 // the empty string, let cue's region identifier be the empty string. |
| 1038 if (m_regionId.isEmpty()) | 1070 if (m_regionId.isEmpty()) |
| 1039 return; | 1071 return; |
| 1040 | 1072 |
| 1041 if (m_linePosition != undefinedPosition || m_cueSize != 100 || m_writingDire ction != Horizontal) | 1073 if (!m_lineIsAuto || m_cueSize != 100 || m_writingDirection != Horizontal) |
| 1042 m_regionId = emptyString(); | 1074 m_regionId = emptyString(); |
| 1043 } | 1075 } |
| 1044 | 1076 |
| 1045 CSSValueID VTTCue::getCSSAlignment() const | 1077 CSSValueID VTTCue::getCSSAlignment() const |
| 1046 { | 1078 { |
| 1047 return displayAlignmentMap[m_cueAlignment]; | 1079 return displayAlignmentMap[m_cueAlignment]; |
| 1048 } | 1080 } |
| 1049 | 1081 |
| 1050 CSSValueID VTTCue::getCSSWritingDirection() const | 1082 CSSValueID VTTCue::getCSSWritingDirection() const |
| 1051 { | 1083 { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1085 | 1117 |
| 1086 void VTTCue::trace(Visitor* visitor) | 1118 void VTTCue::trace(Visitor* visitor) |
| 1087 { | 1119 { |
| 1088 visitor->trace(m_vttNodeTree); | 1120 visitor->trace(m_vttNodeTree); |
| 1089 visitor->trace(m_cueBackgroundBox); | 1121 visitor->trace(m_cueBackgroundBox); |
| 1090 visitor->trace(m_displayTree); | 1122 visitor->trace(m_displayTree); |
| 1091 TextTrackCue::trace(visitor); | 1123 TextTrackCue::trace(visitor); |
| 1092 } | 1124 } |
| 1093 | 1125 |
| 1094 } // namespace blink | 1126 } // namespace blink |
| OLD | NEW |