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

Unified Diff: Source/platform/JSONValues.cpp

Issue 285643006: Kill WTF::DecimalNumber class (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Inline single-line function Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/css/MediaQuerySetTest.cpp ('k') | Source/platform/graphics/Color.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/JSONValues.cpp
diff --git a/Source/platform/JSONValues.cpp b/Source/platform/JSONValues.cpp
index 074fd77c8e9f307ac898fa1c1bfb9a369d51defd..7886cb377761678fda251f94a9bce5ba7f52b514 100644
--- a/Source/platform/JSONValues.cpp
+++ b/Source/platform/JSONValues.cpp
@@ -31,8 +31,8 @@
#include "config.h"
#include "platform/JSONValues.h"
-#include "wtf/DecimalNumber.h"
-#include "wtf/dtoa.h"
+#include "platform/Decimal.h"
+#include "wtf/MathExtras.h"
#include "wtf/text/StringBuilder.h"
namespace WebCore {
@@ -214,25 +214,11 @@ void JSONBasicValue::writeJSON(StringBuilder* output) const
else
output->append(falseString, 5);
} else if (type() == TypeNumber) {
- NumberToLStringBuffer buffer;
if (!std::isfinite(m_doubleValue)) {
output->append(nullString, 4);
return;
}
- DecimalNumber decimal = m_doubleValue;
- unsigned length = 0;
- if (decimal.bufferLengthForStringDecimal() > WTF::NumberToStringBufferLength) {
- // Not enough room for decimal. Use exponential format.
- if (decimal.bufferLengthForStringExponential() > WTF::NumberToStringBufferLength) {
- // Fallback for an abnormal case if it's too little even for exponential.
- output->append("NaN", 3);
- return;
- }
- length = decimal.toStringExponential(buffer, WTF::NumberToStringBufferLength);
- } else {
- length = decimal.toStringDecimal(buffer, WTF::NumberToStringBufferLength);
- }
- output->append(buffer, length);
+ output->append(Decimal::fromDouble(m_doubleValue).toString());
}
}
« no previous file with comments | « Source/core/css/MediaQuerySetTest.cpp ('k') | Source/platform/graphics/Color.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698