| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2002, 2003 The Karbon Developers | 2 * Copyright (C) 2002, 2003 The Karbon Developers |
| 3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> | 3 * Copyright (C) 2006 Alexander Kellett <lypanov@kde.org> |
| 4 * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org> | 4 * Copyright (C) 2006, 2007 Rob Buis <buis@kde.org> |
| 5 * Copyright (C) 2007, 2009, 2013 Apple Inc. All rights reserved. | 5 * Copyright (C) 2007, 2009, 2013 Apple Inc. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include <limits> | 26 #include <limits> |
| 27 | 27 |
| 28 namespace blink { | 28 namespace blink { |
| 29 | 29 |
| 30 template <typename FloatType> | 30 template <typename FloatType> |
| 31 static inline bool isValidRange(const FloatType& x) { | 31 static inline bool isValidRange(const FloatType& x) { |
| 32 static const FloatType max = std::numeric_limits<FloatType>::max(); | 32 static const FloatType max = std::numeric_limits<FloatType>::max(); |
| 33 return x >= -max && x <= max; | 33 return x >= -max && x <= max; |
| 34 } | 34 } |
| 35 | 35 |
| 36 // We use this generic parseNumber function to allow the Path parsing code to wo
rk | 36 // We use this generic parseNumber function to allow the Path parsing code to |
| 37 // at a higher precision internally, without any unnecessary runtime cost or cod
e | 37 // work at a higher precision internally, without any unnecessary runtime cost |
| 38 // complexity. | 38 // or code complexity. |
| 39 template <typename CharType, typename FloatType> | 39 template <typename CharType, typename FloatType> |
| 40 static bool genericParseNumber(const CharType*& cursor, | 40 static bool genericParseNumber(const CharType*& cursor, |
| 41 const CharType* end, | 41 const CharType* end, |
| 42 FloatType& number, | 42 FloatType& number, |
| 43 WhitespaceMode mode) { | 43 WhitespaceMode mode) { |
| 44 FloatType integer, decimal, frac, exponent; | 44 FloatType integer, decimal, frac, exponent; |
| 45 int sign, expsign; | 45 int sign, expsign; |
| 46 | 46 |
| 47 exponent = 0; | 47 exponent = 0; |
| 48 integer = 0; | 48 integer = 0; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 const LChar* ptr = string.characters8(); | 215 const LChar* ptr = string.characters8(); |
| 216 const LChar* end = ptr + string.length(); | 216 const LChar* end = ptr + string.length(); |
| 217 return genericParseNumberOptionalNumber(ptr, end, x, y); | 217 return genericParseNumberOptionalNumber(ptr, end, x, y); |
| 218 } | 218 } |
| 219 const UChar* ptr = string.characters16(); | 219 const UChar* ptr = string.characters16(); |
| 220 const UChar* end = ptr + string.length(); | 220 const UChar* end = ptr + string.length(); |
| 221 return genericParseNumberOptionalNumber(ptr, end, x, y); | 221 return genericParseNumberOptionalNumber(ptr, end, x, y); |
| 222 } | 222 } |
| 223 | 223 |
| 224 } // namespace blink | 224 } // namespace blink |
| OLD | NEW |