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

Unified Diff: Source/core/css/CSSPrimitiveValue.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
Index: Source/core/css/CSSPrimitiveValue.cpp
diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp
index 2bcc42bbe9b52a07783c120e21552ae3d666c50f..1c439e04061c9cb09b433996c13c049ad0ccfa2c 100644
--- a/Source/core/css/CSSPrimitiveValue.cpp
+++ b/Source/core/css/CSSPrimitiveValue.cpp
@@ -35,8 +35,8 @@
#include "core/dom/ExceptionCode.h"
#include "core/dom/Node.h"
#include "core/rendering/style/RenderStyle.h"
+#include "platform/Decimal.h"
#include "platform/LayoutUnit.h"
-#include "wtf/DecimalNumber.h"
#include "wtf/StdLibExtras.h"
#include "wtf/text/StringBuffer.h"
#include "wtf/text/StringBuilder.h"
@@ -1040,16 +1040,10 @@ Pair* CSSPrimitiveValue::getPairValue(ExceptionState& exceptionState) const
static String formatNumber(double number, const char* suffix, unsigned suffixLength)
{
- DecimalNumber decimal(number);
-
- StringBuffer<LChar> buffer(decimal.bufferLengthForStringDecimal() + suffixLength);
- unsigned length = decimal.toStringDecimal(buffer.characters(), buffer.length());
- ASSERT(length + suffixLength == buffer.length());
-
- for (unsigned i = 0; i < suffixLength; ++i)
- buffer[length + i] = static_cast<LChar>(suffix[i]);
-
- return String::adopt(buffer);
+ Decimal decimal = Decimal::fromDouble(number);
+ String result = decimal.toString();
+ result.append(suffix, suffixLength);
+ return result;
}
template <unsigned characterCount>
« no previous file with comments | « LayoutTests/transforms/transform-inherit-initial-unprefixed-expected.txt ('k') | Source/core/css/MediaQueryExp.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698