Chromium Code Reviews| 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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 DEFINE_STATIC_LOCAL(const String, middle, ("middle")); | 66 DEFINE_STATIC_LOCAL(const String, middle, ("middle")); |
| 67 return middle; | 67 return middle; |
| 68 } | 68 } |
| 69 | 69 |
| 70 static const String& endKeyword() | 70 static const String& endKeyword() |
| 71 { | 71 { |
| 72 DEFINE_STATIC_LOCAL(const String, end, ("end")); | 72 DEFINE_STATIC_LOCAL(const String, end, ("end")); |
| 73 return end; | 73 return end; |
| 74 } | 74 } |
| 75 | 75 |
| 76 static const String& leftKeyword() | |
| 77 { | |
| 78 DEFINE_STATIC_LOCAL(const String, left, ("left")); | |
| 79 return left; | |
| 80 } | |
| 81 | |
| 82 static const String& rightKeyword() | |
| 83 { | |
| 84 DEFINE_STATIC_LOCAL(const String, right, ("right")); | |
| 85 return right; | |
| 86 } | |
| 87 | |
| 76 static const String& horizontalKeyword() | 88 static const String& horizontalKeyword() |
| 77 { | 89 { |
| 78 return emptyString(); | 90 return emptyString(); |
| 79 } | 91 } |
| 80 | 92 |
| 81 static const String& verticalGrowingLeftKeyword() | 93 static const String& verticalGrowingLeftKeyword() |
| 82 { | 94 { |
| 83 DEFINE_STATIC_LOCAL(const String, verticalrl, ("rl")); | 95 DEFINE_STATIC_LOCAL(const String, verticalrl, ("rl")); |
| 84 return verticalrl; | 96 return verticalrl; |
| 85 } | 97 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 142 setInlineStyleProperty(CSSPropertyHeight, CSSValueAuto); | 154 setInlineStyleProperty(CSSPropertyHeight, CSSValueAuto); |
| 143 } else { | 155 } else { |
| 144 setInlineStyleProperty(CSSPropertyWidth, CSSValueAuto); | 156 setInlineStyleProperty(CSSPropertyWidth, CSSValueAuto); |
| 145 setInlineStyleProperty(CSSPropertyHeight, static_cast<double>(m_cue->get CSSSize()), CSSPrimitiveValue::CSS_PERCENTAGE); | 157 setInlineStyleProperty(CSSPropertyHeight, static_cast<double>(m_cue->get CSSSize()), CSSPrimitiveValue::CSS_PERCENTAGE); |
| 146 } | 158 } |
| 147 | 159 |
| 148 // The 'text-align' property on the (root) List of WebVTT Node Objects must | 160 // The 'text-align' property on the (root) List of WebVTT Node Objects must |
| 149 // be set to the value in the second cell of the row of the table below | 161 // be set to the value in the second cell of the row of the table below |
| 150 // whose first cell is the value of the corresponding cue's text track cue | 162 // whose first cell is the value of the corresponding cue's text track cue |
| 151 // alignment: | 163 // alignment: |
| 152 if (m_cue->align() == startKeyword()) | 164 setInlineStyleProperty(CSSPropertyTextAlign, m_cue->getCSSAlignment()); |
| 153 setInlineStyleProperty(CSSPropertyTextAlign, CSSValueStart); | |
| 154 else if (m_cue->align() == endKeyword()) | |
| 155 setInlineStyleProperty(CSSPropertyTextAlign, CSSValueEnd); | |
| 156 else | |
| 157 setInlineStyleProperty(CSSPropertyTextAlign, CSSValueCenter); | |
| 158 | 165 |
| 159 if (!m_cue->snapToLines()) { | 166 if (!m_cue->snapToLines()) { |
| 160 // 10.13.1 Set up x and y: | 167 // 10.13.1 Set up x and y: |
| 161 // Note: x and y are set through the CSS left and top above. | 168 // Note: x and y are set through the CSS left and top above. |
| 162 | 169 |
| 163 // 10.13.2 Position the boxes in boxes such that the point x% along the | 170 // 10.13.2 Position the boxes in boxes such that the point x% along the |
| 164 // width of the bounding box of the boxes in boxes is x% of the way | 171 // width of the bounding box of the boxes in boxes is x% of the way |
| 165 // across the width of the video's rendering area, and the point y% | 172 // across the width of the video's rendering area, and the point y% |
| 166 // along the height of the bounding box of the boxes in boxes is y% | 173 // along the height of the bounding box of the boxes in boxes is y% |
| 167 // of the way across the height of the video's rendering area, while | 174 // of the way across the height of the video's rendering area, while |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 ScriptWrappable::init(this); | 219 ScriptWrappable::init(this); |
| 213 | 220 |
| 214 // 4. If the text track cue writing direction is horizontal, then let | 221 // 4. If the text track cue writing direction is horizontal, then let |
| 215 // writing-mode be 'horizontal-tb'. Otherwise, if the text track cue writing | 222 // writing-mode be 'horizontal-tb'. Otherwise, if the text track cue writing |
| 216 // direction is vertical growing left, then let writing-mode be | 223 // direction is vertical growing left, then let writing-mode be |
| 217 // 'vertical-rl'. Otherwise, the text track cue writing direction is | 224 // 'vertical-rl'. Otherwise, the text track cue writing direction is |
| 218 // vertical growing right; let writing-mode be 'vertical-lr'. | 225 // vertical growing right; let writing-mode be 'vertical-lr'. |
| 219 m_displayWritingModeMap[Horizontal] = CSSValueHorizontalTb; | 226 m_displayWritingModeMap[Horizontal] = CSSValueHorizontalTb; |
| 220 m_displayWritingModeMap[VerticalGrowingLeft] = CSSValueVerticalRl; | 227 m_displayWritingModeMap[VerticalGrowingLeft] = CSSValueVerticalRl; |
| 221 m_displayWritingModeMap[VerticalGrowingRight] = CSSValueVerticalLr; | 228 m_displayWritingModeMap[VerticalGrowingRight] = CSSValueVerticalLr; |
| 229 | |
| 230 m_displayAlignmentMap[Start] = CSSValueStart; | |
| 231 m_displayAlignmentMap[Middle] = CSSValueCenter; | |
| 232 m_displayAlignmentMap[End] = CSSValueEnd; | |
| 233 m_displayAlignmentMap[Left] = CSSValueLeft; | |
| 234 m_displayAlignmentMap[Right] = CSSValueRight; | |
| 222 } | 235 } |
| 223 | 236 |
| 224 TextTrackCue::~TextTrackCue() | 237 TextTrackCue::~TextTrackCue() |
| 225 { | 238 { |
| 226 displayTreeInternal()->remove(ASSERT_NO_EXCEPTION); | 239 displayTreeInternal()->remove(ASSERT_NO_EXCEPTION); |
| 227 } | 240 } |
| 228 | 241 |
| 229 PassRefPtr<TextTrackCueBox> TextTrackCue::createDisplayTree() | 242 PassRefPtr<TextTrackCueBox> TextTrackCue::createDisplayTree() |
| 230 { | 243 { |
| 231 ASSERT(ownerDocument()); | 244 ASSERT(ownerDocument()); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 428 | 441 |
| 429 const String& TextTrackCue::align() const | 442 const String& TextTrackCue::align() const |
| 430 { | 443 { |
| 431 switch (m_cueAlignment) { | 444 switch (m_cueAlignment) { |
| 432 case Start: | 445 case Start: |
| 433 return startKeyword(); | 446 return startKeyword(); |
| 434 case Middle: | 447 case Middle: |
| 435 return middleKeyword(); | 448 return middleKeyword(); |
| 436 case End: | 449 case End: |
| 437 return endKeyword(); | 450 return endKeyword(); |
| 451 case Left: | |
| 452 return leftKeyword(); | |
| 453 case Right: | |
| 454 return rightKeyword(); | |
| 438 default: | 455 default: |
| 439 ASSERT_NOT_REACHED(); | 456 ASSERT_NOT_REACHED(); |
| 440 return emptyString(); | 457 return emptyString(); |
| 441 } | 458 } |
| 442 } | 459 } |
| 443 | 460 |
| 444 void TextTrackCue::setAlign(const String& value, ExceptionState& es) | 461 void TextTrackCue::setAlign(const String& value, ExceptionState& es) |
| 445 { | 462 { |
| 446 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele ment.html#dom-texttrackcue-align | 463 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele ment.html#dom-texttrackcue-align |
| 447 // On setting, the text track cue alignment must be set to the value given i n the | 464 // On setting, the text track cue alignment must be set to the value given i n the |
| 448 // first cell of the row in the table above whose second cell is a case-sens itive | 465 // first cell of the row in the table above whose second cell is a case-sens itive |
| 449 // match for the new value, if any. If none of the values match, then the us er | 466 // match for the new value, if any. If none of the values match, then the us er |
| 450 // agent must instead throw a SyntaxError exception. | 467 // agent must instead throw a SyntaxError exception. |
| 451 | 468 |
| 452 CueAlignment alignment = m_cueAlignment; | 469 CueAlignment alignment = m_cueAlignment; |
| 453 if (value == startKeyword()) | 470 if (value == startKeyword()) |
| 454 alignment = Start; | 471 alignment = Start; |
| 455 else if (value == middleKeyword()) | 472 else if (value == middleKeyword()) |
| 456 alignment = Middle; | 473 alignment = Middle; |
| 457 else if (value == endKeyword()) | 474 else if (value == endKeyword()) |
| 458 alignment = End; | 475 alignment = End; |
| 476 else if (value == leftKeyword()) | |
| 477 alignment = Left; | |
| 478 else if (value == rightKeyword()) | |
| 479 alignment = Right; | |
| 459 else | 480 else |
| 460 es.throwUninformativeAndGenericDOMException(SyntaxError); | 481 es.throwUninformativeAndGenericDOMException(SyntaxError); |
| 461 | 482 |
| 462 if (alignment == m_cueAlignment) | 483 if (alignment == m_cueAlignment) |
| 463 return; | 484 return; |
| 464 | 485 |
| 465 cueWillChange(); | 486 cueWillChange(); |
| 466 m_cueAlignment = alignment; | 487 m_cueAlignment = alignment; |
| 467 cueDidChange(); | 488 cueDidChange(); |
| 468 } | 489 } |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 658 // vertical growing left, then let block-flow be 'lr'. Otherwise, the text | 679 // vertical growing left, then let block-flow be 'lr'. Otherwise, the text |
| 659 // track cue writing direction is vertical growing right; let block-flow be | 680 // track cue writing direction is vertical growing right; let block-flow be |
| 660 // 'rl'. | 681 // 'rl'. |
| 661 m_displayWritingMode = m_displayWritingModeMap[m_writingDirection]; | 682 m_displayWritingMode = m_displayWritingModeMap[m_writingDirection]; |
| 662 | 683 |
| 663 // 10.5 Determine the value of maximum size for cue as per the appropriate | 684 // 10.5 Determine the value of maximum size for cue as per the appropriate |
| 664 // rules from the following list: | 685 // rules from the following list: |
| 665 int maximumSize = m_textPosition; | 686 int maximumSize = m_textPosition; |
| 666 if ((m_writingDirection == Horizontal && m_cueAlignment == Start && m_displa yDirection == CSSValueLtr) | 687 if ((m_writingDirection == Horizontal && m_cueAlignment == Start && m_displa yDirection == CSSValueLtr) |
| 667 || (m_writingDirection == Horizontal && m_cueAlignment == End && m_d isplayDirection == CSSValueRtl) | 688 || (m_writingDirection == Horizontal && m_cueAlignment == End && m_d isplayDirection == CSSValueRtl) |
| 668 || (m_writingDirection == VerticalGrowingLeft && m_cueAlignment == S tart) | 689 || (m_writingDirection == Horizontal && m_cueAlignment == Left) |
| 669 || (m_writingDirection == VerticalGrowingRight && m_cueAlignment == Start)) { | 690 || (m_writingDirection == VerticalGrowingLeft && (m_cueAlignment == Start || m_cueAlignment == Left)) |
| 691 || (m_writingDirection == VerticalGrowingRight && (m_cueAlignment == Start || m_cueAlignment == Left))) { | |
| 670 maximumSize = 100 - m_textPosition; | 692 maximumSize = 100 - m_textPosition; |
| 671 } else if ((m_writingDirection == Horizontal && m_cueAlignment == End && m_d isplayDirection == CSSValueLtr) | 693 } else if ((m_writingDirection == Horizontal && m_cueAlignment == End && m_d isplayDirection == CSSValueLtr) |
| 672 || (m_writingDirection == Horizontal && m_cueAlignment == Start && m _displayDirection == CSSValueRtl) | 694 || (m_writingDirection == Horizontal && m_cueAlignment == Start && m _displayDirection == CSSValueRtl) |
| 673 || (m_writingDirection == VerticalGrowingLeft && m_cueAlignment == E nd) | 695 || (m_writingDirection == Horizontal && m_cueAlignment == Right) |
| 674 || (m_writingDirection == VerticalGrowingRight && m_cueAlignment == End)) { | 696 || (m_writingDirection == VerticalGrowingLeft && (m_cueAlignment == End || m_cueAlignment == Right)) |
| 697 || (m_writingDirection == VerticalGrowingRight && (m_cueAlignment == End || m_cueAlignment == Right))) { | |
| 675 maximumSize = m_textPosition; | 698 maximumSize = m_textPosition; |
| 676 } else if (m_cueAlignment == Middle) { | 699 } else if (m_cueAlignment == Middle) { |
| 677 maximumSize = m_textPosition <= 50 ? m_textPosition : (100 - m_textPosit ion); | 700 maximumSize = m_textPosition <= 50 ? m_textPosition : (100 - m_textPosit ion); |
| 678 maximumSize = maximumSize * 2; | 701 maximumSize = maximumSize * 2; |
| 702 } else { | |
| 703 ASSERT_NOT_REACHED(); | |
| 679 } | 704 } |
| 680 | 705 |
| 681 // 10.6 If the text track cue size is less than maximum size, then let size | 706 // 10.6 If the text track cue size is less than maximum size, then let size |
| 682 // be text track cue size. Otherwise, let size be maximum size. | 707 // be text track cue size. Otherwise, let size be maximum size. |
| 683 m_displaySize = std::min(m_cueSize, maximumSize); | 708 m_displaySize = std::min(m_cueSize, maximumSize); |
| 684 | 709 |
| 685 // 10.8 Determine the value of x-position or y-position for cue as per the | 710 // 10.8 Determine the value of x-position or y-position for cue as per the |
| 686 // appropriate rules from the following list: | 711 // appropriate rules from the following list: |
| 687 if (m_writingDirection == Horizontal) { | 712 if (m_writingDirection == Horizontal) { |
| 688 if (m_cueAlignment == Start) { | 713 switch (m_cueAlignment) { |
| 714 case Start: | |
| 689 if (m_displayDirection == CSSValueLtr) | 715 if (m_displayDirection == CSSValueLtr) |
| 690 m_displayPosition.first = m_textPosition; | 716 m_displayPosition.first = m_textPosition; |
| 691 else | 717 else |
| 692 m_displayPosition.first = 100 - m_textPosition - m_displaySize; | 718 m_displayPosition.first = 100 - m_textPosition - m_displaySize; |
| 693 } else if (m_cueAlignment == End) { | 719 break; |
| 720 case End: | |
| 694 if (m_displayDirection == CSSValueRtl) | 721 if (m_displayDirection == CSSValueRtl) |
| 695 m_displayPosition.first = 100 - m_textPosition; | 722 m_displayPosition.first = 100 - m_textPosition; |
| 696 else | 723 else |
| 697 m_displayPosition.first = m_textPosition - m_displaySize; | 724 m_displayPosition.first = m_textPosition - m_displaySize; |
| 725 break; | |
| 726 case Left: | |
| 727 if (m_displayDirection == CSSValueLtr) | |
| 728 m_displayPosition.first = m_textPosition; | |
| 729 else | |
| 730 m_displayPosition.first = 100 - m_textPosition; | |
| 731 break; | |
| 732 case Right: | |
| 733 if (m_displayDirection == CSSValueLtr) | |
| 734 m_displayPosition.first = m_textPosition - m_displaySize; | |
| 735 else | |
| 736 m_displayPosition.first = 100 - m_textPosition - m_displaySize; | |
| 737 break; | |
| 738 case Middle: | |
| 739 if (m_displayDirection == CSSValueLtr) | |
| 740 m_displayPosition.first = m_textPosition - m_displaySize / 2; | |
| 741 else | |
| 742 m_displayPosition.first = 100 - m_textPosition - m_displaySize / 2; | |
| 743 break; | |
| 744 default: | |
|
acolwell GONE FROM CHROMIUM
2013/10/04 17:26:41
nit: You only need default here because of NumberO
philipj_slow
2013/10/07 08:52:32
Isn't it a good idea to catch the case where someo
vcarbune.chromium
2013/10/07 09:37:28
Done.
vcarbune.chromium
2013/10/07 09:37:28
I feel that the current version of the code guards
acolwell GONE FROM CHROMIUM
2013/10/07 15:32:19
We typically guard against this at the assignment
philipj_slow
2013/10/08 06:56:54
Sounds reasonable, I'll keep that in mind when wri
| |
| 745 ASSERT_NOT_REACHED(); | |
| 746 } | |
| 747 } else { | |
| 748 // Cases for m_writingDirection being VerticalGrowing{Left|Right} | |
| 749 switch (m_cueAlignment) { | |
| 750 case Start: | |
| 751 case Left: | |
| 752 m_displayPosition.second = m_textPosition; | |
| 753 break; | |
| 754 case End: | |
| 755 case Right: | |
| 756 m_displayPosition.second = m_textPosition - m_displaySize; | |
| 757 break; | |
| 758 case Middle: | |
| 759 m_displayPosition.second = m_textPosition - m_displaySize / 2; | |
| 760 break; | |
| 761 default: | |
| 762 ASSERT_NOT_REACHED(); | |
| 698 } | 763 } |
| 699 } | 764 } |
| 700 | 765 |
| 701 if ((m_writingDirection == VerticalGrowingLeft && m_cueAlignment == Start) | 766 // A text track cue has a text track cue computed line position whose value |
| 702 || (m_writingDirection == VerticalGrowingRight && m_cueAlignment == Start)) { | 767 // is defined in terms of the other aspects of the cue. |
| 703 m_displayPosition.second = m_textPosition; | 768 m_computedLinePosition = calculateComputedLinePosition(); |
| 704 } else if ((m_writingDirection == VerticalGrowingLeft && m_cueAlignment == E nd) | |
| 705 || (m_writingDirection == VerticalGrowingRight && m_cueAlignment == End)) { | |
| 706 m_displayPosition.second = 100 - m_textPosition; | |
| 707 } | |
| 708 | |
| 709 if (m_writingDirection == Horizontal && m_cueAlignment == Middle) { | |
| 710 if (m_displayDirection == CSSValueLtr) | |
| 711 m_displayPosition.first = m_textPosition - m_displaySize / 2; | |
| 712 else | |
| 713 m_displayPosition.first = 100 - m_textPosition - m_displaySize / 2; | |
| 714 } | |
| 715 | |
| 716 if ((m_writingDirection == VerticalGrowingLeft && m_cueAlignment == Middle) | |
| 717 || (m_writingDirection == VerticalGrowingRight && m_cueAlignment == Midd le)) | |
| 718 m_displayPosition.second = m_textPosition - m_displaySize / 2; | |
| 719 | 769 |
| 720 // 10.9 Determine the value of whichever of x-position or y-position is not | 770 // 10.9 Determine the value of whichever of x-position or y-position is not |
| 721 // yet calculated for cue as per the appropriate rules from the following | 771 // yet calculated for cue as per the appropriate rules from the following |
| 722 // list: | 772 // list: |
| 723 if (m_snapToLines && m_displayPosition.second == undefinedPosition && m_writ ingDirection == Horizontal) | 773 if (m_snapToLines && m_displayPosition.second == undefinedPosition && m_writ ingDirection == Horizontal) |
| 724 m_displayPosition.second = 0; | 774 m_displayPosition.second = 0; |
| 725 | 775 |
| 726 if (!m_snapToLines && m_displayPosition.second == undefinedPosition && m_wri tingDirection == Horizontal) | 776 if (!m_snapToLines && m_displayPosition.second == undefinedPosition && m_wri tingDirection == Horizontal) |
| 727 m_displayPosition.second = m_computedLinePosition; | 777 m_displayPosition.second = m_computedLinePosition; |
| 728 | 778 |
| 729 if (m_snapToLines && m_displayPosition.first == undefinedPosition | 779 if (m_snapToLines && m_displayPosition.first == undefinedPosition |
| 730 && (m_writingDirection == VerticalGrowingLeft || m_writingDirection == VerticalGrowingRight)) | 780 && (m_writingDirection == VerticalGrowingLeft || m_writingDirection == VerticalGrowingRight)) |
| 731 m_displayPosition.first = 0; | 781 m_displayPosition.first = 0; |
| 732 | 782 |
| 733 if (!m_snapToLines && (m_writingDirection == VerticalGrowingLeft || m_writin gDirection == VerticalGrowingRight)) | 783 if (!m_snapToLines && (m_writingDirection == VerticalGrowingLeft || m_writin gDirection == VerticalGrowingRight)) |
| 734 m_displayPosition.first = m_computedLinePosition; | 784 m_displayPosition.first = m_computedLinePosition; |
| 735 | |
| 736 // A text track cue has a text track cue computed line position whose value | |
| 737 // is defined in terms of the other aspects of the cue. | |
| 738 m_computedLinePosition = calculateComputedLinePosition(); | |
| 739 } | 785 } |
| 740 | 786 |
| 741 void TextTrackCue::markFutureAndPastNodes(ContainerNode* root, double previousTi mestamp, double movieTime) | 787 void TextTrackCue::markFutureAndPastNodes(ContainerNode* root, double previousTi mestamp, double movieTime) |
| 742 { | 788 { |
| 743 DEFINE_STATIC_LOCAL(const String, timestampTag, ("timestamp")); | 789 DEFINE_STATIC_LOCAL(const String, timestampTag, ("timestamp")); |
| 744 | 790 |
| 745 bool isPastNode = true; | 791 bool isPastNode = true; |
| 746 double currentTimestamp = previousTimestamp; | 792 double currentTimestamp = previousTimestamp; |
| 747 if (currentTimestamp > movieTime) | 793 if (currentTimestamp > movieTime) |
| 748 isPastNode = false; | 794 isPastNode = false; |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1087 if (cueAlignment == startKeyword()) | 1133 if (cueAlignment == startKeyword()) |
| 1088 m_cueAlignment = Start; | 1134 m_cueAlignment = Start; |
| 1089 | 1135 |
| 1090 // 2. If value is a case-sensitive match for the string "middle", th en let cue's text track cue alignment be middle alignment. | 1136 // 2. If value is a case-sensitive match for the string "middle", th en let cue's text track cue alignment be middle alignment. |
| 1091 else if (cueAlignment == middleKeyword()) | 1137 else if (cueAlignment == middleKeyword()) |
| 1092 m_cueAlignment = Middle; | 1138 m_cueAlignment = Middle; |
| 1093 | 1139 |
| 1094 // 3. If value is a case-sensitive match for the string "end", then let cue's text track cue alignment be end alignment. | 1140 // 3. If value is a case-sensitive match for the string "end", then let cue's text track cue alignment be end alignment. |
| 1095 else if (cueAlignment == endKeyword()) | 1141 else if (cueAlignment == endKeyword()) |
| 1096 m_cueAlignment = End; | 1142 m_cueAlignment = End; |
| 1143 | |
| 1144 // 4. If value is a case-sensitive match for the string "left", then let cue's text track cue alignment be left alignment. | |
| 1145 else if (cueAlignment == leftKeyword()) | |
| 1146 m_cueAlignment = Left; | |
| 1147 | |
| 1148 // 5. If value is a case-sensitive match for the string "right", the n let cue's text track cue alignment be right alignment. | |
| 1149 else if (cueAlignment == rightKeyword()) | |
| 1150 m_cueAlignment = Right; | |
| 1097 } | 1151 } |
| 1098 break; | 1152 break; |
| 1099 #if ENABLE(WEBVTT_REGIONS) | 1153 #if ENABLE(WEBVTT_REGIONS) |
| 1100 case RegionId: | 1154 case RegionId: |
| 1101 m_regionId = WebVTTParser::collectWord(input, &position); | 1155 m_regionId = WebVTTParser::collectWord(input, &position); |
| 1102 break; | 1156 break; |
| 1103 #endif | 1157 #endif |
| 1104 case None: | 1158 case None: |
| 1105 break; | 1159 break; |
| 1106 } | 1160 } |
| 1107 | 1161 |
| 1108 NextSetting: | 1162 NextSetting: |
| 1109 position = endOfSetting; | 1163 position = endOfSetting; |
| 1110 } | 1164 } |
| 1111 #if ENABLE(WEBVTT_REGIONS) | 1165 #if ENABLE(WEBVTT_REGIONS) |
| 1112 // If cue's line position is not auto or cue's size is not 100 or cue's | 1166 // If cue's line position is not auto or cue's size is not 100 or cue's |
| 1113 // writing direction is not horizontal, but cue's region identifier is not | 1167 // writing direction is not horizontal, but cue's region identifier is not |
| 1114 // the empty string, let cue's region identifier be the empty string. | 1168 // the empty string, let cue's region identifier be the empty string. |
| 1115 if (m_regionId.isEmpty()) | 1169 if (m_regionId.isEmpty()) |
| 1116 return; | 1170 return; |
| 1117 | 1171 |
| 1118 if (m_linePosition != undefinedPosition || m_cueSize != 100 || m_writingDire ction != Horizontal) | 1172 if (m_linePosition != undefinedPosition || m_cueSize != 100 || m_writingDire ction != Horizontal) |
| 1119 m_regionId = emptyString(); | 1173 m_regionId = emptyString(); |
| 1120 #endif | 1174 #endif |
| 1121 } | 1175 } |
| 1122 | 1176 |
| 1177 CSSValueID TextTrackCue::getCSSAlignment() const | |
| 1178 { | |
| 1179 return m_displayAlignmentMap[m_cueAlignment]; | |
| 1180 } | |
| 1181 | |
| 1123 CSSValueID TextTrackCue::getCSSWritingDirection() const | 1182 CSSValueID TextTrackCue::getCSSWritingDirection() const |
| 1124 { | 1183 { |
| 1125 return m_displayDirection; | 1184 return m_displayDirection; |
| 1126 } | 1185 } |
| 1127 | 1186 |
| 1128 CSSValueID TextTrackCue::getCSSWritingMode() const | 1187 CSSValueID TextTrackCue::getCSSWritingMode() const |
| 1129 { | 1188 { |
| 1130 return m_displayWritingMode; | 1189 return m_displayWritingMode; |
| 1131 } | 1190 } |
| 1132 | 1191 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1184 return false; | 1243 return false; |
| 1185 if (m_cueSize != cue.size()) | 1244 if (m_cueSize != cue.size()) |
| 1186 return false; | 1245 return false; |
| 1187 if (align() != cue.align()) | 1246 if (align() != cue.align()) |
| 1188 return false; | 1247 return false; |
| 1189 | 1248 |
| 1190 return true; | 1249 return true; |
| 1191 } | 1250 } |
| 1192 | 1251 |
| 1193 } // namespace WebCore | 1252 } // namespace WebCore |
| OLD | NEW |