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

Side by Side Diff: third_party/WebKit/Source/platform/DateComponents.cpp

Issue 2678343007: Modify DateComponents::parseTime to reject values with >3 fractional decimal places (Closed)
Patch Set: Updated tests Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/time/time-validity-typemismatch-expected.txt ('k') | no next file » | 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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 unsigned digitsLength = countDigits(src, index + 1); 440 unsigned digitsLength = countDigits(src, index + 1);
441 if (digitsLength > 0) { 441 if (digitsLength > 0) {
442 ++index; 442 ++index;
443 bool ok; 443 bool ok;
444 if (digitsLength == 1) { 444 if (digitsLength == 1) {
445 ok = toInt(src, index, 1, millisecond); 445 ok = toInt(src, index, 1, millisecond);
446 millisecond *= 100; 446 millisecond *= 100;
447 } else if (digitsLength == 2) { 447 } else if (digitsLength == 2) {
448 ok = toInt(src, index, 2, millisecond); 448 ok = toInt(src, index, 2, millisecond);
449 millisecond *= 10; 449 millisecond *= 10;
450 } else { // digitsLength >= 3 450 } else if (digitsLength == 3) {
451 ok = toInt(src, index, 3, millisecond); 451 ok = toInt(src, index, 3, millisecond);
452 } else { // digitsLength >= 4
453 return false;
452 } 454 }
453 DCHECK(ok); 455 DCHECK(ok);
454 index += digitsLength; 456 index += digitsLength;
455 } 457 }
456 } 458 }
457 } 459 }
458 } 460 }
459 m_hour = hour; 461 m_hour = hour;
460 m_minute = minute; 462 m_minute = minute;
461 m_second = second; 463 m_second = second;
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 case Week: 714 case Week:
713 return String::format("%04d-W%02d", m_year, m_week); 715 return String::format("%04d-W%02d", m_year, m_week);
714 case Invalid: 716 case Invalid:
715 break; 717 break;
716 } 718 }
717 ASSERT_NOT_REACHED(); 719 ASSERT_NOT_REACHED();
718 return String("(Invalid DateComponents)"); 720 return String("(Invalid DateComponents)");
719 } 721 }
720 722
721 } // namespace blink 723 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/forms/time/time-validity-typemismatch-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698