| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 | 106 |
| 107 return add(cue.release(), index + 1, end); | 107 return add(cue.release(), index + 1, end); |
| 108 } | 108 } |
| 109 | 109 |
| 110 bool TextTrackCueList::remove(TextTrackCue* cue) | 110 bool TextTrackCueList::remove(TextTrackCue* cue) |
| 111 { | 111 { |
| 112 size_t index = m_list.find(cue); | 112 size_t index = m_list.find(cue); |
| 113 if (index == kNotFound) | 113 if (index == kNotFound) |
| 114 return false; | 114 return false; |
| 115 | 115 |
| 116 m_list.remove(index); |
| 117 return true; |
| 118 } |
| 119 |
| 120 bool TextTrackCueList::updateCueIndex(TextTrackCue* cue) |
| 121 { |
| 122 size_t index = m_list.find(cue); |
| 123 if (index == kNotFound) |
| 124 return false; |
| 125 |
| 116 cue->setIsActive(false); | 126 cue->setIsActive(false); |
| 117 cue->removeDisplayTree(); | 127 cue->removeDisplayTree(); |
| 118 | 128 |
| 119 m_list.remove(index); | 129 m_list.remove(index); |
| 120 return true; | |
| 121 } | |
| 122 | 130 |
| 123 bool TextTrackCueList::contains(TextTrackCue* cue) const | |
| 124 { | |
| 125 return m_list.contains(cue); | |
| 126 } | |
| 127 | |
| 128 bool TextTrackCueList::updateCueIndex(TextTrackCue* cue) | |
| 129 { | |
| 130 if (!contains(cue)) | |
| 131 return false; | |
| 132 | |
| 133 remove(cue); | |
| 134 return add(cue); | 131 return add(cue); |
| 135 } | 132 } |
| 136 | 133 |
| 137 void TextTrackCueList::clear() | 134 void TextTrackCueList::clear() |
| 138 { | 135 { |
| 139 m_list.clear(); | 136 m_list.clear(); |
| 140 } | 137 } |
| 141 | 138 |
| 142 void TextTrackCueList::invalidateCueIndexes(size_t start) | 139 void TextTrackCueList::invalidateCueIndexes(size_t start) |
| 143 { | 140 { |
| 144 for (size_t i = start; i < m_list.size(); ++i) | 141 for (size_t i = start; i < m_list.size(); ++i) |
| 145 m_list[i]->invalidateCueIndex(); | 142 m_list[i]->invalidateCueIndex(); |
| 146 } | 143 } |
| 147 | 144 |
| 148 DEFINE_TRACE(TextTrackCueList) | 145 DEFINE_TRACE(TextTrackCueList) |
| 149 { | 146 { |
| 150 visitor->trace(m_list); | 147 visitor->trace(m_list); |
| 151 visitor->trace(m_activeCues); | 148 visitor->trace(m_activeCues); |
| 152 } | 149 } |
| 153 | 150 |
| 154 } // namespace blink | 151 } // namespace blink |
| OLD | NEW |