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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // make it more difficult to maintain the invariant, so should probably | 121 // make it more difficult to maintain the invariant, so should probably |
122 // just invalidate here as well. | 122 // just invalidate here as well. |
123 return true; | 123 return true; |
124 } | 124 } |
125 | 125 |
126 void TextTrackCueList::updateCueIndex(TextTrackCue* cue) | 126 void TextTrackCueList::updateCueIndex(TextTrackCue* cue) |
127 { | 127 { |
128 if (!remove(cue)) | 128 if (!remove(cue)) |
129 return; | 129 return; |
130 | 130 |
131 cue->setIsActive(false); | |
132 cue->removeDisplayTree(); | |
133 | |
134 // FIXME: If moving the cue such that its index in list increases, then | 131 // FIXME: If moving the cue such that its index in list increases, then |
135 // what happens with the cached index on cues in the range [oldIndex, | 132 // what happens with the cached index on cues in the range [oldIndex, |
136 // newIndex)? (Some of the indices will be "safe", but there'll be a risk | 133 // newIndex)? (Some of the indices will be "safe", but there'll be a risk |
137 // that the lazy update via cueIndex() yields duplicates/incorrect order.) | 134 // that the lazy update via cueIndex() yields duplicates/incorrect order.) |
138 add(cue); | 135 add(cue); |
139 } | 136 } |
140 | 137 |
141 void TextTrackCueList::clear() | 138 void TextTrackCueList::clear() |
142 { | 139 { |
143 m_list.clear(); | 140 m_list.clear(); |
144 } | 141 } |
145 | 142 |
146 void TextTrackCueList::invalidateCueIndexes(size_t start) | 143 void TextTrackCueList::invalidateCueIndexes(size_t start) |
147 { | 144 { |
148 // FIXME: When iterating cues we could as well update their cached indices t
oo. | 145 // FIXME: When iterating cues we could as well update their cached indices t
oo. |
149 for (size_t i = start; i < m_list.size(); ++i) | 146 for (size_t i = start; i < m_list.size(); ++i) |
150 m_list[i]->invalidateCueIndex(); | 147 m_list[i]->invalidateCueIndex(); |
151 } | 148 } |
152 | 149 |
153 DEFINE_TRACE(TextTrackCueList) | 150 DEFINE_TRACE(TextTrackCueList) |
154 { | 151 { |
155 visitor->trace(m_list); | 152 visitor->trace(m_list); |
156 visitor->trace(m_activeCues); | 153 visitor->trace(m_activeCues); |
157 } | 154 } |
158 | 155 |
159 } // namespace blink | 156 } // namespace blink |
OLD | NEW |