/* * Copyright (C) 2002, 2003 The Karbon Developers * Copyright (C) 2006 Alexander Kellett <[email protected]> * Copyright (C) 2006, 2007 Rob Buis <[email protected]> * Copyright (C) 2007, 2009, 2013 Apple Inc. All rights reserved. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifdef UNSAFE_BUFFERS_BUILD // TODO(crbug.com/351564777): Remove this and convert code to safer constructs. #pragma allow_unsafe_buffers #endif #include "third_party/blink/renderer/core/svg/svg_parser_utilities.h" #include <limits> #include "third_party/blink/renderer/platform/wtf/math_extras.h" #include "third_party/blink/renderer/platform/wtf/text/character_visitor.h" namespace blink { template <typename FloatType> static inline bool IsValidRange(const FloatType x) { … } // We use this generic parseNumber function to allow the Path parsing code to // work at a higher precision internally, without any unnecessary runtime cost // or code complexity. template <typename CharType, typename FloatType> static bool GenericParseNumber(const CharType*& cursor, const CharType* end, FloatType& number, WhitespaceMode mode) { … } bool ParseNumber(const LChar*& ptr, const LChar* end, float& number, WhitespaceMode mode) { … } bool ParseNumber(const UChar*& ptr, const UChar* end, float& number, WhitespaceMode mode) { … } // only used to parse largeArcFlag and sweepFlag which must be a "0" or "1" // and might not have any whitespace/comma after it template <typename CharType> bool GenericParseArcFlag(const CharType*& ptr, const CharType* end, bool& flag) { … } bool ParseArcFlag(const LChar*& ptr, const LChar* end, bool& flag) { … } bool ParseArcFlag(const UChar*& ptr, const UChar* end, bool& flag) { … } bool ParseNumberOptionalNumber(const String& string, float& x, float& y) { … } } // namespace blink