コード例 #1
0
ファイル: TextTrack.cpp プロジェクト: dog-god/iptv
void TextTrack::setMode(const AtomicString& mode)
{
    // On setting, if the new value isn't equal to what the attribute would currently
    // return, the new value must be processed as follows ...
    if (mode != disabledKeyword() && mode != hiddenKeyword() && mode != showingKeyword())
        return;

    if (m_mode == mode)
        return;

    // If mode changes to disabled, remove this track's cues from the client
    // because they will no longer be accessible from the cues() function.
    if (mode == disabledKeyword() && m_client && m_cues)
        m_client->textTrackRemoveCues(this, m_cues.get());
         
    if (mode != showingKeyword() && m_cues)
        for (size_t i = 0; i < m_cues->length(); ++i)
            m_cues->item(i)->removeDisplayTree();

    //  ... Note: If the mode had been showing by default, this will change it to showing, 
    // even though the value of mode would appear not to change.
    m_mode = mode;
    setShowingByDefault(false);

    if (m_client)
        m_client->textTrackModeChanged(this);
}
コード例 #2
0
void TextTrack::setMode(unsigned short mode, ExceptionCode& ec)
{
    // 4.8.10.12.5 On setting the mode, if the new value is not either 0, 1, or 2,
    // the user agent must throw an INVALID_ACCESS_ERR exception.
    if (mode > TextTrack::SHOWING) {
        ec = INVALID_ACCESS_ERR;
        return;
    }

    if (m_mode == static_cast<Mode>(mode))
        return;

    // If mode changes to disabled, remove this track's cues from the client
    // because they will no longer be accessible from the cues() function.
    if (mode == TextTrack::DISABLED && m_client && m_cues)
        m_client->textTrackRemoveCues(this, m_cues.get());

    if (mode != TextTrack::SHOWING && m_cues)
        for (size_t i = 0; i < m_cues->length(); ++i)
            m_cues->item(i)->removeDisplayTree();

    //  ... Note: If the mode had been showing by default, this will change it to showing,
    // even though the value of mode would appear not to change.
    m_mode = static_cast<Mode>(mode);
    setShowingByDefault(false);

    if (m_client)
        m_client->textTrackModeChanged(this);
}