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

Side by Side Diff: Source/WebCore/platform/Decimal.cpp

Issue 11420033: Merge 134390 - Unable to set valid time value to input[type=time] with user interaction in some cas… (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/1312/
Patch Set: Created 8 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 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 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
895 return Decimal(EncodedData(sign, EncodedData::ClassInfinity)); 895 return Decimal(EncodedData(sign, EncodedData::ClassInfinity));
896 } 896 }
897 897
898 Decimal Decimal::nan() 898 Decimal Decimal::nan()
899 { 899 {
900 return Decimal(EncodedData(Positive, EncodedData::ClassNaN)); 900 return Decimal(EncodedData(Positive, EncodedData::ClassNaN));
901 } 901 }
902 902
903 Decimal Decimal::remainder(const Decimal& rhs) const 903 Decimal Decimal::remainder(const Decimal& rhs) const
904 { 904 {
905 const Decimal quotient = (*this / rhs).round(); 905 const Decimal quotient = *this / rhs;
906 return quotient.isSpecial() ? quotient : *this - quotient * rhs; 906 return quotient.isSpecial() ? quotient : *this - (quotient.isNegative() ? qu otient.ceiling() : quotient.floor()) * rhs;
907 } 907 }
908 908
909 Decimal Decimal::round() const 909 Decimal Decimal::round() const
910 { 910 {
911 if (isSpecial()) 911 if (isSpecial())
912 return *this; 912 return *this;
913 913
914 if (exponent() >= 0) 914 if (exponent() >= 0)
915 return *this; 915 return *this;
916 916
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1025 } 1025 }
1026 return builder.toString(); 1026 return builder.toString();
1027 } 1027 }
1028 1028
1029 Decimal Decimal::zero(Sign sign) 1029 Decimal Decimal::zero(Sign sign)
1030 { 1030 {
1031 return Decimal(EncodedData(sign, EncodedData::ClassZero)); 1031 return Decimal(EncodedData(sign, EncodedData::ClassZero));
1032 } 1032 }
1033 1033
1034 } // namespace WebCore 1034 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/WebCore/html/shadow/DateTimeEditElement.cpp ('k') | Source/WebKit/chromium/tests/DecimalTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698