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

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

Issue 869173002: VTTCue: Remove dead exception throwing code in setLine/setPosition (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 11 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 310 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 } 321 }
322 322
323 void VTTCue::line(DoubleOrAutoKeyword& result) const 323 void VTTCue::line(DoubleOrAutoKeyword& result) const
324 { 324 {
325 if (lineIsAuto()) 325 if (lineIsAuto())
326 result.setAutoKeyword(autoKeyword()); 326 result.setAutoKeyword(autoKeyword());
327 else 327 else
328 result.setDouble(m_linePosition); 328 result.setDouble(m_linePosition);
329 } 329 }
330 330
331 void VTTCue::setLine(const DoubleOrAutoKeyword& position, ExceptionState& except ionState) 331 void VTTCue::setLine(const DoubleOrAutoKeyword& position)
332 { 332 {
333 // FIXME: Expecting bindings code to handle this case: https://crbug.com/450 252.
334 if (position.isDouble() && !std::isfinite(position.getAsDouble())) {
335 exceptionState.throwTypeError("The provided double value is non-finite." );
336 return;
337 }
338
339 // http://dev.w3.org/html5/webvtt/#dfn-vttcue-line 333 // http://dev.w3.org/html5/webvtt/#dfn-vttcue-line
340 // On setting, the text track cue line position must be set to the new 334 // On setting, the text track cue line position must be set to the new
341 // value; if the new value is the string "auto", then it must be 335 // value; if the new value is the string "auto", then it must be
342 // interpreted as the special value auto. 336 // interpreted as the special value auto.
343 // ("auto" is translated to NaN.) 337 // ("auto" is translated to NaN.)
344 float floatPosition; 338 float floatPosition;
345 if (position.isAutoKeyword()) { 339 if (position.isAutoKeyword()) {
346 if (lineIsAuto()) 340 if (lineIsAuto())
347 return; 341 return;
348 floatPosition = std::numeric_limits<float>::quiet_NaN(); 342 floatPosition = std::numeric_limits<float>::quiet_NaN();
(...skipping 18 matching lines...) Expand all
367 void VTTCue::position(DoubleOrAutoKeyword& result) const 361 void VTTCue::position(DoubleOrAutoKeyword& result) const
368 { 362 {
369 if (textPositionIsAuto()) 363 if (textPositionIsAuto())
370 result.setAutoKeyword(autoKeyword()); 364 result.setAutoKeyword(autoKeyword());
371 else 365 else
372 result.setDouble(m_textPosition); 366 result.setDouble(m_textPosition);
373 } 367 }
374 368
375 void VTTCue::setPosition(const DoubleOrAutoKeyword& position, ExceptionState& ex ceptionState) 369 void VTTCue::setPosition(const DoubleOrAutoKeyword& position, ExceptionState& ex ceptionState)
376 { 370 {
377 // FIXME: Expecting bindings code to handle this case: https://crbug.com/450 252.
378 if (position.isDouble() && !std::isfinite(position.getAsDouble())) {
379 exceptionState.throwTypeError("The provided double value is non-finite." );
380 return;
381 }
382
383 // http://dev.w3.org/html5/webvtt/#dfn-vttcue-position 371 // http://dev.w3.org/html5/webvtt/#dfn-vttcue-position
384 // On setting, if the new value is negative or greater than 100, then an 372 // On setting, if the new value is negative or greater than 100, then an
385 // IndexSizeError exception must be thrown. Otherwise, the text track cue 373 // IndexSizeError exception must be thrown. Otherwise, the text track cue
386 // text position must be set to the new value; if the new value is the 374 // text position must be set to the new value; if the new value is the
387 // string "auto", then it must be interpreted as the special value auto. 375 // string "auto", then it must be interpreted as the special value auto.
388 float floatPosition; 376 float floatPosition;
389 if (position.isAutoKeyword()) { 377 if (position.isAutoKeyword()) {
390 if (textPositionIsAuto()) 378 if (textPositionIsAuto())
391 return; 379 return;
392 floatPosition = std::numeric_limits<float>::quiet_NaN(); 380 floatPosition = std::numeric_limits<float>::quiet_NaN();
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after
1189 1177
1190 void VTTCue::trace(Visitor* visitor) 1178 void VTTCue::trace(Visitor* visitor)
1191 { 1179 {
1192 visitor->trace(m_vttNodeTree); 1180 visitor->trace(m_vttNodeTree);
1193 visitor->trace(m_cueBackgroundBox); 1181 visitor->trace(m_cueBackgroundBox);
1194 visitor->trace(m_displayTree); 1182 visitor->trace(m_displayTree);
1195 TextTrackCue::trace(visitor); 1183 TextTrackCue::trace(visitor);
1196 } 1184 }
1197 1185
1198 } // namespace blink 1186 } // namespace blink
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