| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "platform/Logging.h" | 31 #include "platform/Logging.h" |
| 32 #include "public/platform/WebInbandTextTrack.h" | 32 #include "public/platform/WebInbandTextTrack.h" |
| 33 #include "public/platform/WebString.h" | 33 #include "public/platform/WebString.h" |
| 34 #include <math.h> | 34 #include <math.h> |
| 35 | 35 |
| 36 using blink::WebInbandTextTrack; | 36 using blink::WebInbandTextTrack; |
| 37 using blink::WebString; | 37 using blink::WebString; |
| 38 | 38 |
| 39 namespace WebCore { | 39 namespace WebCore { |
| 40 | 40 |
| 41 PassRefPtr<InbandTextTrack> InbandTextTrack::create(Document& document, TextTrac
kClient* client, WebInbandTextTrack* webTrack) | 41 PassRefPtr<InbandTextTrack> InbandTextTrack::create(Document& document, WebInban
dTextTrack* webTrack) |
| 42 { | 42 { |
| 43 return adoptRef(new InbandTextTrack(document, client, webTrack)); | 43 return adoptRef(new InbandTextTrack(document, webTrack)); |
| 44 } | 44 } |
| 45 | 45 |
| 46 InbandTextTrack::InbandTextTrack(Document& document, TextTrackClient* client, We
bInbandTextTrack* webTrack) | 46 InbandTextTrack::InbandTextTrack(Document& document, WebInbandTextTrack* webTrac
k) |
| 47 : TextTrack(document, client, emptyAtom, webTrack->label(), webTrack->langua
ge(), webTrack->id(), InBand) | 47 : TextTrack(document, emptyAtom, webTrack->label(), webTrack->language(), we
bTrack->id(), InBand) |
| 48 , m_webTrack(webTrack) | 48 , m_webTrack(webTrack) |
| 49 { | 49 { |
| 50 m_webTrack->setClient(this); | 50 m_webTrack->setClient(this); |
| 51 | 51 |
| 52 switch (m_webTrack->kind()) { | 52 switch (m_webTrack->kind()) { |
| 53 case WebInbandTextTrack::KindSubtitles: | 53 case WebInbandTextTrack::KindSubtitles: |
| 54 setKind(TextTrack::subtitlesKeyword()); | 54 setKind(TextTrack::subtitlesKeyword()); |
| 55 break; | 55 break; |
| 56 case WebInbandTextTrack::KindCaptions: | 56 case WebInbandTextTrack::KindCaptions: |
| 57 setKind(TextTrack::captionsKeyword()); | 57 setKind(TextTrack::captionsKeyword()); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 86 | 86 |
| 87 void InbandTextTrack::setTrackList(TextTrackList* trackList) | 87 void InbandTextTrack::setTrackList(TextTrackList* trackList) |
| 88 { | 88 { |
| 89 TextTrack::setTrackList(trackList); | 89 TextTrack::setTrackList(trackList); |
| 90 if (trackList) | 90 if (trackList) |
| 91 return; | 91 return; |
| 92 | 92 |
| 93 ASSERT(m_webTrack); | 93 ASSERT(m_webTrack); |
| 94 m_webTrack->setClient(0); | 94 m_webTrack->setClient(0); |
| 95 m_webTrack = 0; | 95 m_webTrack = 0; |
| 96 clearClient(); | |
| 97 } | 96 } |
| 98 | 97 |
| 99 void InbandTextTrack::addWebVTTCue(double start, double end, const WebString& id
, const WebString& content, const WebString& settings) | 98 void InbandTextTrack::addWebVTTCue(double start, double end, const WebString& id
, const WebString& content, const WebString& settings) |
| 100 { | 99 { |
| 101 RefPtr<VTTCue> cue = VTTCue::create(document(), start, end, content); | 100 RefPtr<VTTCue> cue = VTTCue::create(document(), start, end, content); |
| 102 cue->setId(id); | 101 cue->setId(id); |
| 103 cue->parseSettings(settings); | 102 cue->parseSettings(settings); |
| 104 addCue(cue); | 103 addCue(cue); |
| 105 } | 104 } |
| 106 | 105 |
| 107 } // namespace WebCore | 106 } // namespace WebCore |
| OLD | NEW |