void TextTrackList::invalidateTrackIndexesAfterTrack(TextTrack* track)
{
    HeapVector<Member<TextTrack>>* tracks = nullptr;

    if (track->trackType() == TextTrack::TrackElement) {
        tracks = &m_elementTracks;
        for (size_t i = 0; i < m_addTrackTracks.size(); ++i)
            m_addTrackTracks[i]->invalidateTrackIndex();
        for (size_t i = 0; i < m_inbandTracks.size(); ++i)
            m_inbandTracks[i]->invalidateTrackIndex();
    } else if (track->trackType() == TextTrack::AddTrack) {
        tracks = &m_addTrackTracks;
        for (size_t i = 0; i < m_inbandTracks.size(); ++i)
            m_inbandTracks[i]->invalidateTrackIndex();
    } else if (track->trackType() == TextTrack::InBand) {
        tracks = &m_inbandTracks;
    } else {
        ASSERT_NOT_REACHED();
    }

    size_t index = tracks->find(track);
    if (index == kNotFound)
        return;

    for (size_t i = index; i < tracks->size(); ++i)
        tracks->at(index)->invalidateTrackIndex();
}
示例#2
0
void HTMLFormControlsCollection::namedGetter(
    const AtomicString& name,
    RadioNodeListOrElement& returnValue) {
  HeapVector<Member<Element>> namedItems;
  this->namedItems(name, namedItems);

  if (namedItems.isEmpty())
    return;

  if (namedItems.size() == 1) {
    if (!isHTMLImageElement(*namedItems[0]))
      returnValue.setElement(namedItems.at(0));
    return;
  }

  // This path never returns a RadioNodeList for <img> because
  // onlyMatchingImgElements flag is false by default.
  returnValue.setRadioNodeList(ownerNode().radioNodeList(name));
}