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

Unified Diff: Source/core/css/CSSPrimitiveValue.cpp

Issue 1120133004: Serialize <number> to round to at most 6 decimals (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Try to fix win Created 5 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 | « LayoutTests/transforms/transform-inherit-initial-unprefixed-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/CSSPrimitiveValue.cpp
diff --git a/Source/core/css/CSSPrimitiveValue.cpp b/Source/core/css/CSSPrimitiveValue.cpp
index 0c992ceb22ccdae3952a4ab9b756798b0307bf8c..0fc04f0ad270edc9d6df18fa4a22119fd402f35d 100644
--- a/Source/core/css/CSSPrimitiveValue.cpp
+++ b/Source/core/css/CSSPrimitiveValue.cpp
@@ -32,7 +32,6 @@
#include "core/css/StyleSheetContents.h"
#include "core/dom/Node.h"
#include "core/style/ComputedStyle.h"
-#include "platform/Decimal.h"
#include "platform/LayoutUnit.h"
#include "platform/fonts/FontMetrics.h"
#include "wtf/StdLibExtras.h"
@@ -827,8 +826,13 @@ String CSSPrimitiveValue::getStringValue() const
static String formatNumber(double number, const char* suffix, unsigned suffixLength)
{
- Decimal decimal = Decimal::fromDouble(number);
- String result = decimal.toString();
+#if OS(WIN)
+ unsigned oldFormat = _set_output_format(_TWO_DIGIT_EXPONENT);
+#endif
+ String result = String::format("%.6g", number);
+#if OS(WIN)
+ _set_output_format(oldFormat);
+#endif
result.append(suffix, suffixLength);
return result;
}
« no previous file with comments | « LayoutTests/transforms/transform-inherit-initial-unprefixed-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698