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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
270 // the user agent must instead throw a SyntaxError exception. | 270 // the user agent must instead throw a SyntaxError exception. |
271 | 271 |
272 WritingDirection direction = m_writingDirection; | 272 WritingDirection direction = m_writingDirection; |
273 if (value == horizontalKeyword()) | 273 if (value == horizontalKeyword()) |
274 direction = Horizontal; | 274 direction = Horizontal; |
275 else if (value == verticalGrowingLeftKeyword()) | 275 else if (value == verticalGrowingLeftKeyword()) |
276 direction = VerticalGrowingLeft; | 276 direction = VerticalGrowingLeft; |
277 else if (value == verticalGrowingRightKeyword()) | 277 else if (value == verticalGrowingRightKeyword()) |
278 direction = VerticalGrowingRight; | 278 direction = VerticalGrowingRight; |
279 else | 279 else |
280 exceptionState.throwDOMException(SyntaxError, ExceptionMessages::failedT
oSet("vertical", "TextTrackCue", "The value provided ('" + value + "') is invali
d. Only 'rl', 'lr', and the empty string are accepted.")); | 280 exceptionState.throwDOMException(SyntaxError, "The value provided ('" +
value + "') is invalid. Only 'rl', 'lr', and the empty string are accepted."); |
281 | 281 |
282 if (direction == m_writingDirection) | 282 if (direction == m_writingDirection) |
283 return; | 283 return; |
284 | 284 |
285 cueWillChange(); | 285 cueWillChange(); |
286 m_writingDirection = direction; | 286 m_writingDirection = direction; |
287 cueDidChange(); | 287 cueDidChange(); |
288 } | 288 } |
289 | 289 |
290 void VTTCue::setSnapToLines(bool value) | 290 void VTTCue::setSnapToLines(bool value) |
291 { | 291 { |
292 if (m_snapToLines == value) | 292 if (m_snapToLines == value) |
293 return; | 293 return; |
294 | 294 |
295 cueWillChange(); | 295 cueWillChange(); |
296 m_snapToLines = value; | 296 m_snapToLines = value; |
297 cueDidChange(); | 297 cueDidChange(); |
298 } | 298 } |
299 | 299 |
300 void VTTCue::setLine(int position, ExceptionState& exceptionState) | 300 void VTTCue::setLine(int position, ExceptionState& exceptionState) |
301 { | 301 { |
302 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-line | 302 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-line |
303 // On setting, if the text track cue snap-to-lines flag is not set, and the
new | 303 // On setting, if the text track cue snap-to-lines flag is not set, and the
new |
304 // value is negative or greater than 100, then throw an IndexSizeError excep
tion. | 304 // value is negative or greater than 100, then throw an IndexSizeError excep
tion. |
305 if (!m_snapToLines && (position < 0 || position > 100)) { | 305 if (!m_snapToLines && (position < 0 || position > 100)) { |
306 exceptionState.throwDOMException(IndexSizeError, ExceptionMessages::fail
edToSet("line", "TextTrackCue", "The snap-to-lines flag is not set, and the valu
e provided (" + String::number(position) + ") is not between 0 and 100.")); | 306 exceptionState.throwDOMException(IndexSizeError, "The snap-to-lines flag
is not set, and the value provided (" + String::number(position) + ") is not be
tween 0 and 100."); |
307 return; | 307 return; |
308 } | 308 } |
309 | 309 |
310 // Otherwise, set the text track cue line position to the new value. | 310 // Otherwise, set the text track cue line position to the new value. |
311 if (m_linePosition == position) | 311 if (m_linePosition == position) |
312 return; | 312 return; |
313 | 313 |
314 cueWillChange(); | 314 cueWillChange(); |
315 m_linePosition = position; | 315 m_linePosition = position; |
316 m_computedLinePosition = calculateComputedLinePosition(); | 316 m_computedLinePosition = calculateComputedLinePosition(); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 alignment = Start; | 383 alignment = Start; |
384 else if (value == middleKeyword()) | 384 else if (value == middleKeyword()) |
385 alignment = Middle; | 385 alignment = Middle; |
386 else if (value == endKeyword()) | 386 else if (value == endKeyword()) |
387 alignment = End; | 387 alignment = End; |
388 else if (value == leftKeyword()) | 388 else if (value == leftKeyword()) |
389 alignment = Left; | 389 alignment = Left; |
390 else if (value == rightKeyword()) | 390 else if (value == rightKeyword()) |
391 alignment = Right; | 391 alignment = Right; |
392 else | 392 else |
393 exceptionState.throwDOMException(SyntaxError, ExceptionMessages::failedT
oSet("align", "TextTrackCue", "The value provided ('" + value + "') is invalid.
Only 'start', 'middle', 'end', 'left', and 'right' are accepted.")); | 393 exceptionState.throwDOMException(SyntaxError, "The value provided ('" +
value + "') is invalid. Only 'start', 'middle', 'end', 'left', and 'right' are a
ccepted."); |
394 | 394 |
395 if (alignment == m_cueAlignment) | 395 if (alignment == m_cueAlignment) |
396 return; | 396 return; |
397 | 397 |
398 cueWillChange(); | 398 cueWillChange(); |
399 m_cueAlignment = alignment; | 399 m_cueAlignment = alignment; |
400 cueDidChange(); | 400 cueDidChange(); |
401 } | 401 } |
402 | 402 |
403 void VTTCue::setText(const String& text) | 403 void VTTCue::setText(const String& text) |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 return m_cueBackgroundBox->executionContext(); | 1065 return m_cueBackgroundBox->executionContext(); |
1066 } | 1066 } |
1067 | 1067 |
1068 Document& VTTCue::document() const | 1068 Document& VTTCue::document() const |
1069 { | 1069 { |
1070 ASSERT(m_cueBackgroundBox); | 1070 ASSERT(m_cueBackgroundBox); |
1071 return m_cueBackgroundBox->document(); | 1071 return m_cueBackgroundBox->document(); |
1072 } | 1072 } |
1073 | 1073 |
1074 } // namespace WebCore | 1074 } // namespace WebCore |
OLD | NEW |