OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google 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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 String HTMLTrackElement::kind() | 117 String HTMLTrackElement::kind() |
118 { | 118 { |
119 return track()->kind(); | 119 return track()->kind(); |
120 } | 120 } |
121 | 121 |
122 void HTMLTrackElement::setKind(const String& kind) | 122 void HTMLTrackElement::setKind(const String& kind) |
123 { | 123 { |
124 setAttribute(kindAttr, kind); | 124 setAttribute(kindAttr, kind); |
125 } | 125 } |
126 | 126 |
127 String HTMLTrackElement::srclang() const | |
128 { | |
129 return getAttribute(srclangAttr); | |
130 } | |
131 | |
132 void HTMLTrackElement::setSrclang(const String& srclang) | |
133 { | |
134 setAttribute(srclangAttr, srclang); | |
135 } | |
136 | |
137 String HTMLTrackElement::label() const | |
138 { | |
139 return getAttribute(labelAttr); | |
140 } | |
141 | |
142 void HTMLTrackElement::setLabel(const String& label) | |
143 { | |
144 setAttribute(labelAttr, label); | |
145 } | |
146 | |
147 LoadableTextTrack* HTMLTrackElement::ensureTrack() | 127 LoadableTextTrack* HTMLTrackElement::ensureTrack() |
148 { | 128 { |
149 if (!m_track) { | 129 if (!m_track) { |
150 // The kind attribute is an enumerated attribute, limited only to know v
alues. It defaults to 'subtitles' if missing or invalid. | 130 // kind, label and language are updated by parseAttribute |
151 String kind = getAttribute(kindAttr).lower(); | 131 m_track = LoadableTextTrack::create(this); |
152 if (!TextTrack::isValidKindKeyword(kind)) | |
153 kind = TextTrack::subtitlesKeyword(); | |
154 m_track = LoadableTextTrack::create(this, kind, label(), srclang()); | |
155 } | 132 } |
156 return m_track.get(); | 133 return m_track.get(); |
157 } | 134 } |
158 | 135 |
159 TextTrack* HTMLTrackElement::track() | 136 TextTrack* HTMLTrackElement::track() |
160 { | 137 { |
161 return ensureTrack(); | 138 return ensureTrack(); |
162 } | 139 } |
163 | 140 |
164 bool HTMLTrackElement::isURLAttribute(const Attribute& attribute) const | 141 bool HTMLTrackElement::isURLAttribute(const Attribute& attribute) const |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 HTMLMediaElement* HTMLTrackElement::mediaElement() const | 306 HTMLMediaElement* HTMLTrackElement::mediaElement() const |
330 { | 307 { |
331 Element* parent = parentElement(); | 308 Element* parent = parentElement(); |
332 if (parent && parent->isMediaElement()) | 309 if (parent && parent->isMediaElement()) |
333 return toHTMLMediaElement(parentNode()); | 310 return toHTMLMediaElement(parentNode()); |
334 return 0; | 311 return 0; |
335 } | 312 } |
336 | 313 |
337 } | 314 } |
338 | 315 |
OLD | NEW |