Chromium Code Reviews| Index: third_party/WebKit/Source/platform/LayoutUnit.h |
| diff --git a/third_party/WebKit/Source/platform/LayoutUnit.h b/third_party/WebKit/Source/platform/LayoutUnit.h |
| index 16677770cb0f7be5762cf5721fd9ef0027c4a294..9afc99705b97924e0e9df7d2d3624a3e409d9226 100644 |
| --- a/third_party/WebKit/Source/platform/LayoutUnit.h |
| +++ b/third_party/WebKit/Source/platform/LayoutUnit.h |
| @@ -35,6 +35,7 @@ |
| #include "wtf/Assertions.h" |
| #include "wtf/MathExtras.h" |
| #include "wtf/SaturatedArithmetic.h" |
| +#include "wtf/text/WTFString.h" |
| #include <algorithm> |
| #include <limits.h> |
| #include <limits> |
| @@ -212,6 +213,19 @@ public: |
| return clampTo<LayoutUnit>(value, LayoutUnit::min(), LayoutUnit::max()); |
| } |
| + String toString() const |
| + { |
| + if (m_value == LayoutUnit::max().rawValue()) |
|
esprehn
2016/08/19 17:58:52
can we make this out of line?
|
| + return String::format("LayoutUnit::max(%f)", toDouble()); |
|
esprehn
2016/08/19 17:58:53
fwiw this is slow, doing "LayoutUnit::max(" + Stri
|
| + if (m_value == LayoutUnit::min().rawValue()) |
| + return String::format("LayoutUnit::min(%f)", toDouble()); |
| + if (m_value == LayoutUnit::nearlyMax().rawValue()) |
| + return String::format("LayoutUnit::nearlyMax(%f)", toDouble()); |
| + if (m_value == LayoutUnit::nearlyMin().rawValue()) |
| + return String::format("LayoutUnit::nearlyMin(%f)", toDouble()); |
| + return String::number(toDouble()); |
| + } |
| + |
| private: |
| static bool isInBounds(int value) |
| { |
| @@ -808,7 +822,7 @@ inline LayoutUnit clampToLayoutUnit(LayoutUnit value, LayoutUnit min, LayoutUnit |
| inline std::ostream& operator<<(std::ostream& stream, const LayoutUnit& value) |
| { |
| - return stream << value.toDouble(); |
| + return stream << value.toString(); |
| } |
| } // namespace blink |