| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 // the user agent must instead throw a SyntaxError exception. | 341 // the user agent must instead throw a SyntaxError exception. |
| 342 | 342 |
| 343 WritingDirection direction = m_writingDirection; | 343 WritingDirection direction = m_writingDirection; |
| 344 if (value == horizontalKeyword()) | 344 if (value == horizontalKeyword()) |
| 345 direction = Horizontal; | 345 direction = Horizontal; |
| 346 else if (value == verticalGrowingLeftKeyword()) | 346 else if (value == verticalGrowingLeftKeyword()) |
| 347 direction = VerticalGrowingLeft; | 347 direction = VerticalGrowingLeft; |
| 348 else if (value == verticalGrowingRightKeyword()) | 348 else if (value == verticalGrowingRightKeyword()) |
| 349 direction = VerticalGrowingRight; | 349 direction = VerticalGrowingRight; |
| 350 else | 350 else |
| 351 es.throwDOMException(SyntaxError); | 351 es.throwUninformativeAndGenericDOMException(SyntaxError); |
| 352 | 352 |
| 353 if (direction == m_writingDirection) | 353 if (direction == m_writingDirection) |
| 354 return; | 354 return; |
| 355 | 355 |
| 356 cueWillChange(); | 356 cueWillChange(); |
| 357 m_writingDirection = direction; | 357 m_writingDirection = direction; |
| 358 cueDidChange(); | 358 cueDidChange(); |
| 359 } | 359 } |
| 360 | 360 |
| 361 void TextTrackCue::setSnapToLines(bool value) | 361 void TextTrackCue::setSnapToLines(bool value) |
| 362 { | 362 { |
| 363 if (m_snapToLines == value) | 363 if (m_snapToLines == value) |
| 364 return; | 364 return; |
| 365 | 365 |
| 366 cueWillChange(); | 366 cueWillChange(); |
| 367 m_snapToLines = value; | 367 m_snapToLines = value; |
| 368 cueDidChange(); | 368 cueDidChange(); |
| 369 } | 369 } |
| 370 | 370 |
| 371 void TextTrackCue::setLine(int position, ExceptionState& es) | 371 void TextTrackCue::setLine(int position, ExceptionState& es) |
| 372 { | 372 { |
| 373 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-line | 373 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-line |
| 374 // On setting, if the text track cue snap-to-lines flag is not set, and the
new | 374 // On setting, if the text track cue snap-to-lines flag is not set, and the
new |
| 375 // value is negative or greater than 100, then throw an IndexSizeError excep
tion. | 375 // value is negative or greater than 100, then throw an IndexSizeError excep
tion. |
| 376 if (!m_snapToLines && (position < 0 || position > 100)) { | 376 if (!m_snapToLines && (position < 0 || position > 100)) { |
| 377 es.throwDOMException(IndexSizeError); | 377 es.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 378 return; | 378 return; |
| 379 } | 379 } |
| 380 | 380 |
| 381 // Otherwise, set the text track cue line position to the new value. | 381 // Otherwise, set the text track cue line position to the new value. |
| 382 if (m_linePosition == position) | 382 if (m_linePosition == position) |
| 383 return; | 383 return; |
| 384 | 384 |
| 385 cueWillChange(); | 385 cueWillChange(); |
| 386 m_linePosition = position; | 386 m_linePosition = position; |
| 387 m_computedLinePosition = calculateComputedLinePosition(); | 387 m_computedLinePosition = calculateComputedLinePosition(); |
| 388 cueDidChange(); | 388 cueDidChange(); |
| 389 } | 389 } |
| 390 | 390 |
| 391 void TextTrackCue::setPosition(int position, ExceptionState& es) | 391 void TextTrackCue::setPosition(int position, ExceptionState& es) |
| 392 { | 392 { |
| 393 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-position | 393 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-position |
| 394 // On setting, if the new value is negative or greater than 100, then throw
an IndexSizeError exception. | 394 // On setting, if the new value is negative or greater than 100, then throw
an IndexSizeError exception. |
| 395 // Otherwise, set the text track cue text position to the new value. | 395 // Otherwise, set the text track cue text position to the new value. |
| 396 if (position < 0 || position > 100) { | 396 if (position < 0 || position > 100) { |
| 397 es.throwDOMException(IndexSizeError); | 397 es.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 398 return; | 398 return; |
| 399 } | 399 } |
| 400 | 400 |
| 401 // Otherwise, set the text track cue line position to the new value. | 401 // Otherwise, set the text track cue line position to the new value. |
| 402 if (m_textPosition == position) | 402 if (m_textPosition == position) |
| 403 return; | 403 return; |
| 404 | 404 |
| 405 cueWillChange(); | 405 cueWillChange(); |
| 406 m_textPosition = position; | 406 m_textPosition = position; |
| 407 cueDidChange(); | 407 cueDidChange(); |
| 408 } | 408 } |
| 409 | 409 |
| 410 void TextTrackCue::setSize(int size, ExceptionState& es) | 410 void TextTrackCue::setSize(int size, ExceptionState& es) |
| 411 { | 411 { |
| 412 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-size | 412 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele
ment.html#dom-texttrackcue-size |
| 413 // On setting, if the new value is negative or greater than 100, then throw
an IndexSizeError | 413 // On setting, if the new value is negative or greater than 100, then throw
an IndexSizeError |
| 414 // exception. Otherwise, set the text track cue size to the new value. | 414 // exception. Otherwise, set the text track cue size to the new value. |
| 415 if (size < 0 || size > 100) { | 415 if (size < 0 || size > 100) { |
| 416 es.throwDOMException(IndexSizeError); | 416 es.throwUninformativeAndGenericDOMException(IndexSizeError); |
| 417 return; | 417 return; |
| 418 } | 418 } |
| 419 | 419 |
| 420 // Otherwise, set the text track cue line position to the new value. | 420 // Otherwise, set the text track cue line position to the new value. |
| 421 if (m_cueSize == size) | 421 if (m_cueSize == size) |
| 422 return; | 422 return; |
| 423 | 423 |
| 424 cueWillChange(); | 424 cueWillChange(); |
| 425 m_cueSize = size; | 425 m_cueSize = size; |
| 426 cueDidChange(); | 426 cueDidChange(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 450 // agent must instead throw a SyntaxError exception. | 450 // agent must instead throw a SyntaxError exception. |
| 451 | 451 |
| 452 CueAlignment alignment = m_cueAlignment; | 452 CueAlignment alignment = m_cueAlignment; |
| 453 if (value == startKeyword()) | 453 if (value == startKeyword()) |
| 454 alignment = Start; | 454 alignment = Start; |
| 455 else if (value == middleKeyword()) | 455 else if (value == middleKeyword()) |
| 456 alignment = Middle; | 456 alignment = Middle; |
| 457 else if (value == endKeyword()) | 457 else if (value == endKeyword()) |
| 458 alignment = End; | 458 alignment = End; |
| 459 else | 459 else |
| 460 es.throwDOMException(SyntaxError); | 460 es.throwUninformativeAndGenericDOMException(SyntaxError); |
| 461 | 461 |
| 462 if (alignment == m_cueAlignment) | 462 if (alignment == m_cueAlignment) |
| 463 return; | 463 return; |
| 464 | 464 |
| 465 cueWillChange(); | 465 cueWillChange(); |
| 466 m_cueAlignment = alignment; | 466 m_cueAlignment = alignment; |
| 467 cueDidChange(); | 467 cueDidChange(); |
| 468 } | 468 } |
| 469 | 469 |
| 470 void TextTrackCue::setText(const String& text) | 470 void TextTrackCue::setText(const String& text) |
| (...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1184 return false; | 1184 return false; |
| 1185 if (m_cueSize != cue.size()) | 1185 if (m_cueSize != cue.size()) |
| 1186 return false; | 1186 return false; |
| 1187 if (align() != cue.align()) | 1187 if (align() != cue.align()) |
| 1188 return false; | 1188 return false; |
| 1189 | 1189 |
| 1190 return true; | 1190 return true; |
| 1191 } | 1191 } |
| 1192 | 1192 |
| 1193 } // namespace WebCore | 1193 } // namespace WebCore |
| OLD | NEW |