| Index: Source/core/html/track/TextTrackCue.cpp
|
| diff --git a/Source/core/html/track/TextTrackCue.cpp b/Source/core/html/track/TextTrackCue.cpp
|
| index 0c1a1b3753d39c78f44fa77ec55e1c0b2c78bd26..2798f80fa8ce6afbf940bc24f3f0974f27115327 100644
|
| --- a/Source/core/html/track/TextTrackCue.cpp
|
| +++ b/Source/core/html/track/TextTrackCue.cpp
|
| @@ -277,16 +277,16 @@ void TextTrackCue::setStartTime(double value, ExceptionCode& ec)
|
| ec = TypeError;
|
| return;
|
| }
|
| -
|
| +
|
| // TODO(93143): Add spec-compliant behavior for negative time values.
|
| if (m_startTime == value || value < 0)
|
| return;
|
| -
|
| +
|
| cueWillChange();
|
| m_startTime = value;
|
| cueDidChange();
|
| }
|
| -
|
| +
|
| void TextTrackCue::setEndTime(double value, ExceptionCode& ec)
|
| {
|
| // NaN, Infinity and -Infinity values should trigger a TypeError.
|
| @@ -298,17 +298,17 @@ void TextTrackCue::setEndTime(double value, ExceptionCode& ec)
|
| // TODO(93143): Add spec-compliant behavior for negative time values.
|
| if (m_endTime == value || value < 0)
|
| return;
|
| -
|
| +
|
| cueWillChange();
|
| m_endTime = value;
|
| cueDidChange();
|
| }
|
| -
|
| +
|
| void TextTrackCue::setPauseOnExit(bool value)
|
| {
|
| if (m_pauseOnExit == value)
|
| return;
|
| -
|
| +
|
| cueWillChange();
|
| m_pauseOnExit = value;
|
| cueDidChange();
|
| @@ -317,7 +317,7 @@ void TextTrackCue::setPauseOnExit(bool value)
|
| const String& TextTrackCue::vertical() const
|
| {
|
| switch (m_writingDirection) {
|
| - case Horizontal:
|
| + case Horizontal:
|
| return horizontalKeyword();
|
| case VerticalGrowingLeft:
|
| return verticalGrowingLeftKeyword();
|
| @@ -332,11 +332,11 @@ const String& TextTrackCue::vertical() const
|
| void TextTrackCue::setVertical(const String& value, ExceptionCode& ec)
|
| {
|
| // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-vertical
|
| - // On setting, the text track cue writing direction must be set to the value given
|
| - // in the first cell of the row in the table above whose second cell is a
|
| + // On setting, the text track cue writing direction must be set to the value given
|
| + // in the first cell of the row in the table above whose second cell is a
|
| // case-sensitive match for the new value, if any. If none of the values match, then
|
| // the user agent must instead throw a SyntaxError exception.
|
| -
|
| +
|
| WritingDirection direction = m_writingDirection;
|
| if (value == horizontalKeyword())
|
| direction = Horizontal;
|
| @@ -346,7 +346,7 @@ void TextTrackCue::setVertical(const String& value, ExceptionCode& ec)
|
| direction = VerticalGrowingRight;
|
| else
|
| ec = SyntaxError;
|
| -
|
| +
|
| if (direction == m_writingDirection)
|
| return;
|
|
|
| @@ -359,7 +359,7 @@ void TextTrackCue::setSnapToLines(bool value)
|
| {
|
| if (m_snapToLines == value)
|
| return;
|
| -
|
| +
|
| cueWillChange();
|
| m_snapToLines = value;
|
| cueDidChange();
|
| @@ -394,11 +394,11 @@ void TextTrackCue::setPosition(int position, ExceptionCode& ec)
|
| ec = IndexSizeError;
|
| return;
|
| }
|
| -
|
| +
|
| // Otherwise, set the text track cue line position to the new value.
|
| if (m_textPosition == position)
|
| return;
|
| -
|
| +
|
| cueWillChange();
|
| m_textPosition = position;
|
| cueDidChange();
|
| @@ -413,11 +413,11 @@ void TextTrackCue::setSize(int size, ExceptionCode& ec)
|
| ec = IndexSizeError;
|
| return;
|
| }
|
| -
|
| +
|
| // Otherwise, set the text track cue line position to the new value.
|
| if (m_cueSize == size)
|
| return;
|
| -
|
| +
|
| cueWillChange();
|
| m_cueSize = size;
|
| cueDidChange();
|
| @@ -441,11 +441,11 @@ const String& TextTrackCue::align() const
|
| void TextTrackCue::setAlign(const String& value, ExceptionCode& ec)
|
| {
|
| // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-align
|
| - // On setting, the text track cue alignment must be set to the value given in the
|
| + // On setting, the text track cue alignment must be set to the value given in the
|
| // first cell of the row in the table above whose second cell is a case-sensitive
|
| // match for the new value, if any. If none of the values match, then the user
|
| // agent must instead throw a SyntaxError exception.
|
| -
|
| +
|
| CueAlignment alignment = m_cueAlignment;
|
| if (value == startKeyword())
|
| alignment = Start;
|
| @@ -455,7 +455,7 @@ void TextTrackCue::setAlign(const String& value, ExceptionCode& ec)
|
| alignment = End;
|
| else
|
| ec = SyntaxError;
|
| -
|
| +
|
| if (alignment == m_cueAlignment)
|
| return;
|
|
|
| @@ -463,12 +463,12 @@ void TextTrackCue::setAlign(const String& value, ExceptionCode& ec)
|
| m_cueAlignment = alignment;
|
| cueDidChange();
|
| }
|
| -
|
| +
|
| void TextTrackCue::setText(const String& text)
|
| {
|
| if (m_content == text)
|
| return;
|
| -
|
| +
|
| cueWillChange();
|
| // Clear the document fragment but don't bother to create it again just yet as we can do that
|
| // when it is requested.
|
| @@ -734,27 +734,27 @@ void TextTrackCue::calculateDisplayParameters()
|
| // is defined in terms of the other aspects of the cue.
|
| m_computedLinePosition = calculateComputedLinePosition();
|
| }
|
| -
|
| +
|
| void TextTrackCue::markFutureAndPastNodes(ContainerNode* root, double previousTimestamp, double movieTime)
|
| {
|
| DEFINE_STATIC_LOCAL(const String, timestampTag, (ASCIILiteral("timestamp")));
|
| -
|
| +
|
| bool isPastNode = true;
|
| double currentTimestamp = previousTimestamp;
|
| if (currentTimestamp > movieTime)
|
| isPastNode = false;
|
| -
|
| +
|
| for (Node* child = root->firstChild(); child; child = NodeTraversal::next(child, root)) {
|
| if (child->nodeName() == timestampTag) {
|
| unsigned position = 0;
|
| String timestamp = child->nodeValue();
|
| double currentTimestamp = WebVTTParser::create(0, m_scriptExecutionContext)->collectTimeStamp(timestamp, &position);
|
| ASSERT(currentTimestamp != -1);
|
| -
|
| +
|
| if (currentTimestamp > movieTime)
|
| isPastNode = false;
|
| }
|
| -
|
| +
|
| if (child->isWebVTTElement()) {
|
| toWebVTTElement(child)->setIsPastNode(isPastNode);
|
| // Make an elemenet id match a cue id for style matching purposes.
|
| @@ -911,18 +911,18 @@ void TextTrackCue::setCueSettings(const String& input)
|
|
|
| while (position < input.length()) {
|
|
|
| - // The WebVTT cue settings part of a WebVTT cue consists of zero or more of the following components, in any order,
|
| - // separated from each other by one or more U+0020 SPACE characters or U+0009 CHARACTER TABULATION (tab) characters.
|
| + // The WebVTT cue settings part of a WebVTT cue consists of zero or more of the following components, in any order,
|
| + // separated from each other by one or more U+0020 SPACE characters or U+0009 CHARACTER TABULATION (tab) characters.
|
| while (position < input.length() && WebVTTParser::isValidSettingDelimiter(input[position]))
|
| position++;
|
| if (position >= input.length())
|
| break;
|
|
|
| - // When the user agent is to parse the WebVTT settings given by a string input for a text track cue cue,
|
| + // When the user agent is to parse the WebVTT settings given by a string input for a text track cue cue,
|
| // the user agent must run the following steps:
|
| // 1. Let settings be the result of splitting input on spaces.
|
| // 2. For each token setting in the list settings, run the following substeps:
|
| - // 1. If setting does not contain a U+003A COLON character (:), or if the first U+003A COLON character (:)
|
| + // 1. If setting does not contain a U+003A COLON character (:), or if the first U+003A COLON character (:)
|
| // in setting is either the first or last character of setting, then jump to the step labeled next setting.
|
| unsigned endOfSetting = position;
|
| String setting = WebVTTParser::collectWord(input, &endOfSetting);
|
| @@ -944,13 +944,13 @@ void TextTrackCue::setCueSettings(const String& input)
|
| case Vertical:
|
| {
|
| // If name is a case-sensitive match for "vertical"
|
| - // 1. If value is a case-sensitive match for the string "rl", then let cue's text track cue writing direction
|
| + // 1. If value is a case-sensitive match for the string "rl", then let cue's text track cue writing direction
|
| // be vertical growing left.
|
| String writingDirection = WebVTTParser::collectWord(input, &position);
|
| if (writingDirection == verticalGrowingLeftKeyword())
|
| m_writingDirection = VerticalGrowingLeft;
|
| -
|
| - // 2. Otherwise, if value is a case-sensitive match for the string "lr", then let cue's text track cue writing
|
| +
|
| + // 2. Otherwise, if value is a case-sensitive match for the string "lr", then let cue's text track cue writing
|
| // direction be vertical growing right.
|
| else if (writingDirection == verticalGrowingRightKeyword())
|
| m_writingDirection = VerticalGrowingRight;
|
| @@ -959,7 +959,7 @@ void TextTrackCue::setCueSettings(const String& input)
|
| case Line:
|
| {
|
| // 1-2 - Collect chars that are either '-', '%', or a digit.
|
| - // 1. If value contains any characters other than U+002D HYPHEN-MINUS characters (-), U+0025 PERCENT SIGN
|
| + // 1. If value contains any characters other than U+002D HYPHEN-MINUS characters (-), U+0025 PERCENT SIGN
|
| // characters (%), and characters in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then jump
|
| // to the step labeled next setting.
|
| StringBuilder linePositionBuilder;
|
| @@ -968,9 +968,9 @@ void TextTrackCue::setCueSettings(const String& input)
|
| if (position < input.length() && !WebVTTParser::isValidSettingDelimiter(input[position]))
|
| break;
|
|
|
| - // 2. If value does not contain at least one character in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
|
| + // 2. If value does not contain at least one character in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
|
| // NINE (9), then jump to the step labeled next setting.
|
| - // 3. If any character in value other than the first character is a U+002D HYPHEN-MINUS character (-), then
|
| + // 3. If any character in value other than the first character is a U+002D HYPHEN-MINUS character (-), then
|
| // jump to the step labeled next setting.
|
| // 4. If any character in value other than the last character is a U+0025 PERCENT SIGN character (%), then
|
| // jump to the step labeled next setting.
|
| @@ -978,23 +978,23 @@ void TextTrackCue::setCueSettings(const String& input)
|
| if (linePosition.find('-', 1) != notFound || linePosition.reverseFind("%", linePosition.length() - 2) != notFound)
|
| break;
|
|
|
| - // 5. If the first character in value is a U+002D HYPHEN-MINUS character (-) and the last character in value is a
|
| + // 5. If the first character in value is a U+002D HYPHEN-MINUS character (-) and the last character in value is a
|
| // U+0025 PERCENT SIGN character (%), then jump to the step labeled next setting.
|
| if (linePosition[0] == '-' && linePosition[linePosition.length() - 1] == '%')
|
| break;
|
|
|
| - // 6. Ignoring the trailing percent sign, if any, interpret value as a (potentially signed) integer, and
|
| - // let number be that number.
|
| + // 6. Ignoring the trailing percent sign, if any, interpret value as a (potentially signed) integer, and
|
| + // let number be that number.
|
| // NOTE: toInt ignores trailing non-digit characters, such as '%'.
|
| bool validNumber;
|
| int number = linePosition.toInt(&validNumber);
|
| if (!validNumber)
|
| break;
|
|
|
| - // 7. If the last character in value is a U+0025 PERCENT SIGN character (%), but number is not in the range
|
| + // 7. If the last character in value is a U+0025 PERCENT SIGN character (%), but number is not in the range
|
| // 0 ≤ number ≤ 100, then jump to the step labeled next setting.
|
| // 8. Let cue's text track cue line position be number.
|
| - // 9. If the last character in value is a U+0025 PERCENT SIGN character (%), then let cue's text track cue
|
| + // 9. If the last character in value is a U+0025 PERCENT SIGN character (%), then let cue's text track cue
|
| // snap-to-lines flag be false. Otherwise, let it be true.
|
| if (linePosition[linePosition.length() - 1] == '%') {
|
| if (number < 0 || number > 100)
|
| @@ -1009,7 +1009,7 @@ void TextTrackCue::setCueSettings(const String& input)
|
| break;
|
| case Position:
|
| {
|
| - // 1. If value contains any characters other than U+0025 PERCENT SIGN characters (%) and characters in the range
|
| + // 1. If value contains any characters other than U+0025 PERCENT SIGN characters (%) and characters in the range
|
| // U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then jump to the step labeled next setting.
|
| // 2. If value does not contain at least one character in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9),
|
| // then jump to the step labeled next setting.
|
| @@ -1046,7 +1046,7 @@ void TextTrackCue::setCueSettings(const String& input)
|
| {
|
| // 1. If value contains any characters other than U+0025 PERCENT SIGN characters (%) and characters in the
|
| // range U+0030 DIGIT ZERO (0) to U+0039 DIGIT NINE (9), then jump to the step labeled next setting.
|
| - // 2. If value does not contain at least one character in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
|
| + // 2. If value does not contain at least one character in the range U+0030 DIGIT ZERO (0) to U+0039 DIGIT
|
| // NINE (9), then jump to the step labeled next setting.
|
| String cueSize = WebVTTParser::collectDigits(input, &position);
|
| if (cueSize.isEmpty())
|
| @@ -1183,7 +1183,7 @@ bool TextTrackCue::operator==(const TextTrackCue& cue) const
|
| return false;
|
| if (align() != cue.align())
|
| return false;
|
| -
|
| +
|
| return true;
|
| }
|
|
|
|
|