OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2013, Opera Software ASA. All rights reserved. | 2 * Copyright (c) 2013, Opera Software ASA. 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 DEFINE_STATIC_LOCAL(const String, verticalrl, ("rl")); | 106 DEFINE_STATIC_LOCAL(const String, verticalrl, ("rl")); |
107 return verticalrl; | 107 return verticalrl; |
108 } | 108 } |
109 | 109 |
110 static const String& verticalGrowingRightKeyword() | 110 static const String& verticalGrowingRightKeyword() |
111 { | 111 { |
112 DEFINE_STATIC_LOCAL(const String, verticallr, ("lr")); | 112 DEFINE_STATIC_LOCAL(const String, verticallr, ("lr")); |
113 return verticallr; | 113 return verticallr; |
114 } | 114 } |
115 | 115 |
116 static bool isInvalidPercentage(double value, const char* method, ExceptionState
& exceptionState) | 116 static bool isInvalidPercentage(double value, ExceptionState& exceptionState) |
117 { | 117 { |
118 if (TextTrackCue::isInfiniteOrNonNumber(value, method, exceptionState)) | 118 if (TextTrackCue::isInfiniteOrNonNumber(value, exceptionState)) |
119 return true; | 119 return true; |
120 if (value < 0 || value > 100) { | 120 if (value < 0 || value > 100) { |
121 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::fail
edToSet(method, "TextTrackCue", "The value provided (" + String::number(value) +
") is not between 0 and 100.")); | 121 exceptionState.throwDOMException(IndexSizeError, "The value provided ("
+ String::number(value) + ") is not between 0 and 100."); |
122 return true; | 122 return true; |
123 } | 123 } |
124 return false; | 124 return false; |
125 } | 125 } |
126 | 126 |
127 VTTCueBox::VTTCueBox(Document& document, VTTCue* cue) | 127 VTTCueBox::VTTCueBox(Document& document, VTTCue* cue) |
128 : HTMLDivElement(document) | 128 : HTMLDivElement(document) |
129 , m_cue(cue) | 129 , m_cue(cue) |
130 { | 130 { |
131 setPseudo(AtomicString("-webkit-media-text-track-display", AtomicString::Con
structFromLiteral)); | 131 setPseudo(AtomicString("-webkit-media-text-track-display", AtomicString::Con
structFromLiteral)); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 m_linePosition = position; | 310 m_linePosition = position; |
311 m_computedLinePosition = calculateComputedLinePosition(); | 311 m_computedLinePosition = calculateComputedLinePosition(); |
312 cueDidChange(); | 312 cueDidChange(); |
313 } | 313 } |
314 | 314 |
315 void VTTCue::setPosition(int position, ExceptionState& exceptionState) | 315 void VTTCue::setPosition(int position, ExceptionState& exceptionState) |
316 { | 316 { |
317 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-position | 317 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-position |
318 // On setting, if the new value is negative or greater than 100, then throw
an IndexSizeError exception. | 318 // On setting, if the new value is negative or greater than 100, then throw
an IndexSizeError exception. |
319 // Otherwise, set the text track cue text position to the new value. | 319 // Otherwise, set the text track cue text position to the new value. |
320 if (isInvalidPercentage(position, "line", exceptionState)) | 320 if (isInvalidPercentage(position, exceptionState)) |
321 return; | 321 return; |
322 | 322 |
323 // Otherwise, set the text track cue line position to the new value. | 323 // Otherwise, set the text track cue line position to the new value. |
324 if (m_textPosition == position) | 324 if (m_textPosition == position) |
325 return; | 325 return; |
326 | 326 |
327 cueWillChange(); | 327 cueWillChange(); |
328 m_textPosition = position; | 328 m_textPosition = position; |
329 cueDidChange(); | 329 cueDidChange(); |
330 } | 330 } |
331 | 331 |
332 void VTTCue::setSize(int size, ExceptionState& exceptionState) | 332 void VTTCue::setSize(int size, ExceptionState& exceptionState) |
333 { | 333 { |
334 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-size | 334 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-size |
335 // On setting, if the new value is negative or greater than 100, then throw
an IndexSizeError | 335 // On setting, if the new value is negative or greater than 100, then throw
an IndexSizeError |
336 // exception. Otherwise, set the text track cue size to the new value. | 336 // exception. Otherwise, set the text track cue size to the new value. |
337 if (isInvalidPercentage(size, "line", exceptionState)) | 337 if (isInvalidPercentage(size, exceptionState)) |
338 return; | 338 return; |
339 | 339 |
340 // Otherwise, set the text track cue line position to the new value. | 340 // Otherwise, set the text track cue line position to the new value. |
341 if (m_cueSize == size) | 341 if (m_cueSize == size) |
342 return; | 342 return; |
343 | 343 |
344 cueWillChange(); | 344 cueWillChange(); |
345 m_cueSize = size; | 345 m_cueSize = size; |
346 cueDidChange(); | 346 cueDidChange(); |
347 } | 347 } |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 return m_cueBackgroundBox->executionContext(); | 1098 return m_cueBackgroundBox->executionContext(); |
1099 } | 1099 } |
1100 | 1100 |
1101 Document& VTTCue::document() const | 1101 Document& VTTCue::document() const |
1102 { | 1102 { |
1103 ASSERT(m_cueBackgroundBox); | 1103 ASSERT(m_cueBackgroundBox); |
1104 return m_cueBackgroundBox->document(); | 1104 return m_cueBackgroundBox->document(); |
1105 } | 1105 } |
1106 | 1106 |
1107 } // namespace WebCore | 1107 } // namespace WebCore |
OLD | NEW |