コード例 #1
0
ファイル: TextTrackCue.cpp プロジェクト: fmalita/webkit
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 
    // 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;
    else if (value == verticalGrowingLeftKeyword())
        direction = VerticalGrowingLeft;
    else if (value == verticalGrowingRightKeyword())
        direction = VerticalGrowingRight;
    else
        ec = SYNTAX_ERR;
    
    if (direction == m_writingDirection)
        return;

    cueWillChange();
    m_writingDirection = direction;
    cueDidChange();
}
コード例 #2
0
void VTTCue::setAlign(const String& value, ExceptionState& exceptionState)
{
    // 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
    // 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;
    else if (value == middleKeyword())
        alignment = Middle;
    else if (value == endKeyword())
        alignment = End;
    else if (value == leftKeyword())
        alignment = Left;
    else if (value == rightKeyword())
        alignment = Right;
    else
        exceptionState.throwDOMException(SyntaxError, ExceptionMessages::failedToSet("align", "TextTrackCue", "The value provided ('" + value + "') is invalid. Only 'start', 'middle', 'end', 'left', and 'right' are accepted."));

    if (alignment == m_cueAlignment)
        return;

    cueWillChange();
    m_cueAlignment = alignment;
    cueDidChange();
}
コード例 #3
0
void VTTCue::setPosition(const DoubleOrAutoKeyword& position, ExceptionState& exceptionState)
{
    // http://dev.w3.org/html5/webvtt/#dfn-vttcue-position
    // On setting, if the new value is negative or greater than 100, then an
    // IndexSizeError exception must be thrown. Otherwise, the WebVTT cue
    // position must be set to the new value; if the new value is the string
    // "auto", then it must be interpreted as the special value auto.
    float floatPosition;
    if (position.isAutoKeyword()) {
        if (textPositionIsAuto())
            return;
        floatPosition = std::numeric_limits<float>::quiet_NaN();
    } else {
        ASSERT(position.isDouble());
        if (isInvalidPercentage(position.getAsDouble(), exceptionState))
            return;
        floatPosition = narrowPrecisionToFloat(position.getAsDouble());
        if (m_textPosition == floatPosition)
            return;
    }

    cueWillChange();
    m_textPosition = floatPosition;
    cueDidChange();
}
コード例 #4
0
void VTTCue::setVertical(const String& value, ExceptionState& exceptionState)
{
    // 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
    // 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;
    else if (value == verticalGrowingLeftKeyword())
        direction = VerticalGrowingLeft;
    else if (value == verticalGrowingRightKeyword())
        direction = VerticalGrowingRight;
    else
        exceptionState.throwDOMException(SyntaxError, ExceptionMessages::failedToSet("vertical", "TextTrackCue", "The value provided ('" + value + "') is invalid. Only 'rl', 'lr', and the empty string are accepted."));

    if (direction == m_writingDirection)
        return;

    cueWillChange();
    m_writingDirection = direction;
    cueDidChange();
}
コード例 #5
0
ファイル: TextTrackCue.cpp プロジェクト: fmalita/webkit
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 
    // 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;
    else if (value == middleKeyword())
        alignment = Middle;
    else if (value == endKeyword())
        alignment = End;
    else
        ec = SYNTAX_ERR;
    
    if (alignment == m_cueAlignment)
        return;

    cueWillChange();
    m_cueAlignment = alignment;
    cueDidChange();
}
コード例 #6
0
ファイル: TextTrackCue.cpp プロジェクト: mirror/chromium
void TextTrackCue::setId(const AtomicString& id) {
  if (m_id == id)
    return;

  cueWillChange();
  m_id = id;
  cueDidChange();
}
コード例 #7
0
ファイル: TextTrackCue.cpp プロジェクト: mirror/chromium
void TextTrackCue::setPauseOnExit(bool value) {
  if (m_pauseOnExit == value)
    return;

  cueWillChange();
  m_pauseOnExit = value;
  cueDidChange();
}
コード例 #8
0
ファイル: VTTCue.cpp プロジェクト: kjthegod/WebKit
void VTTCue::setSnapToLines(bool value)
{
    if (m_snapToLines == value)
        return;

    cueWillChange();
    m_snapToLines = value;
    cueDidChange();
}
コード例 #9
0
ファイル: TextTrackCue.cpp プロジェクト: Moondee/Artemis
void TextTrackCue::setEndTime(double value)
{
    if (m_endTime == value)
        return;
    
    cueWillChange();
    m_endTime = value;
    cueDidChange();
}
コード例 #10
0
ファイル: TextTrackCue.cpp プロジェクト: mirror/chromium
void TextTrackCue::setEndTime(double value) {
  // TODO(93143): Add spec-compliant behavior for negative time values.
  if (m_endTime == value || value < 0)
    return;

  cueWillChange();
  m_endTime = value;
  cueDidChange();
}
コード例 #11
0
ファイル: VTTCue.cpp プロジェクト: kjthegod/WebKit
void VTTCue::setRegionId(const String& regionId)
{
    if (m_regionId == regionId)
        return;

    cueWillChange();
    m_regionId = regionId;
    cueDidChange();
}
コード例 #12
0
ファイル: TextTrackCue.cpp プロジェクト: fmalita/webkit
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.
    m_webVTTNodeTree = 0;
    m_content = text;
    cueDidChange();
}
コード例 #13
0
ファイル: VTTCue.cpp プロジェクト: kjthegod/WebKit
void VTTCue::setText(const String& text)
{
    if (m_text == 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.
    m_vttNodeTree = nullptr;
    m_text = text;
    cueDidChange();
}
コード例 #14
0
void TextTrackCue::setStartTime(double value, ExceptionState& exceptionState)
{
    // NaN, Infinity and -Infinity values should trigger a TypeError.
    if (isInfiniteOrNonNumber(value, exceptionState))
        return;

    // TODO(93143): Add spec-compliant behavior for negative time values.
    if (m_startTime == value || value < 0)
        return;

    cueWillChange();
    m_startTime = value;
    cueDidChange();
}
コード例 #15
0
ファイル: VTTCue.cpp プロジェクト: kjthegod/WebKit
void VTTCue::setSize(int size, ExceptionState& exceptionState)
{
    // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-size
    // On setting, if the new value is negative or greater than 100, then throw an IndexSizeError
    // exception. Otherwise, set the text track cue size to the new value.
    if (isInvalidPercentage(size, exceptionState))
        return;

    // Otherwise, set the text track cue line position to the new value.
    if (m_cueSize == size)
        return;

    cueWillChange();
    m_cueSize = size;
    cueDidChange();
}
コード例 #16
0
ファイル: TextTrackCue.cpp プロジェクト: fmalita/webkit
void TextTrackCue::setEndTime(double value, ExceptionCode& ec)
{
    // NaN, Infinity and -Infinity values should trigger a TypeError.
    if (std::isinf(value) || std::isnan(value)) {
        ec = TypeError;
        return;
    }

    // TODO(93143): Add spec-compliant behavior for negative time values.
    if (m_endTime == value || value < 0)
        return;
    
    cueWillChange();
    m_endTime = value;
    cueDidChange();
}
コード例 #17
0
ファイル: VTTCue.cpp プロジェクト: kjthegod/WebKit
void VTTCue::setPosition(int position, ExceptionState& exceptionState)
{
    // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-position
    // On setting, if the new value is negative or greater than 100, then throw an IndexSizeError exception.
    // Otherwise, set the text track cue text position to the new value.
    if (isInvalidPercentage(position, exceptionState))
        return;

    // Otherwise, set the text track cue line position to the new value.
    if (m_textPosition == position)
        return;

    cueWillChange();
    m_textPosition = position;
    cueDidChange();
}
コード例 #18
0
void VTTCue::setSize(double size, ExceptionState& exceptionState)
{
    // http://dev.w3.org/html5/webvtt/#dfn-vttcue-size
    // On setting, if the new value is negative or greater than 100, then throw
    // an IndexSizeError exception.
    if (isInvalidPercentage(size, exceptionState))
        return;

    // Otherwise, set the WebVTT cue size to the new value.
    float floatSize = narrowPrecisionToFloat(size);
    if (m_cueSize == floatSize)
        return;

    cueWillChange();
    m_cueSize = floatSize;
    cueDidChange();
}
コード例 #19
0
ファイル: TextTrackCue.cpp プロジェクト: fmalita/webkit
void TextTrackCue::setPosition(int position, ExceptionCode& ec)
{
    // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-position
    // On setting, if the new value is negative or greater than 100, then throw an IndexSizeError exception.
    // Otherwise, set the text track cue text position to the new value.
    if (position < 0 || position > 100) {
        ec = INDEX_SIZE_ERR;
        return;
    }
    
    // Otherwise, set the text track cue line position to the new value.
    if (m_textPosition == position)
        return;
    
    cueWillChange();
    m_textPosition = position;
    cueDidChange();
}
コード例 #20
0
ファイル: TextTrackCue.cpp プロジェクト: fmalita/webkit
void TextTrackCue::setSize(int size, ExceptionCode& ec)
{
    // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-size
    // On setting, if the new value is negative or greater than 100, then throw an IndexSizeError
    // exception. Otherwise, set the text track cue size to the new value.
    if (size < 0 || size > 100) {
        ec = INDEX_SIZE_ERR;
        return;
    }
    
    // Otherwise, set the text track cue line position to the new value.
    if (m_cueSize == size)
        return;
    
    cueWillChange();
    m_cueSize = size;
    cueDidChange();
}
コード例 #21
0
ファイル: TextTrackCue.cpp プロジェクト: fmalita/webkit
void TextTrackCue::setLine(int position, ExceptionCode& ec)
{
    // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-line
    // On setting, if the text track cue snap-to-lines flag is not set, and the new
    // value is negative or greater than 100, then throw an IndexSizeError exception.
    if (!m_snapToLines && (position < 0 || position > 100)) {
        ec = INDEX_SIZE_ERR;
        return;
    }

    // Otherwise, set the text track cue line position to the new value.
    if (m_linePosition == position)
        return;

    cueWillChange();
    m_linePosition = position;
    m_computedLinePosition = calculateComputedLinePosition();
    cueDidChange();
}
コード例 #22
0
ファイル: VTTCue.cpp プロジェクト: kjthegod/WebKit
void VTTCue::setLine(int position, ExceptionState& exceptionState)
{
    // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-element.html#dom-texttrackcue-line
    // On setting, if the text track cue snap-to-lines flag is not set, and the new
    // value is negative or greater than 100, then throw an IndexSizeError exception.
    if (!m_snapToLines && (position < 0 || position > 100)) {
        exceptionState.throwDOMException(IndexSizeError, "The snap-to-lines flag is not set, and the value provided (" + String::number(position) + ") is not between 0 and 100.");
        return;
    }

    // Otherwise, set the text track cue line position to the new value.
    if (m_linePosition == position)
        return;

    cueWillChange();
    m_linePosition = position;
    m_computedLinePosition = calculateComputedLinePosition();
    cueDidChange();
}
コード例 #23
0
ファイル: VTTCue.cpp プロジェクト: kjthegod/WebKit
void VTTCue::setVertical(const String& value)
{
    WritingDirection direction = m_writingDirection;
    if (value == horizontalKeyword())
        direction = Horizontal;
    else if (value == verticalGrowingLeftKeyword())
        direction = VerticalGrowingLeft;
    else if (value == verticalGrowingRightKeyword())
        direction = VerticalGrowingRight;
    else
        ASSERT_NOT_REACHED();

    if (direction == m_writingDirection)
        return;

    cueWillChange();
    m_writingDirection = direction;
    cueDidChange();
}
コード例 #24
0
void VTTCue::setLine(const DoubleOrAutoKeyword& position)
{
    // http://dev.w3.org/html5/webvtt/#dfn-vttcue-line
    // On setting, the WebVTT cue line must be set to the new value; if the new
    // value is the string "auto", then it must be interpreted as the special
    // value auto.  ("auto" is translated to NaN.)
    float floatPosition;
    if (position.isAutoKeyword()) {
        if (lineIsAuto())
            return;
        floatPosition = std::numeric_limits<float>::quiet_NaN();
    } else {
        ASSERT(position.isDouble());
        floatPosition = narrowPrecisionToFloat(position.getAsDouble());
        if (m_linePosition == floatPosition)
            return;
    }

    cueWillChange();
    m_linePosition = floatPosition;
    cueDidChange();
}
コード例 #25
0
ファイル: VTTCue.cpp プロジェクト: kjthegod/WebKit
void VTTCue::setAlign(const String& value)
{
    CueAlignment alignment = m_cueAlignment;
    if (value == startKeyword())
        alignment = Start;
    else if (value == middleKeyword())
        alignment = Middle;
    else if (value == endKeyword())
        alignment = End;
    else if (value == leftKeyword())
        alignment = Left;
    else if (value == rightKeyword())
        alignment = Right;
    else
        ASSERT_NOT_REACHED();

    if (alignment == m_cueAlignment)
        return;

    cueWillChange();
    m_cueAlignment = alignment;
    cueDidChange();
}