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 // ---------------------------- | 127 // ---------------------------- |
128 | 128 |
129 VTTCueBox::VTTCueBox(Document& document, VTTCue* cue) | 129 VTTCueBox::VTTCueBox(Document& document, VTTCue* cue) |
130 : TextTrackCueBox(document) | 130 : TextTrackCueBox(document) |
131 , m_cue(cue) | 131 , m_cue(cue) |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 m_linePosition = position; | 314 m_linePosition = position; |
315 m_computedLinePosition = calculateComputedLinePosition(); | 315 m_computedLinePosition = calculateComputedLinePosition(); |
316 cueDidChange(); | 316 cueDidChange(); |
317 } | 317 } |
318 | 318 |
319 void VTTCue::setPosition(int position, ExceptionState& exceptionState) | 319 void VTTCue::setPosition(int position, ExceptionState& exceptionState) |
320 { | 320 { |
321 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-position | 321 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-position |
322 // On setting, if the new value is negative or greater than 100, then throw
an IndexSizeError exception. | 322 // On setting, if the new value is negative or greater than 100, then throw
an IndexSizeError exception. |
323 // Otherwise, set the text track cue text position to the new value. | 323 // Otherwise, set the text track cue text position to the new value. |
324 if (isInvalidPercentage(position, "line", exceptionState)) | 324 if (isInvalidPercentage(position, exceptionState)) |
325 return; | 325 return; |
326 | 326 |
327 // Otherwise, set the text track cue line position to the new value. | 327 // Otherwise, set the text track cue line position to the new value. |
328 if (m_textPosition == position) | 328 if (m_textPosition == position) |
329 return; | 329 return; |
330 | 330 |
331 cueWillChange(); | 331 cueWillChange(); |
332 m_textPosition = position; | 332 m_textPosition = position; |
333 cueDidChange(); | 333 cueDidChange(); |
334 } | 334 } |
335 | 335 |
336 void VTTCue::setSize(int size, ExceptionState& exceptionState) | 336 void VTTCue::setSize(int size, ExceptionState& exceptionState) |
337 { | 337 { |
338 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-size | 338 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-size |
339 // On setting, if the new value is negative or greater than 100, then throw
an IndexSizeError | 339 // On setting, if the new value is negative or greater than 100, then throw
an IndexSizeError |
340 // exception. Otherwise, set the text track cue size to the new value. | 340 // exception. Otherwise, set the text track cue size to the new value. |
341 if (isInvalidPercentage(size, "line", exceptionState)) | 341 if (isInvalidPercentage(size, exceptionState)) |
342 return; | 342 return; |
343 | 343 |
344 // Otherwise, set the text track cue line position to the new value. | 344 // Otherwise, set the text track cue line position to the new value. |
345 if (m_cueSize == size) | 345 if (m_cueSize == size) |
346 return; | 346 return; |
347 | 347 |
348 cueWillChange(); | 348 cueWillChange(); |
349 m_cueSize = size; | 349 m_cueSize = size; |
350 cueDidChange(); | 350 cueDidChange(); |
351 } | 351 } |
(...skipping 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1110 return m_cueBackgroundBox->executionContext(); | 1110 return m_cueBackgroundBox->executionContext(); |
1111 } | 1111 } |
1112 | 1112 |
1113 Document& VTTCue::document() const | 1113 Document& VTTCue::document() const |
1114 { | 1114 { |
1115 ASSERT(m_cueBackgroundBox); | 1115 ASSERT(m_cueBackgroundBox); |
1116 return m_cueBackgroundBox->document(); | 1116 return m_cueBackgroundBox->document(); |
1117 } | 1117 } |
1118 | 1118 |
1119 } // namespace WebCore | 1119 } // namespace WebCore |
OLD | NEW |