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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/transforms/transform-inherit-initial-unprefixed-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 * (C) 1999-2003 Lars Knoll (knoll@kde.org) 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org)
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012 Apple Inc. All rights reserv ed. 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2012 Apple Inc. All rights reserv ed.
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 14 matching lines...) Expand all
25 #include "core/css/CSSCalculationValue.h" 25 #include "core/css/CSSCalculationValue.h"
26 #include "core/css/CSSHelper.h" 26 #include "core/css/CSSHelper.h"
27 #include "core/css/CSSMarkup.h" 27 #include "core/css/CSSMarkup.h"
28 #include "core/css/CSSToLengthConversionData.h" 28 #include "core/css/CSSToLengthConversionData.h"
29 #include "core/css/Counter.h" 29 #include "core/css/Counter.h"
30 #include "core/css/Pair.h" 30 #include "core/css/Pair.h"
31 #include "core/css/Rect.h" 31 #include "core/css/Rect.h"
32 #include "core/css/StyleSheetContents.h" 32 #include "core/css/StyleSheetContents.h"
33 #include "core/dom/Node.h" 33 #include "core/dom/Node.h"
34 #include "core/style/ComputedStyle.h" 34 #include "core/style/ComputedStyle.h"
35 #include "platform/Decimal.h"
36 #include "platform/LayoutUnit.h" 35 #include "platform/LayoutUnit.h"
37 #include "platform/fonts/FontMetrics.h" 36 #include "platform/fonts/FontMetrics.h"
38 #include "wtf/StdLibExtras.h" 37 #include "wtf/StdLibExtras.h"
39 #include "wtf/ThreadSpecific.h" 38 #include "wtf/ThreadSpecific.h"
40 #include "wtf/Threading.h" 39 #include "wtf/Threading.h"
41 #include "wtf/text/StringBuffer.h" 40 #include "wtf/text/StringBuffer.h"
42 #include "wtf/text/StringBuilder.h" 41 #include "wtf/text/StringBuilder.h"
43 42
44 using namespace WTF; 43 using namespace WTF;
45 44
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 return propertyName(m_value.propertyID); 819 return propertyName(m_value.propertyID);
821 default: 820 default:
822 break; 821 break;
823 } 822 }
824 823
825 return String(); 824 return String();
826 } 825 }
827 826
828 static String formatNumber(double number, const char* suffix, unsigned suffixLen gth) 827 static String formatNumber(double number, const char* suffix, unsigned suffixLen gth)
829 { 828 {
830 Decimal decimal = Decimal::fromDouble(number); 829 #if OS(WIN)
831 String result = decimal.toString(); 830 unsigned oldFormat = _set_output_format(_TWO_DIGIT_EXPONENT);
831 #endif
832 String result = String::format("%.6g", number);
833 #if OS(WIN)
834 _set_output_format(oldFormat);
835 #endif
832 result.append(suffix, suffixLength); 836 result.append(suffix, suffixLength);
833 return result; 837 return result;
834 } 838 }
835 839
836 template <unsigned characterCount> 840 template <unsigned characterCount>
837 ALWAYS_INLINE static String formatNumber(double number, const char (&characters) [characterCount]) 841 ALWAYS_INLINE static String formatNumber(double number, const char (&characters) [characterCount])
838 { 842 {
839 return formatNumber(number, characters, characterCount - 1); 843 return formatNumber(number, characters, characterCount - 1);
840 } 844 }
841 845
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 visitor->trace(m_value.shape); 1135 visitor->trace(m_value.shape);
1132 break; 1136 break;
1133 default: 1137 default:
1134 break; 1138 break;
1135 } 1139 }
1136 #endif 1140 #endif
1137 CSSValue::traceAfterDispatch(visitor); 1141 CSSValue::traceAfterDispatch(visitor);
1138 } 1142 }
1139 1143
1140 } // namespace blink 1144 } // namespace blink
OLDNEW
« 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