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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 if (cueData->line() > 0) | 155 if (cueData->line() > 0) |
156 cue->setLine(lround(cueData->line()), IGNORE_EXCEPTION); | 156 cue->setLine(lround(cueData->line()), IGNORE_EXCEPTION); |
157 if (cueData->size() > 0) | 157 if (cueData->size() > 0) |
158 cue->setSize(lround(cueData->size()), IGNORE_EXCEPTION); | 158 cue->setSize(lround(cueData->size()), IGNORE_EXCEPTION); |
159 if (cueData->backgroundColor().alpha()) | 159 if (cueData->backgroundColor().alpha()) |
160 cue->setBackgroundColor(cueData->backgroundColor().rgb()); | 160 cue->setBackgroundColor(cueData->backgroundColor().rgb()); |
161 if (cueData->foregroundColor().alpha()) | 161 if (cueData->foregroundColor().alpha()) |
162 cue->setForegroundColor(cueData->foregroundColor().rgb()); | 162 cue->setForegroundColor(cueData->foregroundColor().rgb()); |
163 | 163 |
164 if (cueData->align() == GenericCueData::Start) | 164 if (cueData->align() == GenericCueData::Start) |
165 cue->setAlign(ASCIILiteral("start"), IGNORE_EXCEPTION); | 165 cue->setAlign("start", IGNORE_EXCEPTION); |
166 else if (cueData->align() == GenericCueData::Middle) | 166 else if (cueData->align() == GenericCueData::Middle) |
167 cue->setAlign(ASCIILiteral("middle"), IGNORE_EXCEPTION); | 167 cue->setAlign("middle", IGNORE_EXCEPTION); |
168 else if (cueData->align() == GenericCueData::End) | 168 else if (cueData->align() == GenericCueData::End) |
169 cue->setAlign(ASCIILiteral("end"), IGNORE_EXCEPTION); | 169 cue->setAlign("end", IGNORE_EXCEPTION); |
170 cue->setSnapToLines(false); | 170 cue->setSnapToLines(false); |
171 | 171 |
172 if (hasCue(cue.get())) { | 172 if (hasCue(cue.get())) { |
173 LOG(Media, "InbandTextTrack::addGenericCue ignoring already added cue: s
tart=%.2f, end=%.2f, content=\"%s\"\n", | 173 LOG(Media, "InbandTextTrack::addGenericCue ignoring already added cue: s
tart=%.2f, end=%.2f, content=\"%s\"\n", |
174 cueData->startTime(), cueData->endTime(), cueData->content().utf8().
data()); | 174 cueData->startTime(), cueData->endTime(), cueData->content().utf8().
data()); |
175 return; | 175 return; |
176 } | 176 } |
177 | 177 |
178 addCue(cue); | 178 addCue(cue); |
179 } | 179 } |
180 | 180 |
181 void InbandTextTrack::addWebVTTCue(InbandTextTrackPrivate* trackPrivate, double
start, double end, const String& id, const String& content, const String& settin
gs) | 181 void InbandTextTrack::addWebVTTCue(InbandTextTrackPrivate* trackPrivate, double
start, double end, const String& id, const String& content, const String& settin
gs) |
182 { | 182 { |
183 UNUSED_PARAM(trackPrivate); | 183 UNUSED_PARAM(trackPrivate); |
184 ASSERT(trackPrivate == m_private); | 184 ASSERT(trackPrivate == m_private); |
185 | 185 |
186 RefPtr<TextTrackCue> cue = TextTrackCue::create(scriptExecutionContext(), st
art, end, content); | 186 RefPtr<TextTrackCue> cue = TextTrackCue::create(scriptExecutionContext(), st
art, end, content); |
187 cue->setId(id); | 187 cue->setId(id); |
188 cue->setCueSettings(settings); | 188 cue->setCueSettings(settings); |
189 | 189 |
190 if (hasCue(cue.get())) | 190 if (hasCue(cue.get())) |
191 return; | 191 return; |
192 | 192 |
193 addCue(cue); | 193 addCue(cue); |
194 } | 194 } |
195 | 195 |
196 } // namespace WebCore | 196 } // namespace WebCore |
OLD | NEW |