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

Unified Diff: Source/core/html/track/TextTrack.cpp

Issue 960233002: Eliminate calls to TextTrackCue::setIsActive outside of CueTimeline (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/html/track/TextTrackCueList.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/track/TextTrack.cpp
diff --git a/Source/core/html/track/TextTrack.cpp b/Source/core/html/track/TextTrack.cpp
index c8235136bc6abc80dcfec5edb144b3bb7dd3a67f..a1d03bf330488f75bc32eef1f584df5026adbced 100644
--- a/Source/core/html/track/TextTrack.cpp
+++ b/Source/core/html/track/TextTrack.cpp
@@ -289,10 +289,11 @@ void TextTrack::removeCue(TextTrackCue* cue, ExceptionState& exceptionState)
return;
}
- cue->setIsActive(false);
- cue->removeDisplayTree();
+ // If the cue is active, a timeline needs to be available.
+ ASSERT(!cue->isActive() || cueTimeline());
cue->setTrack(0);
+
if (cueTimeline())
cueTimeline()->removeCue(this, cue);
}
@@ -370,27 +371,29 @@ void TextTrack::removeRegion(VTTRegion* region, ExceptionState &exceptionState)
void TextTrack::cueWillChange(TextTrackCue* cue)
{
- if (!cueTimeline())
- return;
-
// The cue may need to be repositioned in the media element's interval tree, may need to
// be re-rendered, etc, so remove it before the modification...
- cueTimeline()->removeCue(this, cue);
+ if (cueTimeline())
+ cueTimeline()->removeCue(this, cue);
}
void TextTrack::cueDidChange(TextTrackCue* cue)
{
- if (!cueTimeline())
- return;
-
// Make sure the TextTrackCueList order is up-to-date.
+ // FIXME: Only need to do this if the change was to any of the timestamps.
ensureTextTrackCueList()->updateCueIndex(cue);
- // ... and add it back again if the track is enabled.
+ // Since a call to cueDidChange is always preceded by a call to
+ // cueWillChange, the cue should no longer be active when we reach this
+ // point (since it was removed from the timeline in cueWillChange).
+ ASSERT(!cue->isActive());
+
if (m_mode == disabledKeyword())
return;
- cueTimeline()->addCue(this, cue);
+ // ... and add it back again if the track is enabled.
+ if (cueTimeline())
+ cueTimeline()->addCue(this, cue);
}
int TextTrack::trackIndex()
« no previous file with comments | « no previous file | Source/core/html/track/TextTrackCueList.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698