コード例 #1
0
void TextTrack::setMode(const AtomicString& mode)
{
    ASSERT(mode == disabledKeyword() || mode == hiddenKeyword() || mode == showingKeyword());

    // 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 (m_mode == mode)
        return;

    if (m_cues && cueTimeline()) {
        // 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())
            cueTimeline()->removeCues(this, m_cues.get());
        else if (mode != showingKeyword())
            cueTimeline()->hideCues(this, m_cues.get());
    }

    m_mode = mode;

    if (mode != disabledKeyword() && getReadinessState() == Loaded) {
        if (m_cues && cueTimeline())
            cueTimeline()->addCues(this, m_cues.get());
    }

    if (mediaElement())
        mediaElement()->textTrackModeChanged(this);
}
コード例 #2
0
ファイル: TextTrack.cpp プロジェクト: kamihouse/webkit
void TextTrack::setMode(const AtomicString& mode)
{
    ASSERT(mode == disabledKeyword() || mode == hiddenKeyword() || mode == showingKeyword());

    // 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 (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) {
            TextTrackCue* cue = m_cues->item(i);
            if (cue->isRenderable())
                toVTTCue(cue)->removeDisplayTree();
        }
    }

    m_mode = mode;

    if (m_client)
        m_client->textTrackModeChanged(this);
}
コード例 #3
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);
}
コード例 #4
0
void TextTrack::addCue(TextTrackCue* cue)
{
    ASSERT(cue);

    // TODO(93143): Add spec-compliant behavior for negative time values.
    if (std::isnan(cue->startTime()) || std::isnan(cue->endTime()) || cue->startTime() < 0 || cue->endTime() < 0)
        return;

    // https://html.spec.whatwg.org/multipage/embedded-content.html#dom-texttrack-addcue

    // The addCue(cue) method of TextTrack objects, when invoked, must run the following steps:

    // (Steps 1 and 2 - pertaining to association of rendering rules - are not implemented.)

    // 3. If the given cue is in a text track list of cues, then remove cue
    // from that text track list of cues.
    if (TextTrack* cueTrack = cue->track())
        cueTrack->removeCue(cue, ASSERT_NO_EXCEPTION);

    // 4. Add cue to the method's TextTrack object's text track's text track list of cues.
    cue->setTrack(this);
    ensureTextTrackCueList()->add(cue);

    if (cueTimeline() && m_mode != disabledKeyword())
        cueTimeline()->addCue(this, cue);
}
コード例 #5
0
ファイル: TextTrack.cpp プロジェクト: kamihouse/webkit
TextTrackCueList* TextTrack::cues()
{
    // 4.8.10.12.5 If the text track mode ... is not the text track disabled mode,
    // then the cues attribute must return a live TextTrackCueList object ...
    // Otherwise, it must return null. When an object is returned, the
    // same object must be returned each time.
    // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-cues
    if (m_mode != disabledKeyword())
        return ensureTextTrackCueList();
    return nullptr;
}
コード例 #6
0
ファイル: TextTrack.cpp プロジェクト: kamihouse/webkit
TextTrackCueList* TextTrack::activeCues() const
{
    // 4.8.10.12.5 If the text track mode ... is not the text track disabled mode,
    // then the activeCues attribute must return a live TextTrackCueList object ...
    // ... whose active flag was set when the script started, in text track cue
    // order. Otherwise, it must return null. When an object is returned, the
    // same object must be returned each time.
    // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-activecues
    if (m_cues && m_mode != disabledKeyword())
        return m_cues->activeCues();
    return nullptr;
}
コード例 #7
0
ファイル: TextTrack.cpp プロジェクト: jeremyroman/blink
VTTRegionList* TextTrack::regions()
{
    // If the text track mode of the text track that the TextTrack object
    // represents is not the text track disabled mode, then the regions
    // attribute must return a live VTTRegionList object that represents
    // the text track list of regions of the text track. Otherwise, it must
    // return null. When an object is returned, the same object must be returned
    // each time.
    if (RuntimeEnabledFeatures::webVTTRegionsEnabled() && m_mode != disabledKeyword())
        return ensureVTTRegionList();
    return 0;
}
コード例 #8
0
void TextTrack::addListOfCues(HeapVector<Member<TextTrackCue>>& listOfNewCues)
{
    TextTrackCueList* cues = ensureTextTrackCueList();

    for (auto& newCue : listOfNewCues) {
        newCue->setTrack(this);
        cues->add(newCue);
    }

    if (cueTimeline() && mode() != disabledKeyword())
        cueTimeline()->addCues(this, cues);
}
コード例 #9
0
TextTrack::TextTrack(const AtomicString& kind, const AtomicString& label, const AtomicString& language, const AtomicString& id, TextTrackType type)
    : TrackBase(TrackBase::TextTrack, label, language, id)
    , m_cues(nullptr)
    , m_regions(nullptr)
    , m_trackList(nullptr)
    , m_mode(disabledKeyword())
    , m_trackType(type)
    , m_readinessState(NotLoaded)
    , m_trackIndex(invalidTrackIndex)
    , m_renderedTrackIndex(invalidTrackIndex)
    , m_hasBeenConfigured(false)
{
    setKind(kind);
}
コード例 #10
0
ファイル: TextTrack.cpp プロジェクト: kamihouse/webkit
TextTrack::TextTrack(ScriptExecutionContext* context, TextTrackClient* client, const AtomicString& kind, const AtomicString& id, const AtomicString& label, const AtomicString& language, TextTrackType type)
    : TrackBase(TrackBase::TextTrack, id, label, language)
    , m_cues(0)
    , m_regions(0)
    , m_scriptExecutionContext(context)
    , m_mode(disabledKeyword().string())
    , m_client(client)
    , m_trackType(type)
    , m_readinessState(NotLoaded)
    , m_trackIndex(invalidTrackIndex)
    , m_renderedTrackIndex(invalidTrackIndex)
    , m_hasBeenConfigured(false)
{
    setKindInternal(kind);
}
コード例 #11
0
ファイル: TextTrack.cpp プロジェクト: dog-god/iptv
TextTrack::TextTrack(ScriptExecutionContext* context, TextTrackClient* client, const AtomicString& kind, const AtomicString& label, const AtomicString& language, TextTrackType type)
    : TrackBase(context, TrackBase::TextTrack)
    , m_cues(0)
    , m_mediaElement(0)
    , m_label(label)
    , m_language(language)
    , m_mode(disabledKeyword().string())
    , m_client(client)
    , m_trackType(type)
    , m_readinessState(NotLoaded)
    , m_showingByDefault(false)
    , m_trackIndex(invalidTrackIndex)
{
    setKind(kind);
}
コード例 #12
0
ファイル: TextTrack.cpp プロジェクト: jeremyroman/blink
TextTrack::TextTrack(Document& document, const AtomicString& kind, const AtomicString& label, const AtomicString& language, const AtomicString& id, TextTrackType type)
    : TrackBase(TrackBase::TextTrack, label, language, id)
    , m_cues(nullptr)
    , m_regions(nullptr)
    , m_document(&document)
    , m_trackList(0)
    , m_mode(disabledKeyword())
    , m_trackType(type)
    , m_readinessState(NotLoaded)
    , m_trackIndex(invalidTrackIndex)
    , m_renderedTrackIndex(invalidTrackIndex)
    , m_hasBeenConfigured(false)
{
    ScriptWrappable::init(this);
    setKind(kind);
}
コード例 #13
0
ファイル: TextTrack.cpp プロジェクト: fmalita/webkit
TextTrack::TextTrack(ScriptExecutionContext* context, TextTrackClient* client, const AtomicString& kind, const AtomicString& label, const AtomicString& language, TextTrackType type)
    : TrackBase(context, TrackBase::TextTrack)
    , m_cues(0)
