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

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

Issue 910843002: Hoist checks for 'disabled' tracks out of textTrackAddCue{,s} (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Missed a spot. Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/html/track/LoadableTextTrack.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 // 1. If the given cue is in a text track list of cues, then remove cue from that text track 240 // 1. If the given cue is in a text track list of cues, then remove cue from that text track
241 // list of cues. 241 // list of cues.
242 TextTrack* cueTrack = cue->track(); 242 TextTrack* cueTrack = cue->track();
243 if (cueTrack && cueTrack != this) 243 if (cueTrack && cueTrack != this)
244 cueTrack->removeCue(cue.get(), ASSERT_NO_EXCEPTION); 244 cueTrack->removeCue(cue.get(), ASSERT_NO_EXCEPTION);
245 245
246 // 2. Add cue to the method's TextTrack object's text track's text track lis t of cues. 246 // 2. Add cue to the method's TextTrack object's text track's text track lis t of cues.
247 cue->setTrack(this); 247 cue->setTrack(this);
248 ensureTextTrackCueList()->add(cue); 248 ensureTextTrackCueList()->add(cue);
249 249
250 if (mediaElement()) 250 if (mediaElement() && m_mode != disabledKeyword())
251 mediaElement()->textTrackAddCue(this, cue.get()); 251 mediaElement()->textTrackAddCue(this, cue.get());
252 } 252 }
253 253
254 void TextTrack::removeCue(TextTrackCue* cue, ExceptionState& exceptionState) 254 void TextTrack::removeCue(TextTrackCue* cue, ExceptionState& exceptionState)
255 { 255 {
256 if (!cue) 256 if (!cue)
257 return; 257 return;
258 258
259 // 4.8.10.12.5 Text track API 259 // 4.8.10.12.5 Text track API
260 260
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 } 360 }
361 361
362 void TextTrack::cueDidChange(TextTrackCue* cue) 362 void TextTrack::cueDidChange(TextTrackCue* cue)
363 { 363 {
364 if (!mediaElement()) 364 if (!mediaElement())
365 return; 365 return;
366 366
367 // Make sure the TextTrackCueList order is up-to-date. 367 // Make sure the TextTrackCueList order is up-to-date.
368 ensureTextTrackCueList()->updateCueIndex(cue); 368 ensureTextTrackCueList()->updateCueIndex(cue);
369 369
370 // ... and add it back again. 370 // ... and add it back again if the track is enabled.
371 if (m_mode == disabledKeyword())
372 return;
373
371 mediaElement()->textTrackAddCue(this, cue); 374 mediaElement()->textTrackAddCue(this, cue);
372 } 375 }
373 376
374 int TextTrack::trackIndex() 377 int TextTrack::trackIndex()
375 { 378 {
376 ASSERT(m_trackList); 379 ASSERT(m_trackList);
377 380
378 if (m_trackIndex == invalidTrackIndex) 381 if (m_trackIndex == invalidTrackIndex)
379 m_trackIndex = m_trackList->getTrackIndex(this); 382 m_trackIndex = m_trackList->getTrackIndex(this);
380 383
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 void TextTrack::trace(Visitor* visitor) 443 void TextTrack::trace(Visitor* visitor)
441 { 444 {
442 visitor->trace(m_cues); 445 visitor->trace(m_cues);
443 visitor->trace(m_regions); 446 visitor->trace(m_regions);
444 visitor->trace(m_trackList); 447 visitor->trace(m_trackList);
445 TrackBase::trace(visitor); 448 TrackBase::trace(visitor);
446 EventTargetWithInlineData::trace(visitor); 449 EventTargetWithInlineData::trace(visitor);
447 } 450 }
448 451
449 } // namespace blink 452 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/html/track/LoadableTextTrack.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698