OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 break; | 68 break; |
69 } | 69 } |
70 } | 70 } |
71 | 71 |
72 InbandTextTrack::~InbandTextTrack() | 72 InbandTextTrack::~InbandTextTrack() |
73 { | 73 { |
74 // Make sure m_private was cleared by trackRemoved() before destruction. | 74 // Make sure m_private was cleared by trackRemoved() before destruction. |
75 ASSERT(!m_private); | 75 ASSERT(!m_private); |
76 } | 76 } |
77 | 77 |
78 void InbandTextTrack::setMode(const AtomicString& mode) | |
79 { | |
80 TextTrack::setMode(mode); | |
81 | |
82 if (!m_private) | |
83 return; | |
84 | |
85 if (mode == TextTrack::disabledKeyword()) | |
86 m_private->setMode(InbandTextTrackPrivate::Disabled); | |
87 else if (mode == TextTrack::hiddenKeyword()) | |
88 m_private->setMode(InbandTextTrackPrivate::Hidden); | |
89 else if (mode == TextTrack::showingKeyword()) | |
90 m_private->setMode(InbandTextTrackPrivate::Showing); | |
91 else | |
92 ASSERT_NOT_REACHED(); | |
93 } | |
94 | |
95 size_t InbandTextTrack::inbandTrackIndex() | 78 size_t InbandTextTrack::inbandTrackIndex() |
96 { | 79 { |
97 ASSERT(m_private); | 80 ASSERT(m_private); |
98 return m_private->textTrackIndex(); | 81 return m_private->textTrackIndex(); |
99 } | 82 } |
100 | 83 |
101 void InbandTextTrack::trackRemoved() | 84 void InbandTextTrack::trackRemoved() |
102 { | 85 { |
103 ASSERT(m_private); | 86 ASSERT(m_private); |
104 m_private->setClient(0); | 87 m_private->setClient(0); |
105 m_private = 0; | 88 m_private = 0; |
106 clearClient(); | 89 clearClient(); |
107 } | 90 } |
108 | 91 |
109 void InbandTextTrack::addWebVTTCue(InbandTextTrackPrivate* trackPrivate, double
start, double end, const String& id, const String& content, const String& settin
gs) | 92 void InbandTextTrack::addWebVTTCue(InbandTextTrackPrivate* trackPrivate, double
start, double end, const String& id, const String& content, const String& settin
gs) |
110 { | 93 { |
111 ASSERT_UNUSED(trackPrivate, trackPrivate == m_private); | 94 ASSERT_UNUSED(trackPrivate, trackPrivate == m_private); |
112 | 95 |
113 RefPtr<TextTrackCue> cue = TextTrackCue::create(document(), start, end, cont
ent); | 96 RefPtr<TextTrackCue> cue = TextTrackCue::create(document(), start, end, cont
ent); |
114 cue->setId(id); | 97 cue->setId(id); |
115 cue->setCueSettings(settings); | 98 cue->setCueSettings(settings); |
116 | 99 |
117 if (hasCue(cue.get())) | 100 if (hasCue(cue.get())) |
118 return; | 101 return; |
119 | 102 |
120 addCue(cue); | 103 addCue(cue); |
121 } | 104 } |
122 | 105 |
123 } // namespace WebCore | 106 } // namespace WebCore |
OLD | NEW |