Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: Source/core/html/track/TextTrack.cpp

Issue 244493002: Oilpan: add transition types to track interface objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add missing tracing to HTMLTrackElement. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 const AtomicString& TextTrack::showingKeyword() 92 const AtomicString& TextTrack::showingKeyword()
93 { 93 {
94 DEFINE_STATIC_LOCAL(const AtomicString, ended, ("showing", AtomicString::Con structFromLiteral)); 94 DEFINE_STATIC_LOCAL(const AtomicString, ended, ("showing", AtomicString::Con structFromLiteral));
95 return ended; 95 return ended;
96 } 96 }
97 97
98 TextTrack::TextTrack(Document& document, const AtomicString& kind, const AtomicS tring& label, const AtomicString& language, const AtomicString& id, TextTrackTyp e type) 98 TextTrack::TextTrack(Document& document, const AtomicString& kind, const AtomicS tring& label, const AtomicString& language, const AtomicString& id, TextTrackTyp e type)
99 : TrackBase(TrackBase::TextTrack, label, language, id) 99 : TrackBase(TrackBase::TextTrack, label, language, id)
100 , m_cues(nullptr) 100 , m_cues(nullptr)
101 , m_regions(nullptr) 101 , m_regions(nullptr)
102 , m_document(&document) 102 , m_trackList(nullptr)
103 , m_trackList(0)
104 , m_mode(disabledKeyword()) 103 , m_mode(disabledKeyword())
105 , m_trackType(type) 104 , m_trackType(type)
106 , m_readinessState(NotLoaded) 105 , m_readinessState(NotLoaded)
107 , m_trackIndex(invalidTrackIndex) 106 , m_trackIndex(invalidTrackIndex)
108 , m_renderedTrackIndex(invalidTrackIndex) 107 , m_renderedTrackIndex(invalidTrackIndex)
109 , m_hasBeenConfigured(false) 108 , m_hasBeenConfigured(false)
110 { 109 {
111 ScriptWrappable::init(this); 110 ScriptWrappable::init(this);
112 setKind(kind); 111 setKind(kind);
113 } 112 }
114 113
115 TextTrack::~TextTrack() 114 TextTrack::~TextTrack()
116 { 115 {
117 ASSERT(!m_trackList);
Mads Ager (chromium) 2014/04/22 13:07:15 #if !ENABLE(OILPAN) instead of deleting?
118
119 if (m_cues) {
120 for (size_t i = 0; i < m_cues->length(); ++i)
121 m_cues->item(i)->setTrack(0);
122 }
123
124 if (m_regions) {
125 for (size_t i = 0; i < m_regions->length(); ++i)
126 m_regions->item(i)->setTrack(0);
127 }
128 } 116 }
129 117
130 bool TextTrack::isValidKindKeyword(const AtomicString& value) 118 bool TextTrack::isValidKindKeyword(const AtomicString& value)
131 { 119 {
132 if (value == subtitlesKeyword()) 120 if (value == subtitlesKeyword())
133 return true; 121 return true;
134 if (value == captionsKeyword()) 122 if (value == captionsKeyword())
135 return true; 123 return true;
136 if (value == descriptionsKeyword()) 124 if (value == descriptionsKeyword())
137 return true; 125 return true;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 // then the activeCues attribute must return a live TextTrackCueList object ... 205 // then the activeCues attribute must return a live TextTrackCueList object ...
218 // ... whose active flag was set when the script started, in text track cue 206 // ... whose active flag was set when the script started, in text track cue
219 // order. Otherwise, it must return null. When an object is returned, the 207 // order. Otherwise, it must return null. When an object is returned, the
220 // same object must be returned each time. 208 // same object must be returned each time.
221 // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-activecu es 209 // http://www.whatwg.org/specs/web-apps/current-work/#dom-texttrack-activecu es
222 if (m_cues && m_mode != disabledKeyword()) 210 if (m_cues && m_mode != disabledKeyword())
223 return m_cues->activeCues(); 211 return m_cues->activeCues();
224 return 0; 212 return 0;
225 } 213 }
226 214
227 void TextTrack::addCue(PassRefPtr<TextTrackCue> prpCue) 215 void TextTrack::addCue(PassRefPtrWillBeRawPtr<TextTrackCue> prpCue)
228 { 216 {
229 if (!prpCue) 217 if (!prpCue)
230 return; 218 return;
231 219
232 RefPtr<TextTrackCue> cue = prpCue; 220 RefPtrWillBeRawPtr<TextTrackCue> cue = prpCue;
233 221
234 // TODO(93143): Add spec-compliant behavior for negative time values. 222 // TODO(93143): Add spec-compliant behavior for negative time values.
235 if (std::isnan(cue->startTime()) || std::isnan(cue->endTime()) || cue->start Time() < 0 || cue->endTime() < 0) 223 if (std::isnan(cue->startTime()) || std::isnan(cue->endTime()) || cue->start Time() < 0 || cue->endTime() < 0)
236 return; 224 return;
237 225
238 // 4.8.10.12.5 Text track API 226 // 4.8.10.12.5 Text track API
239 227
240 // The addCue(cue) method of TextTrack objects, when invoked, must run the f ollowing steps: 228 // The addCue(cue) method of TextTrack objects, when invoked, must run the f ollowing steps:
241 229
242 // 1. If the given cue is in a text track list of cues, then remove cue from that text track 230 // 1. If the given cue is in a text track list of cues, then remove cue from that text track
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 // represents is not the text track disabled mode, then the regions 282 // represents is not the text track disabled mode, then the regions
295 // attribute must return a live VTTRegionList object that represents 283 // attribute must return a live VTTRegionList object that represents
296 // the text track list of regions of the text track. Otherwise, it must 284 // the text track list of regions of the text track. Otherwise, it must
297 // return null. When an object is returned, the same object must be returned 285 // return null. When an object is returned, the same object must be returned
298 // each time. 286 // each time.
299 if (RuntimeEnabledFeatures::webVTTRegionsEnabled() && m_mode != disabledKeyw ord()) 287 if (RuntimeEnabledFeatures::webVTTRegionsEnabled() && m_mode != disabledKeyw ord())
300 return ensureVTTRegionList(); 288 return ensureVTTRegionList();
301 return 0; 289 return 0;
302 } 290 }
303 291
304 void TextTrack::addRegion(PassRefPtr<VTTRegion> prpRegion) 292 void TextTrack::addRegion(PassRefPtrWillBeRawPtr<VTTRegion> prpRegion)
305 { 293 {
306 if (!prpRegion) 294 if (!prpRegion)
307 return; 295 return;
308 296
309 RefPtr<VTTRegion> region = prpRegion; 297 RefPtrWillBeRawPtr<VTTRegion> region = prpRegion;
310 VTTRegionList* regionList = ensureVTTRegionList(); 298 VTTRegionList* regionList = ensureVTTRegionList();
311 299
312 // 1. If the given region is in a text track list of regions, then remove 300 // 1. If the given region is in a text track list of regions, then remove
313 // region from that text track list of regions. 301 // region from that text track list of regions.
314 TextTrack* regionTrack = region->track(); 302 TextTrack* regionTrack = region->track();
315 if (regionTrack && regionTrack != this) 303 if (regionTrack && regionTrack != this)
316 regionTrack->removeRegion(region.get(), ASSERT_NO_EXCEPTION); 304 regionTrack->removeRegion(region.get(), ASSERT_NO_EXCEPTION);
317 305
318 // 2. If the method's TextTrack object's text track list of regions contains 306 // 2. If the method's TextTrack object's text track list of regions contains
319 // a region with the same identifier as region replace the values of that 307 // a region with the same identifier as region replace the values of that
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 return m_renderedTrackIndex; 406 return m_renderedTrackIndex;
419 } 407 }
420 408
421 const AtomicString& TextTrack::interfaceName() const 409 const AtomicString& TextTrack::interfaceName() const
422 { 410 {
423 return EventTargetNames::TextTrack; 411 return EventTargetNames::TextTrack;
424 } 412 }
425 413
426 ExecutionContext* TextTrack::executionContext() const 414 ExecutionContext* TextTrack::executionContext() const
427 { 415 {
428 return m_document; 416 HTMLMediaElement* owner = mediaElement();
417 return owner ? owner->executionContext() : 0;
429 } 418 }
430 419
431 HTMLMediaElement* TextTrack::mediaElement() const 420 HTMLMediaElement* TextTrack::mediaElement() const
432 { 421 {
433 return m_trackList ? m_trackList->owner() : 0; 422 return m_trackList ? m_trackList->owner() : 0;
434 } 423 }
435 424
436 Node* TextTrack::owner() const 425 Node* TextTrack::owner() const
437 { 426 {
438 return mediaElement(); 427 return mediaElement();
439 } 428 }
440 429
430 void TextTrack::trace(Visitor* visitor)
431 {
432 visitor->trace(m_cues);
433 visitor->trace(m_regions);
434 visitor->trace(m_trackList);
435 TrackBase::trace(visitor);
436 }
437
441 } // namespace WebCore 438 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698