#if ENABLE(WEBVTT_REGIONS)
    , m_regions(0)
#endif
    , m_mediaElement(0)
    , m_label(label)
    , m_language(language)
    , m_mode(disabledKeyword().string())
    , m_client(client)
    , m_trackType(type)
    , m_readinessState(NotLoaded)
    , m_trackIndex(invalidTrackIndex)
    , m_renderedTrackIndex(invalidTrackIndex)
    , m_hasBeenConfigured(false)
{
    setKind(kind);
}
コード例 #14
0
void TextTrack::cueDidChange(TextTrackCue* cue)
{
    // This method is called through cue->track(), which should imply that this
    // track has a list of cues.
    ASSERT(m_cues && cue->track() == this);

    // Make sure the TextTrackCueList order is up-to-date.
    // FIXME: Only need to do this if the change was to any of the timestamps.
    m_cues->updateCueIndex(cue);

    // Since a call to cueDidChange is always preceded by a call to
    // cueWillChange, the cue should no longer be active when we reach this
    // point (since it was removed from the timeline in cueWillChange).
    ASSERT(!cue->isActive());

    if (m_mode == disabledKeyword())
        return;

    // ... and add it back again if the track is enabled.
    if (cueTimeline())
        cueTimeline()->addCue(this, cue);
}
コード例 #15
0
ファイル: TextTrack.cpp プロジェクト: kamihouse/webkit
bool TextTrack::enabled() const
{
    return m_mode != disabledKeyword();
}