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

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

Issue 92783002: Move code that applies to audio and video tracks into TrackBase. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@tmp
Patch Set: Fix copyright, explicit constructor, and AtomicString oldKind, and replace mediaElement() with trac… Created 7 years, 1 month 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
Index: Source/core/html/track/TextTrack.cpp
diff --git a/Source/core/html/track/TextTrack.cpp b/Source/core/html/track/TextTrack.cpp
index 460b90a7108581db694a8b6d428e0c18a2c90674..414765d5ec75cbb822b73b0a1b6a86188f63f99d 100644
--- a/Source/core/html/track/TextTrack.cpp
+++ b/Source/core/html/track/TextTrack.cpp
@@ -97,14 +97,11 @@ const AtomicString& TextTrack::showingKeyword()
}
TextTrack::TextTrack(Document& document, TextTrackClient* client, const AtomicString& kind, const AtomicString& label, const AtomicString& language, const AtomicString& id, TextTrackType type)
- : TrackBase(TrackBase::TextTrack)
+ : TrackBase(TrackBase::TextTrack, label, language, id)
, m_cues(0)
, m_regions(0)
, m_document(&document)
- , m_mediaElement(0)
- , m_label(label)
- , m_language(language)
- , m_id(id)
+ , m_trackList(0)
, m_mode(disabledKeyword())
, m_client(client)
, m_trackType(type)
@@ -150,16 +147,12 @@ bool TextTrack::isValidKindKeyword(const AtomicString& value)
return false;
}
-void TextTrack::setKind(const AtomicString& kind)
+void TextTrack::setKind(const AtomicString& newKind)
{
- String oldKind = m_kind;
+ AtomicString oldKind = kind();
+ TrackBase::setKind(newKind);
- if (isValidKindKeyword(kind))
- m_kind = kind;
- else
- m_kind = subtitlesKeyword();
-
- if (m_client && oldKind != m_kind)
+ if (m_client && oldKind != kind())
m_client->textTrackKindChanged(this);
}
@@ -377,10 +370,10 @@ void TextTrack::cueDidChange(TextTrackCue* cue)
int TextTrack::trackIndex()
{
- ASSERT(m_mediaElement);
+ ASSERT(m_trackList);
if (m_trackIndex == invalidTrackIndex)
- m_trackIndex = m_mediaElement->textTracks()->getTrackIndex(this);
+ m_trackList->getTrackIndex(this);
acolwell GONE FROM CHROMIUM 2013/12/06 01:35:54 I think you are missing the 'm_trackIndex =' here.
return m_trackIndex;
}
@@ -393,10 +386,10 @@ void TextTrack::invalidateTrackIndex()
bool TextTrack::isRendered()
{
- if (m_kind != captionsKeyword() && m_kind != subtitlesKeyword())
+ if (kind() != captionsKeyword() && kind() != subtitlesKeyword())
return false;
- if (m_mode != showingKeyword())
+ if (kind() != showingKeyword())
return false;
return true;
@@ -412,10 +405,10 @@ TextTrackCueList* TextTrack::ensureTextTrackCueList()
int TextTrack::trackIndexRelativeToRenderedTracks()
{
- ASSERT(m_mediaElement);
+ ASSERT(m_trackList);
if (m_renderedTrackIndex == invalidTrackIndex)
- m_renderedTrackIndex = m_mediaElement->textTracks()->getTrackIndexRelativeToRenderedTracks(this);
+ m_renderedTrackIndex = m_trackList->getTrackIndexRelativeToRenderedTracks(this);
return m_renderedTrackIndex;
}

Powered by Google App Engine
This is Rietveld 408576698