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

Side by Side Diff: Source/core/html/track/vtt/VTTCue.cpp

Issue 254833003: Sync VTTCue.align/vertical with spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: update tests Created 6 years, 8 months 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/vtt/VTTCue.h ('k') | Source/core/html/track/vtt/VTTCue.idl » ('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) 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 case VerticalGrowingLeft: 257 case VerticalGrowingLeft:
258 return verticalGrowingLeftKeyword(); 258 return verticalGrowingLeftKeyword();
259 case VerticalGrowingRight: 259 case VerticalGrowingRight:
260 return verticalGrowingRightKeyword(); 260 return verticalGrowingRightKeyword();
261 default: 261 default:
262 ASSERT_NOT_REACHED(); 262 ASSERT_NOT_REACHED();
263 return emptyString(); 263 return emptyString();
264 } 264 }
265 } 265 }
266 266
267 void VTTCue::setVertical(const String& value, ExceptionState& exceptionState) 267 void VTTCue::setVertical(const String& value)
268 { 268 {
269 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele ment.html#dom-texttrackcue-vertical
270 // On setting, the text track cue writing direction must be set to the value given
271 // in the first cell of the row in the table above whose second cell is a
272 // case-sensitive match for the new value, if any. If none of the values mat ch, then
273 // the user agent must instead throw a SyntaxError exception.
274
275 WritingDirection direction = m_writingDirection; 269 WritingDirection direction = m_writingDirection;
276 if (value == horizontalKeyword()) 270 if (value == horizontalKeyword())
277 direction = Horizontal; 271 direction = Horizontal;
278 else if (value == verticalGrowingLeftKeyword()) 272 else if (value == verticalGrowingLeftKeyword())
279 direction = VerticalGrowingLeft; 273 direction = VerticalGrowingLeft;
280 else if (value == verticalGrowingRightKeyword()) 274 else if (value == verticalGrowingRightKeyword())
281 direction = VerticalGrowingRight; 275 direction = VerticalGrowingRight;
282 else 276 else
283 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + value + "') is invalid. Only 'rl', 'lr', and the empty string are accepted."); 277 ASSERT_NOT_REACHED();
284 278
285 if (direction == m_writingDirection) 279 if (direction == m_writingDirection)
286 return; 280 return;
287 281
288 cueWillChange(); 282 cueWillChange();
289 m_writingDirection = direction; 283 m_writingDirection = direction;
290 cueDidChange(); 284 cueDidChange();
291 } 285 }
292 286
293 void VTTCue::setSnapToLines(bool value) 287 void VTTCue::setSnapToLines(bool value)
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 case Left: 360 case Left:
367 return leftKeyword(); 361 return leftKeyword();
368 case Right: 362 case Right:
369 return rightKeyword(); 363 return rightKeyword();
370 default: 364 default:
371 ASSERT_NOT_REACHED(); 365 ASSERT_NOT_REACHED();
372 return emptyString(); 366 return emptyString();
373 } 367 }
374 } 368 }
375 369
376 void VTTCue::setAlign(const String& value, ExceptionState& exceptionState) 370 void VTTCue::setAlign(const String& value)
377 { 371 {
378 // http://www.whatwg.org/specs/web-apps/current-work/multipage/the-video-ele ment.html#dom-texttrackcue-align
379 // On setting, the text track cue alignment must be set to the value given i n the
380 // first cell of the row in the table above whose second cell is a case-sens itive
381 // match for the new value, if any. If none of the values match, then the us er
382 // agent must instead throw a SyntaxError exception.
383
384 CueAlignment alignment = m_cueAlignment; 372 CueAlignment alignment = m_cueAlignment;
385 if (value == startKeyword()) 373 if (value == startKeyword())
386 alignment = Start; 374 alignment = Start;
387 else if (value == middleKeyword()) 375 else if (value == middleKeyword())
388 alignment = Middle; 376 alignment = Middle;
389 else if (value == endKeyword()) 377 else if (value == endKeyword())
390 alignment = End; 378 alignment = End;
391 else if (value == leftKeyword()) 379 else if (value == leftKeyword())
392 alignment = Left; 380 alignment = Left;
393 else if (value == rightKeyword()) 381 else if (value == rightKeyword())
394 alignment = Right; 382 alignment = Right;
395 else 383 else
396 exceptionState.throwDOMException(SyntaxError, "The value provided ('" + value + "') is invalid. Only 'start', 'middle', 'end', 'left', and 'right' are a ccepted."); 384 ASSERT_NOT_REACHED();
397 385
398 if (alignment == m_cueAlignment) 386 if (alignment == m_cueAlignment)
399 return; 387 return;
400 388
401 cueWillChange(); 389 cueWillChange();
402 m_cueAlignment = alignment; 390 m_cueAlignment = alignment;
403 cueDidChange(); 391 cueDidChange();
404 } 392 }
405 393
406 void VTTCue::setText(const String& text) 394 void VTTCue::setText(const String& text)
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 ASSERT(m_cueBackgroundBox); 1062 ASSERT(m_cueBackgroundBox);
1075 return m_cueBackgroundBox->document(); 1063 return m_cueBackgroundBox->document();
1076 } 1064 }
1077 1065
1078 void VTTCue::trace(Visitor* visitor) 1066 void VTTCue::trace(Visitor* visitor)
1079 { 1067 {
1080 TextTrackCue::trace(visitor); 1068 TextTrackCue::trace(visitor);
1081 } 1069 }
1082 1070
1083 } // namespace WebCore 1071 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/html/track/vtt/VTTCue.h ('k') | Source/core/html/track/vtt/VTTCue.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698