OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 void TextTrack::setMode(const AtomicString& mode) | 167 void TextTrack::setMode(const AtomicString& mode) |
168 { | 168 { |
169 ASSERT(mode == disabledKeyword() || mode == hiddenKeyword() || mode == showi
ngKeyword()); | 169 ASSERT(mode == disabledKeyword() || mode == hiddenKeyword() || mode == showi
ngKeyword()); |
170 | 170 |
171 // On setting, if the new value isn't equal to what the attribute would curr
ently | 171 // On setting, if the new value isn't equal to what the attribute would curr
ently |
172 // return, the new value must be processed as follows ... | 172 // return, the new value must be processed as follows ... |
173 if (m_mode == mode) | 173 if (m_mode == mode) |
174 return; | 174 return; |
175 | 175 |
176 // If mode changes to disabled, remove this track's cues from the client | 176 if (m_cues && cueTimeline()) { |
177 // because they will no longer be accessible from the cues() function. | 177 // If mode changes to disabled, remove this track's cues from the client |
178 if (mode == disabledKeyword() && cueTimeline() && m_cues) | 178 // because they will no longer be accessible from the cues() function. |
179 cueTimeline()->removeCues(this, m_cues.get()); | 179 if (mode == disabledKeyword()) |
180 | 180 cueTimeline()->removeCues(this, m_cues.get()); |
181 if (mode != showingKeyword() && m_cues) | 181 else if (mode != showingKeyword()) |
182 for (size_t i = 0; i < m_cues->length(); ++i) | 182 cueTimeline()->hideCues(this, m_cues.get()); |
183 m_cues->item(i)->removeDisplayTree(); | 183 } |
184 | 184 |
185 m_mode = mode; | 185 m_mode = mode; |
186 | 186 |
187 if (mode != disabledKeyword() && readinessState() == Loaded) { | 187 if (mode != disabledKeyword() && readinessState() == Loaded) { |
188 if (m_cues && cueTimeline()) | 188 if (m_cues && cueTimeline()) |
189 cueTimeline()->addCues(this, m_cues.get()); | 189 cueTimeline()->addCues(this, m_cues.get()); |
190 } | 190 } |
191 | 191 |
192 if (mediaElement()) | 192 if (mediaElement()) |
193 mediaElement()->textTrackModeChanged(this); | 193 mediaElement()->textTrackModeChanged(this); |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 { | 488 { |
489 visitor->trace(m_cues); | 489 visitor->trace(m_cues); |
490 visitor->trace(m_activeCues); | 490 visitor->trace(m_activeCues); |
491 visitor->trace(m_regions); | 491 visitor->trace(m_regions); |
492 visitor->trace(m_trackList); | 492 visitor->trace(m_trackList); |
493 TrackBase::trace(visitor); | 493 TrackBase::trace(visitor); |
494 EventTargetWithInlineData::trace(visitor); | 494 EventTargetWithInlineData::trace(visitor); |
495 } | 495 } |
496 | 496 |
497 } // namespace blink | 497 } // namespace blink |
OLD | NEW |