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); }
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); }
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); }
void TextTrack::setKind(const AtomicString& newKind) { AtomicString oldKind = kind(); TrackBase::setKind(newKind); // If kind changes from visual to non-visual and mode is 'showing', then force mode to 'hidden'. // FIXME: This is not per spec. crbug.com/460923 if (oldKind != kind() && mode() == showingKeyword()) { if (kind() != captionsKeyword() && kind() != subtitlesKeyword()) setMode(hiddenKeyword()); } }