Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(736)

Side by Side Diff: Source/core/html/track/TextTrackCue.cpp

Issue 72363002: Rename es => exceptionState in other than bindings/ (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Retry Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/track/TextTrack.cpp ('k') | Source/core/html/track/VTTRegion.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 void TextTrackCue::setId(const String& id) 266 void TextTrackCue::setId(const String& id)
267 { 267 {
268 if (m_id == id) 268 if (m_id == id)
269 return; 269 return;
270 270
271 cueWillChange(); 271 cueWillChange();
272 m_id = id; 272 m_id = id;
273 cueDidChange(); 273 cueDidChange();
274 } 274 }
275 275
276 void TextTrackCue::setStartTime(double value, ExceptionState& es) 276 void TextTrackCue::setStartTime(double value, ExceptionState& exceptionState)
277 { 277 {
278 // NaN, Infinity and -Infinity values should trigger a TypeError. 278 // NaN, Infinity and -Infinity values should trigger a TypeError.
279 if (std::isinf(value) || std::isnan(value)) { 279 if (std::isinf(value) || std::isnan(value)) {
280 es.throwUninformativeAndGenericTypeError(); 280 exceptionState.throwUninformativeAndGenericTypeError();
281 return; 281 return;
282 } 282 }
283 283
284 // TODO(93143): Add spec-compliant behavior for negative time values. 284 // TODO(93143): Add spec-compliant behavior for negative time values.
285 if (m_startTime == value || value < 0) 285 if (m_startTime == value || value < 0)
286 return; 286 return;
287 287
288 cueWillChange(); 288 cueWillChange();
289 m_startTime = value; 289 m_startTime = value;
290 cueDidChange(); 290 cueDidChange();
291 } 291 }
292 292
293 void TextTrackCue::setEndTime(double value, ExceptionState& es) 293 void TextTrackCue::setEndTime(double value, ExceptionState& exceptionState)
294 { 294 {
295 // NaN, Infinity and -Infinity values should trigger a TypeError. 295 // NaN, Infinity and -Infinity values should trigger a TypeError.
296 if (std::isinf(value) || std::isnan(value)) { 296 if (std::isinf(value) || std::isnan(value)) {
297 es.throwUninformativeAndGenericTypeError(); 297 exceptionState.throwUninformativeAndGenericTypeError();
298 return; 298 return;
299 } 299 }
300 300
301 // TODO(93143): Add spec-compliant behavior for negative time values. 301 // TODO(93143): Add spec-compliant behavior for negative time values.
302 if (m_endTime == value || value < 0) 302 if (m_endTime == value || value < 0)
303 return; 303 return;
304 304
305 cueWillChange(); 305 cueWillChange();
306 m_endTime = value; 306 m_endTime = value;
307 cueDidChange(); 307 cueDidChange();
(...skipping 17 matching lines...) Expand all
325 case VerticalGrowingLeft: 325 case VerticalGrowingLeft:
326 return verticalGrowingLeftKeyword(); 326 return verticalGrowingLeftKeyword();
327 case VerticalGrowingRight: 327 case VerticalGrowingRight:
328 return verticalGrowingRightKeyword(); 328 return verticalGrowingRightKeyword();
329 default: 329 default:
330 ASSERT_NOT_REACHED(); 330 ASSERT_NOT_REACHED();
331 return emptyString(); 331 return emptyString();
332 } 332 }
333 } 333 }
334 334
335 void TextTrackCue::setVertical(const String& value, ExceptionState& es) 335 void TextTrackCue::setVertical(const String& value, ExceptionState& exceptionSta te)
336 { 336 {
337 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele ment.html#dom-texttrackcue-vertical 337 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele ment.html#dom-texttrackcue-vertical
338 // On setting, the text track cue writing direction must be set to the value given 338 // On setting, the text track cue writing direction must be set to the value given
339 // in the first cell of the row in the table above whose second cell is a 339 // in the first cell of the row in the table above whose second cell is a
340 // case-sensitive match for the new value, if any. If none of the values mat ch, then 340 // case-sensitive match for the new value, if any. If none of the values mat ch, then
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.throwUninformativeAndGenericDOMException(SyntaxError); 351 exceptionState.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& exceptionState)
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.throwUninformativeAndGenericDOMException(IndexSizeError); 377 exceptionState.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& exceptionState)
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.throwUninformativeAndGenericDOMException(IndexSizeError); 397 exceptionState.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& exceptionState)
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.throwUninformativeAndGenericDOMException(IndexSizeError); 416 exceptionState.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 11 matching lines...) Expand all
438 case Left: 438 case Left:
439 return leftKeyword(); 439 return leftKeyword();
440 case Right: 440 case Right:
441 return rightKeyword(); 441 return rightKeyword();
442 default: 442 default:
443 ASSERT_NOT_REACHED(); 443 ASSERT_NOT_REACHED();
444 return emptyString(); 444 return emptyString();
445 } 445 }
446 } 446 }
447 447
448 void TextTrackCue::setAlign(const String& value, ExceptionState& es) 448 void TextTrackCue::setAlign(const String& value, ExceptionState& exceptionState)
449 { 449 {
450 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele ment.html#dom-texttrackcue-align 450 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele ment.html#dom-texttrackcue-align
451 // On setting, the text track cue alignment must be set to the value given i n the 451 // On setting, the text track cue alignment must be set to the value given i n the
452 // first cell of the row in the table above whose second cell is a case-sens itive 452 // first cell of the row in the table above whose second cell is a case-sens itive
453 // match for the new value, if any. If none of the values match, then the us er 453 // match for the new value, if any. If none of the values match, then the us er
454 // agent must instead throw a SyntaxError exception. 454 // agent must instead throw a SyntaxError exception.
455 455
456 CueAlignment alignment = m_cueAlignment; 456 CueAlignment alignment = m_cueAlignment;
457 if (value == startKeyword()) 457 if (value == startKeyword())
458 alignment = Start; 458 alignment = Start;
459 else if (value == middleKeyword()) 459 else if (value == middleKeyword())
460 alignment = Middle; 460 alignment = Middle;
461 else if (value == endKeyword()) 461 else if (value == endKeyword())
462 alignment = End; 462 alignment = End;
463 else if (value == leftKeyword()) 463 else if (value == leftKeyword())
464 alignment = Left; 464 alignment = Left;
465 else if (value == rightKeyword()) 465 else if (value == rightKeyword())
466 alignment = Right; 466 alignment = Right;
467 else 467 else
468 es.throwUninformativeAndGenericDOMException(SyntaxError); 468 exceptionState.throwUninformativeAndGenericDOMException(SyntaxError);
469 469
470 if (alignment == m_cueAlignment) 470 if (alignment == m_cueAlignment)
471 return; 471 return;
472 472
473 cueWillChange(); 473 cueWillChange();
474 m_cueAlignment = alignment; 474 m_cueAlignment = alignment;
475 cueDidChange(); 475 cueDidChange();
476 } 476 }
477 477
478 void TextTrackCue::setText(const String& text) 478 void TextTrackCue::setText(const String& text)
(...skipping 745 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 return false; 1224 return false;
1225 if (m_cueSize != cue.size()) 1225 if (m_cueSize != cue.size())
1226 return false; 1226 return false;
1227 if (align() != cue.align()) 1227 if (align() != cue.align())
1228 return false; 1228 return false;
1229 1229
1230 return true; 1230 return true;
1231 } 1231 }
1232 1232
1233 } // namespace WebCore 1233 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/track/TextTrack.cpp ('k') | Source/core/html/track/VTTRegion.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698