This source file includes following definitions.
- create
- m_webTrack
- inbandTrackIndex
- setTrackList
- addWebVTTCue
#include "config.h"
#include "core/html/track/InbandTextTrack.h"
#include "bindings/v8/ExceptionStatePlaceholder.h"
#include "core/html/track/vtt/VTTCue.h"
#include "platform/Logging.h"
#include "public/platform/WebInbandTextTrack.h"
#include "public/platform/WebString.h"
#include <math.h>
using blink::WebInbandTextTrack;
using blink::WebString;
namespace WebCore {
PassRefPtr<InbandTextTrack> InbandTextTrack::create(Document& document, WebInbandTextTrack* webTrack)
{
return adoptRef(new InbandTextTrack(document, webTrack));
}
InbandTextTrack::InbandTextTrack(Document& document, WebInbandTextTrack* webTrack)
: TextTrack(document, emptyAtom, webTrack->label(), webTrack->language(), webTrack->id(), InBand)
, m_webTrack(webTrack)
{
m_webTrack->setClient(this);
switch (m_webTrack->kind()) {
case WebInbandTextTrack::KindSubtitles:
setKind(TextTrack::subtitlesKeyword());
break;
case WebInbandTextTrack::KindCaptions:
setKind(TextTrack::captionsKeyword());
break;
case WebInbandTextTrack::KindDescriptions:
setKind(TextTrack::descriptionsKeyword());
break;
case WebInbandTextTrack::KindChapters:
setKind(TextTrack::chaptersKeyword());
break;
case WebInbandTextTrack::KindMetadata:
setKind(TextTrack::metadataKeyword());
break;
case WebInbandTextTrack::KindNone:
default:
ASSERT_NOT_REACHED();
break;
}
}
InbandTextTrack::~InbandTextTrack()
{
ASSERT(!m_webTrack);
}
size_t InbandTextTrack::inbandTrackIndex()
{
ASSERT(m_webTrack);
return m_webTrack->textTrackIndex();
}
void InbandTextTrack::setTrackList(TextTrackList* trackList)
{
TextTrack::setTrackList(trackList);
if (trackList)
return;
ASSERT(m_webTrack);
m_webTrack->setClient(0);
m_webTrack = 0;
}
void InbandTextTrack::addWebVTTCue(double start, double end, const WebString& id, const WebString& content, const WebString& settings)
{
RefPtr<VTTCue> cue = VTTCue::create(document(), start, end, content);
cue->setId(id);
cue->parseSettings(settings);
addCue(cue);
}
}