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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
90 return closed; | 90 return closed; |
91 } | 91 } |
92 | 92 |
93 const AtomicString& TextTrack::showingKeyword() | 93 const AtomicString& TextTrack::showingKeyword() |
94 { | 94 { |
95 DEFINE_STATIC_LOCAL(const AtomicString, ended, ("showing", AtomicString::Con structFromLiteral)); | 95 DEFINE_STATIC_LOCAL(const AtomicString, ended, ("showing", AtomicString::Con structFromLiteral)); |
96 return ended; | 96 return ended; |
97 } | 97 } |
98 | 98 |
99 TextTrack::TextTrack(Document& document, TextTrackClient* client, const AtomicSt ring& kind, const AtomicString& label, const AtomicString& language, const Atomi cString& id, TextTrackType type) | 99 TextTrack::TextTrack(Document& document, TextTrackClient* client, const AtomicSt ring& kind, const AtomicString& label, const AtomicString& language, const Atomi cString& id, TextTrackType type) |
100 : TrackBase(TrackBase::TextTrack) | 100 : TrackBase(TrackBase::TextTrack, label, language, id) |
101 , m_cues(0) | 101 , m_cues(0) |
102 , m_regions(0) | 102 , m_regions(0) |
103 , m_document(&document) | 103 , m_document(&document) |
104 , m_mediaElement(0) | 104 , m_trackList(0) |
105 , m_label(label) | |
106 , m_language(language) | |
107 , m_id(id) | |
108 , m_mode(disabledKeyword()) | 105 , m_mode(disabledKeyword()) |
109 , m_client(client) | 106 , m_client(client) |
110 , m_trackType(type) | 107 , m_trackType(type) |
111 , m_readinessState(NotLoaded) | 108 , m_readinessState(NotLoaded) |
112 , m_trackIndex(invalidTrackIndex) | 109 , m_trackIndex(invalidTrackIndex) |
113 , m_renderedTrackIndex(invalidTrackIndex) | 110 , m_renderedTrackIndex(invalidTrackIndex) |
114 , m_hasBeenConfigured(false) | 111 , m_hasBeenConfigured(false) |
115 { | 112 { |
116 ScriptWrappable::init(this); | 113 ScriptWrappable::init(this); |
117 setKind(kind); | 114 setKind(kind); |
(...skipping 25 matching lines...) Expand all Loading... | |
143 if (value == descriptionsKeyword()) | 140 if (value == descriptionsKeyword()) |
144 return true; | 141 return true; |
145 if (value == chaptersKeyword()) | 142 if (value == chaptersKeyword()) |
146 return true; | 143 return true; |
147 if (value == metadataKeyword()) | 144 if (value == metadataKeyword()) |
148 return true; | 145 return true; |
149 | 146 |
150 return false; | 147 return false; |
151 } | 148 } |
152 | 149 |
153 void TextTrack::setKind(const AtomicString& kind) | 150 void TextTrack::setKind(const AtomicString& newKind) |
154 { | 151 { |
155 String oldKind = m_kind; | 152 AtomicString oldKind = kind(); |
153 TrackBase::setKind(newKind); | |
156 | 154 |
157 if (isValidKindKeyword(kind)) | 155 if (m_client && oldKind != kind()) |
158 m_kind = kind; | |
159 else | |
160 m_kind = subtitlesKeyword(); | |
161 | |
162 if (m_client && oldKind != m_kind) | |
163 m_client->textTrackKindChanged(this); | 156 m_client->textTrackKindChanged(this); |
164 } | 157 } |
165 | 158 |
166 void TextTrack::setMode(const AtomicString& mode) | 159 void TextTrack::setMode(const AtomicString& mode) |
167 { | 160 { |
168 ASSERT(mode == disabledKeyword() || mode == hiddenKeyword() || mode == showi ngKeyword()); | 161 ASSERT(mode == disabledKeyword() || mode == hiddenKeyword() || mode == showi ngKeyword()); |
169 | 162 |
170 // On setting, if the new value isn't equal to what the attribute would curr ently | 163 // On setting, if the new value isn't equal to what the attribute would curr ently |
171 // return, the new value must be processed as follows ... | 164 // return, the new value must be processed as follows ... |
172 if (m_mode == mode) | 165 if (m_mode == mode) |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
370 | 363 |
371 // Make sure the TextTrackCueList order is up-to-date. | 364 // Make sure the TextTrackCueList order is up-to-date. |
372 ensureTextTrackCueList()->updateCueIndex(cue); | 365 ensureTextTrackCueList()->updateCueIndex(cue); |
373 | 366 |
374 // ... and add it back again. | 367 // ... and add it back again. |
375 m_client->textTrackAddCue(this, cue); | 368 m_client->textTrackAddCue(this, cue); |
376 } | 369 } |
377 | 370 |
378 int TextTrack::trackIndex() | 371 int TextTrack::trackIndex() |
379 { | 372 { |
380 ASSERT(m_mediaElement); | 373 ASSERT(m_trackList); |
381 | 374 |
382 if (m_trackIndex == invalidTrackIndex) | 375 if (m_trackIndex == invalidTrackIndex) |
383 m_trackIndex = m_mediaElement->textTracks()->getTrackIndex(this); | 376 m_trackList->getTrackIndex(this); |
acolwell GONE FROM CHROMIUM
2013/12/06 01:35:54
I think you are missing the 'm_trackIndex =' here.
| |
384 | 377 |
385 return m_trackIndex; | 378 return m_trackIndex; |
386 } | 379 } |
387 | 380 |
388 void TextTrack::invalidateTrackIndex() | 381 void TextTrack::invalidateTrackIndex() |
389 { | 382 { |
390 m_trackIndex = invalidTrackIndex; | 383 m_trackIndex = invalidTrackIndex; |
391 m_renderedTrackIndex = invalidTrackIndex; | 384 m_renderedTrackIndex = invalidTrackIndex; |
392 } | 385 } |
393 | 386 |
394 bool TextTrack::isRendered() | 387 bool TextTrack::isRendered() |
395 { | 388 { |
396 if (m_kind != captionsKeyword() && m_kind != subtitlesKeyword()) | 389 if (kind() != captionsKeyword() && kind() != subtitlesKeyword()) |
397 return false; | 390 return false; |
398 | 391 |
399 if (m_mode != showingKeyword()) | 392 if (kind() != showingKeyword()) |
400 return false; | 393 return false; |
401 | 394 |
402 return true; | 395 return true; |
403 } | 396 } |
404 | 397 |
405 TextTrackCueList* TextTrack::ensureTextTrackCueList() | 398 TextTrackCueList* TextTrack::ensureTextTrackCueList() |
406 { | 399 { |
407 if (!m_cues) | 400 if (!m_cues) |
408 m_cues = TextTrackCueList::create(); | 401 m_cues = TextTrackCueList::create(); |
409 | 402 |
410 return m_cues.get(); | 403 return m_cues.get(); |
411 } | 404 } |
412 | 405 |
413 int TextTrack::trackIndexRelativeToRenderedTracks() | 406 int TextTrack::trackIndexRelativeToRenderedTracks() |
414 { | 407 { |
415 ASSERT(m_mediaElement); | 408 ASSERT(m_trackList); |
416 | 409 |
417 if (m_renderedTrackIndex == invalidTrackIndex) | 410 if (m_renderedTrackIndex == invalidTrackIndex) |
418 m_renderedTrackIndex = m_mediaElement->textTracks()->getTrackIndexRelati veToRenderedTracks(this); | 411 m_renderedTrackIndex = m_trackList->getTrackIndexRelativeToRenderedTrack s(this); |
419 | 412 |
420 return m_renderedTrackIndex; | 413 return m_renderedTrackIndex; |
421 } | 414 } |
422 | 415 |
423 const AtomicString& TextTrack::interfaceName() const | 416 const AtomicString& TextTrack::interfaceName() const |
424 { | 417 { |
425 return EventTargetNames::TextTrack; | 418 return EventTargetNames::TextTrack; |
426 } | 419 } |
427 | 420 |
428 ExecutionContext* TextTrack::executionContext() const | 421 ExecutionContext* TextTrack::executionContext() const |
429 { | 422 { |
430 return m_document; | 423 return m_document; |
431 } | 424 } |
432 | 425 |
433 } // namespace WebCore | 426 } // namespace WebCore |
434 | 427 |
OLD | NEW |