OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2008, 2010 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 22 matching lines...) Expand all Loading... |
33 #include "platform/geometry/IntRect.h" | 33 #include "platform/geometry/IntRect.h" |
34 #include "platform/geometry/LayoutPoint.h" | 34 #include "platform/geometry/LayoutPoint.h" |
35 #include "platform/geometry/LayoutRect.h" | 35 #include "platform/geometry/LayoutRect.h" |
36 #include "platform/geometry/LayoutSize.h" | 36 #include "platform/geometry/LayoutSize.h" |
37 #include "wtf/MathExtras.h" | 37 #include "wtf/MathExtras.h" |
38 #include "wtf/StringExtras.h" | 38 #include "wtf/StringExtras.h" |
39 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
40 | 40 |
41 namespace blink { | 41 namespace blink { |
42 | 42 |
43 static const size_t printBufferSize = | 43 // large enough for any integer or floating point value in string format, |
44 100; // large enough for any integer or floating point value in string form
at, including trailing null character | 44 // including trailing null character |
| 45 static const size_t printBufferSize = 100; |
45 | 46 |
46 static inline bool hasFractions(double val) { | 47 static inline bool hasFractions(double val) { |
47 // We use 0.011 to more than match the number of significant digits we print o
ut when dumping the render tree. | 48 // We use 0.011 to more than match the number of significant digits we print |
| 49 // out when dumping the render tree. |
48 static const double s_epsilon = 0.011; | 50 static const double s_epsilon = 0.011; |
49 int ival = static_cast<int>(round(val)); | 51 int ival = static_cast<int>(round(val)); |
50 double dval = static_cast<double>(ival); | 52 double dval = static_cast<double>(ival); |
51 return fabs(val - dval) > s_epsilon; | 53 return fabs(val - dval) > s_epsilon; |
52 } | 54 } |
53 | 55 |
54 TextStream& TextStream::operator<<(bool b) { | 56 TextStream& TextStream::operator<<(bool b) { |
55 return *this << (b ? "1" : "0"); | 57 return *this << (b ? "1" : "0"); |
56 } | 58 } |
57 | 59 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 TextStream& operator<<(TextStream& ts, const LayoutSize& size) { | 173 TextStream& operator<<(TextStream& ts, const LayoutSize& size) { |
172 return ts << FloatSize(size); | 174 return ts << FloatSize(size); |
173 } | 175 } |
174 | 176 |
175 void writeIndent(TextStream& ts, int indent) { | 177 void writeIndent(TextStream& ts, int indent) { |
176 for (int i = 0; i != indent; ++i) | 178 for (int i = 0; i != indent; ++i) |
177 ts << " "; | 179 ts << " "; |
178 } | 180 } |
179 | 181 |
180 } // namespace blink | 182 } // namespace blink |
OLD | NEW |