Fixed makeString(float) to do shortest-form serialization without first converting...
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Mar 2019 20:54:59 +0000 (20:54 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 2 Mar 2019 20:54:59 +0000 (20:54 +0000)
commit56c9ee3a1c96c2ba33eb611b4fc24411f5cf896a
treebd6a1d8f1281ac70e87addd5d5b24df430217104
parentfb7299326d8253054957b39e52f8707ba696c3fb
Fixed makeString(float) to do shortest-form serialization without first converting to double
https://bugs.webkit.org/show_bug.cgi?id=195142

Reviewed by Daniel Bates.

Source/WebCore:

* platform/graphics/Color.cpp: Removed unneeded include of DecimalNumber.h.

Source/WebKit:

* UIProcess/PerActivityStateCPUUsageSampler.cpp: Removed unneeded include of DecimalNumber.h.

Source/WTF:

* wtf/DecimalNumber.cpp: Removed unneeded includes.

* wtf/DecimalNumber.h: Removed unused constructors; over time we will be
deprecating DecimalNumber, so we should removed the unused parts. Also
marked the constructor explicit, removed types used only for arguments for
the constructors, and removed the sign, exponent, significand, and precision
member functions.

* wtf/JSONValues.cpp:
(WTF::JSONImpl::Value::writeJSON const): Updated for changes to DecimalNumber
switched from NumberToLStringBuffer to NumberToStringBuffer, and for use of
std::array instead of C arrays.

* wtf/dtoa.cpp: Removed unused dtoaRoundSF and dtoaRoundDP functions.
(WTF::dtoa): Updated to use std::array instead of C arrays.
(WTF::dtoaRoundSF): Removed.
(WTF::dtoaRoundDP): Removed.
(WTF::numberToString): Added an overload for float and updated to use std::array.
(WTF::formatStringTruncatingTrailingZerosIfNeeded): Updated to use std::array.
(WTF::numberToFixedPrecisionString): Ditto.
(WTF::numberToFixedWidthString): Ditto.

* wtf/dtoa.h: Changed arrays to be std::array instead of C arrays so the
array types will be checked. Removed dtoaRoundSF and dtoaRoundDP.
Added float overloads for numberToString, numberToFixedPrecisionString,
and numberToFixedWidthString. The only one of these that is called at this
time is numberToString, called by the floating point StringTypeAdapter in
StringConcatenateNummbers.h.

* wtf/text/StringConcatenateNumbers.h: Updated for std::array.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242316 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/DecimalNumber.cpp
Source/WTF/wtf/DecimalNumber.h
Source/WTF/wtf/JSONValues.cpp
Source/WTF/wtf/dtoa.cpp
Source/WTF/wtf/dtoa.h
Source/WTF/wtf/text/StringConcatenateNumbers.h
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/Color.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/PerActivityStateCPUUsageSampler.cpp