Title: [242713] trunk/Source
Revision
242713
Author
[email protected]
Date
2019-03-11 10:11:13 -0700 (Mon, 11 Mar 2019)

Log Message

Specify fixed precision explicitly to prepare to change String::number and StringBuilder::appendNumber floating point behavior
https://bugs.webkit.org/show_bug.cgi?id=195533

Reviewed by Brent Fulgham.

Source/_javascript_Core:

* API/tests/ExecutionTimeLimitTest.cpp:
(testExecutionTimeLimit): Use appendFixedPrecisionNumber.
* runtime/NumberPrototype.cpp:
(JSC::numberProtoFuncToPrecision): Use numberToStringFixedPrecision.
* runtime/Options.cpp:
(JSC::Option::dump const): Use appendFixedPrecisionNumber.

Source/WebCore:

* accessibility/AccessibilityNodeObject.cpp:
(WebCore::AccessibilityNodeObject::changeValueByStep): Use numberToStringFixedPrecision.
(WebCore::AccessibilityNodeObject::changeValueByPercent): Ditto.
* accessibility/AccessibilityScrollbar.cpp:
(WebCore::AccessibilityScrollbar::setValue): Ditto.
* css/CSSFontVariationValue.cpp:
(WebCore::CSSFontVariationValue::customCSSText const): Use appendFixedPrecisionNumber.
* css/CSSGradientValue.cpp:
(WebCore::CSSLinearGradientValue::customCSSText const): Ditto.
(WebCore::CSSRadialGradientValue::customCSSText const): Ditto.
* css/CSSKeyframeRule.cpp:
(WebCore::StyleRuleKeyframe::keyText const): Ditto.
* css/CSSTimingFunctionValue.cpp:
(WebCore::CSSCubicBezierTimingFunctionValue::customCSSText const): Ditto.
(WebCore::CSSSpringTimingFunctionValue::customCSSText const): Ditto.
* css/parser/CSSParserToken.cpp:
(WebCore::CSSParserToken::serialize const): Ditto.
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::completeURLsInAttributeValue const): Ditto.
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::drawRulers): Use numberToStringFixedPrecision.
* loader/ResourceLoadStatistics.cpp:
(WebCore::ResourceLoadStatistics::toString const): Use appendFixedPrecisionNumber.
* page/PrintContext.cpp:
(WebCore::PrintContext::pageProperty): Use numberToStringFixedPrecision.
* page/cocoa/ResourceUsageOverlayCocoa.mm:
(WebCore::gcTimerString): Use numberToStringFixedPrecision.
* platform/LayoutUnit.h:
(WTF::ValueToString<WebCore::LayoutUnit>::string): Ditto.
* platform/graphics/Color.cpp:
(WebCore::Color::cssText const): Use appendFixedPrecisionNumber.
* platform/graphics/ExtendedColor.cpp:
(WebCore::ExtendedColor::cssText const): Ditto.
* svg/SVGAngleValue.cpp:
(WebCore::SVGAngleValue::valueAsString const): Use numberToStringFixedPrecision.
* svg/SVGNumberListValues.cpp:
(WebCore::SVGNumberListValues::valueAsString const): Use appendFixedPrecisionNumber.
* svg/SVGPathStringBuilder.cpp:
(WebCore::appendNumber): Ditto.
(WebCore::appendPoint): Ditto.
* svg/SVGPointListValues.cpp:
(WebCore::SVGPointListValues::valueAsString const): Ditto.
* svg/SVGTransformValue.cpp:
(WebCore::SVGTransformValue::valueAsString const): Ditto.
* svg/properties/SVGPropertyTraits.h:
(WebCore::SVGPropertyTraits<float>::toString): Use numberToStringFixedPrecision.
(WebCore::SVGPropertyTraits<FloatPoint>::toString): Use appendFixedPrecisionNumber.
(WebCore::SVGPropertyTraits<FloatRect>::toString): Ditto.
* testing/Internals.cpp:
(WebCore::Internals::dumpMarkerRects): Use appendFixedPrecisionNumber.
(WebCore::Internals::getCurrentCursorInfo): Ditto.
* xml/XPathValue.cpp:
(WebCore::XPath::Value::toString const): Use numberToStringFixedPrecision.

Source/WebKit:

* NetworkProcess/cache/NetworkCache.cpp:
(WebKit::NetworkCache::Cache::dumpContentsToFile): Use appendFixedPrecisionNumber.
* NetworkProcess/cache/NetworkCacheEntry.cpp:
(WebKit::NetworkCache::Entry::asJSON const): Ditto.
* Shared/Gamepad/GamepadData.cpp:
(WebKit::GamepadData::loggingString const): Ditto.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::logDiagnosticMessageWithValue): Use numberToStringFixedPrecision.

Source/WTF:

Soon, we will change String::number and StringBuilder::appendNumber for floating
point to use "shortest form" serialization instead of the current default, which is
"6-digit fixed precision stripping trailing zeros". To prepare to do this safely
without accidentally changing any behavior, changing callers to call the explicit
versions. Later, we may want to return and change many of them to use shortest form
instead, but that may require rebaselining tests, and in some extreme cases, getting
rid of flawed logic that converts between different single and double precision
floating point; such problems may be hidden by fixed precision serialization.

Since "shortest form" is already the behavior for AtomicString::number and
for makeString, no changes required for clients of either of those.

* wtf/Logger.h:
(WTF::LogArgument::toString): Use numberToStringFixedPrecision.
* wtf/MediaTime.cpp:
(WTF::MediaTime::toString const): Use appendFixedPrecisionNumber.
* wtf/text/ValueToString.h:
(WTF::ValueToString<float>::string): Use numberToStringFixedPrecision.
(WTF::ValueToString<double>::string): Ditto.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/API/tests/ExecutionTimeLimitTest.cpp (242712 => 242713)


--- trunk/Source/_javascript_Core/API/tests/ExecutionTimeLimitTest.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/_javascript_Core/API/tests/ExecutionTimeLimitTest.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -194,7 +194,7 @@
 
             StringBuilder scriptBuilder;
             scriptBuilder.appendLiteral("function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
-            scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired.seconds());
+            scriptBuilder.appendFixedPrecisionNumber(timeAfterWatchdogShouldHaveFired.seconds());
             scriptBuilder.appendLiteral(") break; } } foo();");
 
             JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
@@ -235,7 +235,7 @@
                                      "'use strict';"
                                      "if (i % 1000 === 0) {"
                                         "if (currentCPUTime() - startTime >");
-            scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired.seconds());
+            scriptBuilder.appendFixedPrecisionNumber(timeAfterWatchdogShouldHaveFired.seconds());
             scriptBuilder.appendLiteral("       ) { return; }");
             scriptBuilder.appendLiteral("    }");
             scriptBuilder.appendLiteral("    return recurse(i + 1); }");
@@ -275,7 +275,7 @@
             
             StringBuilder scriptBuilder;
             scriptBuilder.appendLiteral("function foo() { var startTime = currentCPUTime(); try { while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
-            scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired.seconds());
+            scriptBuilder.appendFixedPrecisionNumber(timeAfterWatchdogShouldHaveFired.seconds());
             scriptBuilder.appendLiteral(") break; } } catch(e) { } } foo();");
 
             JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
@@ -314,7 +314,7 @@
             
             StringBuilder scriptBuilder;
             scriptBuilder.appendLiteral("function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
-            scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired.seconds());
+            scriptBuilder.appendFixedPrecisionNumber(timeAfterWatchdogShouldHaveFired.seconds());
             scriptBuilder.appendLiteral(") break; } } foo();");
             
             JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
@@ -353,7 +353,7 @@
             
             StringBuilder scriptBuilder;
             scriptBuilder.appendLiteral("function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
-            scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired.seconds());
+            scriptBuilder.appendFixedPrecisionNumber(timeAfterWatchdogShouldHaveFired.seconds());
             scriptBuilder.appendLiteral(") break; } } foo();");
 
             JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
@@ -392,7 +392,7 @@
 
             StringBuilder scriptBuilder;
             scriptBuilder.appendLiteral("function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
-            scriptBuilder.appendNumber(maxBusyLoopTime.seconds()); // in seconds.
+            scriptBuilder.appendFixedPrecisionNumber(maxBusyLoopTime.seconds()); // in seconds.
             scriptBuilder.appendLiteral(") break; } } foo();");
 
             JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
@@ -435,7 +435,7 @@
 
             StringBuilder scriptBuilder;
             scriptBuilder.appendLiteral("function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
-            scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired.seconds());
+            scriptBuilder.appendFixedPrecisionNumber(timeAfterWatchdogShouldHaveFired.seconds());
             scriptBuilder.appendLiteral(") break; } } foo();");
 
             JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());

Modified: trunk/Source/_javascript_Core/ChangeLog (242712 => 242713)


--- trunk/Source/_javascript_Core/ChangeLog	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/_javascript_Core/ChangeLog	2019-03-11 17:11:13 UTC (rev 242713)
@@ -1,3 +1,17 @@
+2019-03-11  Darin Adler  <[email protected]>
+
+        Specify fixed precision explicitly to prepare to change String::number and StringBuilder::appendNumber floating point behavior
+        https://bugs.webkit.org/show_bug.cgi?id=195533
+
+        Reviewed by Brent Fulgham.
+
+        * API/tests/ExecutionTimeLimitTest.cpp:
+        (testExecutionTimeLimit): Use appendFixedPrecisionNumber.
+        * runtime/NumberPrototype.cpp:
+        (JSC::numberProtoFuncToPrecision): Use numberToStringFixedPrecision.
+        * runtime/Options.cpp:
+        (JSC::Option::dump const): Use appendFixedPrecisionNumber.
+
 2019-03-10  Ross Kirsling  <[email protected]>
 
         Invalid flags in a RegExp literal should be an early SyntaxError

Modified: trunk/Source/_javascript_Core/runtime/NumberPrototype.cpp (242712 => 242713)


--- trunk/Source/_javascript_Core/runtime/NumberPrototype.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/_javascript_Core/runtime/NumberPrototype.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -505,7 +505,7 @@
     if (!inRange)
         return throwVMError(exec, scope, createRangeError(exec, "toPrecision() argument must be between 1 and 21"_s));
 
-    return JSValue::encode(jsString(exec, String::number(x, significantFigures, KeepTrailingZeros)));
+    return JSValue::encode(jsString(exec, String::numberToStringFixedPrecision(x, significantFigures, KeepTrailingZeros)));
 }
 
 static ALWAYS_INLINE JSString* int32ToStringInternal(VM& vm, int32_t value, int32_t radix)

Modified: trunk/Source/_javascript_Core/runtime/Options.cpp (242712 => 242713)


--- trunk/Source/_javascript_Core/runtime/Options.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/_javascript_Core/runtime/Options.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -906,7 +906,7 @@
         builder.appendNumber(m_entry.sizeVal);
         break;
     case Options::Type::doubleType:
-        builder.appendNumber(m_entry.doubleVal);
+        builder.appendFixedPrecisionNumber(m_entry.doubleVal);
         break;
     case Options::Type::int32Type:
         builder.appendNumber(m_entry.int32Val);

Modified: trunk/Source/WTF/ChangeLog (242712 => 242713)


--- trunk/Source/WTF/ChangeLog	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WTF/ChangeLog	2019-03-11 17:11:13 UTC (rev 242713)
@@ -1,3 +1,30 @@
+2019-03-11  Darin Adler  <[email protected]>
+
+        Specify fixed precision explicitly to prepare to change String::number and StringBuilder::appendNumber floating point behavior
+        https://bugs.webkit.org/show_bug.cgi?id=195533
+
+        Reviewed by Brent Fulgham.
+
+        Soon, we will change String::number and StringBuilder::appendNumber for floating
+        point to use "shortest form" serialization instead of the current default, which is
+        "6-digit fixed precision stripping trailing zeros". To prepare to do this safely
+        without accidentally changing any behavior, changing callers to call the explicit
+        versions. Later, we may want to return and change many of them to use shortest form
+        instead, but that may require rebaselining tests, and in some extreme cases, getting
+        rid of flawed logic that converts between different single and double precision
+        floating point; such problems may be hidden by fixed precision serialization.
+
+        Since "shortest form" is already the behavior for AtomicString::number and
+        for makeString, no changes required for clients of either of those.
+
+        * wtf/Logger.h:
+        (WTF::LogArgument::toString): Use numberToStringFixedPrecision.
+        * wtf/MediaTime.cpp:
+        (WTF::MediaTime::toString const): Use appendFixedPrecisionNumber.
+        * wtf/text/ValueToString.h:
+        (WTF::ValueToString<float>::string): Use numberToStringFixedPrecision.
+        (WTF::ValueToString<double>::string): Ditto.
+
 2019-03-11  Truitt Savell  <[email protected]>
 
         Unreviewed, rolling out r242702.

Modified: trunk/Source/WTF/wtf/Logger.h (242712 => 242713)


--- trunk/Source/WTF/wtf/Logger.h	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WTF/wtf/Logger.h	2019-03-11 17:11:13 UTC (rev 242713)
@@ -36,8 +36,8 @@
     template<typename U = T> static typename std::enable_if<std::is_same<U, unsigned>::value, String>::type toString(unsigned argument) { return String::number(argument); }
     template<typename U = T> static typename std::enable_if<std::is_same<U, unsigned long>::value, String>::type toString(unsigned long argument) { return String::number(argument); }
     template<typename U = T> static typename std::enable_if<std::is_same<U, long>::value, String>::type toString(long argument) { return String::number(argument); }
-    template<typename U = T> static typename std::enable_if<std::is_same<U, float>::value, String>::type toString(float argument) { return String::number(argument); }
-    template<typename U = T> static typename std::enable_if<std::is_same<U, double>::value, String>::type toString(double argument) { return String::number(argument); }
+    template<typename U = T> static typename std::enable_if<std::is_same<U, float>::value, String>::type toString(float argument) { return String::numberToStringFixedPrecision(argument); }
+    template<typename U = T> static typename std::enable_if<std::is_same<U, double>::value, String>::type toString(double argument) { return String::numberToStringFixedPrecision(argument); }
     template<typename U = T> static typename std::enable_if<std::is_same<typename std::remove_reference<U>::type, AtomicString>::value, String>::type toString(const AtomicString& argument) { return argument.string(); }
     template<typename U = T> static typename std::enable_if<std::is_same<typename std::remove_reference<U>::type, String>::value, String>::type toString(String argument) { return argument; }
     template<typename U = T> static typename std::enable_if<std::is_same<typename std::remove_reference<U>::type, StringBuilder*>::value, String>::type toString(StringBuilder* argument) { return argument->toString(); }

Modified: trunk/Source/WTF/wtf/MediaTime.cpp (242712 => 242713)


--- trunk/Source/WTF/wtf/MediaTime.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WTF/wtf/MediaTime.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -593,7 +593,7 @@
         builder.appendNumber(m_timeScale);
         builder.appendLiteral(" = ");
     }
-    builder.appendNumber(toDouble());
+    builder.appendFixedPrecisionNumber(toDouble());
     builder.append('}');
     return builder.toString();
 }

Modified: trunk/Source/WTF/wtf/text/ValueToString.h (242712 => 242713)


--- trunk/Source/WTF/wtf/text/ValueToString.h	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WTF/wtf/text/ValueToString.h	2019-03-11 17:11:13 UTC (rev 242713)
@@ -35,22 +35,18 @@
 
 namespace WTF {
 
-template<class T>
-struct ValueToString;
+template<typename> struct ValueToString;
 
-template <>
-struct ValueToString<int> {
-    static String string(const int value) { return String::number(value); }
+template<> struct ValueToString<int> {
+    static String string(int value) { return String::number(value); }
 };
 
-template <>
-struct ValueToString<float> {
-    static String string(const float value) { return String::number(value); }
+template<> struct ValueToString<float> {
+    static String string(float value) { return String::numberToStringFixedPrecision(value); }
 };
 
-template <>
-struct ValueToString<double> {
-    static String string(const double value) { return String::number(value); }
+template<> struct ValueToString<double> {
+    static String string(double value) { return String::numberToStringFixedPrecision(value); }
 };
 
 } // namespace WTF

Modified: trunk/Source/WebCore/ChangeLog (242712 => 242713)


--- trunk/Source/WebCore/ChangeLog	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/ChangeLog	2019-03-11 17:11:13 UTC (rev 242713)
@@ -1,3 +1,64 @@
+2019-03-11  Darin Adler  <[email protected]>
+
+        Specify fixed precision explicitly to prepare to change String::number and StringBuilder::appendNumber floating point behavior
+        https://bugs.webkit.org/show_bug.cgi?id=195533
+
+        Reviewed by Brent Fulgham.
+
+        * accessibility/AccessibilityNodeObject.cpp:
+        (WebCore::AccessibilityNodeObject::changeValueByStep): Use numberToStringFixedPrecision.
+        (WebCore::AccessibilityNodeObject::changeValueByPercent): Ditto.
+        * accessibility/AccessibilityScrollbar.cpp:
+        (WebCore::AccessibilityScrollbar::setValue): Ditto.
+        * css/CSSFontVariationValue.cpp:
+        (WebCore::CSSFontVariationValue::customCSSText const): Use appendFixedPrecisionNumber.
+        * css/CSSGradientValue.cpp:
+        (WebCore::CSSLinearGradientValue::customCSSText const): Ditto.
+        (WebCore::CSSRadialGradientValue::customCSSText const): Ditto.
+        * css/CSSKeyframeRule.cpp:
+        (WebCore::StyleRuleKeyframe::keyText const): Ditto.
+        * css/CSSTimingFunctionValue.cpp:
+        (WebCore::CSSCubicBezierTimingFunctionValue::customCSSText const): Ditto.
+        (WebCore::CSSSpringTimingFunctionValue::customCSSText const): Ditto.
+        * css/parser/CSSParserToken.cpp:
+        (WebCore::CSSParserToken::serialize const): Ditto.
+        * html/HTMLImageElement.cpp:
+        (WebCore::HTMLImageElement::completeURLsInAttributeValue const): Ditto.
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::drawRulers): Use numberToStringFixedPrecision.
+        * loader/ResourceLoadStatistics.cpp:
+        (WebCore::ResourceLoadStatistics::toString const): Use appendFixedPrecisionNumber.
+        * page/PrintContext.cpp:
+        (WebCore::PrintContext::pageProperty): Use numberToStringFixedPrecision.
+        * page/cocoa/ResourceUsageOverlayCocoa.mm:
+        (WebCore::gcTimerString): Use numberToStringFixedPrecision.
+        * platform/LayoutUnit.h:
+        (WTF::ValueToString<WebCore::LayoutUnit>::string): Ditto.
+        * platform/graphics/Color.cpp:
+        (WebCore::Color::cssText const): Use appendFixedPrecisionNumber.
+        * platform/graphics/ExtendedColor.cpp:
+        (WebCore::ExtendedColor::cssText const): Ditto.
+        * svg/SVGAngleValue.cpp:
+        (WebCore::SVGAngleValue::valueAsString const): Use numberToStringFixedPrecision.
+        * svg/SVGNumberListValues.cpp:
+        (WebCore::SVGNumberListValues::valueAsString const): Use appendFixedPrecisionNumber.
+        * svg/SVGPathStringBuilder.cpp:
+        (WebCore::appendNumber): Ditto.
+        (WebCore::appendPoint): Ditto.
+        * svg/SVGPointListValues.cpp:
+        (WebCore::SVGPointListValues::valueAsString const): Ditto.
+        * svg/SVGTransformValue.cpp:
+        (WebCore::SVGTransformValue::valueAsString const): Ditto.
+        * svg/properties/SVGPropertyTraits.h:
+        (WebCore::SVGPropertyTraits<float>::toString): Use numberToStringFixedPrecision.
+        (WebCore::SVGPropertyTraits<FloatPoint>::toString): Use appendFixedPrecisionNumber.
+        (WebCore::SVGPropertyTraits<FloatRect>::toString): Ditto.
+        * testing/Internals.cpp:
+        (WebCore::Internals::dumpMarkerRects): Use appendFixedPrecisionNumber.
+        (WebCore::Internals::getCurrentCursorInfo): Ditto.
+        * xml/XPathValue.cpp:
+        (WebCore::XPath::Value::toString const): Use numberToStringFixedPrecision.
+
 2019-03-11  Philippe Normand  <[email protected]>
 
         Unreviewed, Non-GStreamer-GL build fix after r242701.

Modified: trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp (242712 => 242713)


--- trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/accessibility/AccessibilityNodeObject.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -1098,7 +1098,7 @@
 
     value += increase ? step : -step;
 
-    setValue(String::number(value));
+    setValue(String::numberToStringFixedPrecision(value));
 
     axObjectCache()->postNotification(node(), AXObjectCache::AXValueChanged);
 }
@@ -1110,11 +1110,11 @@
     float value = valueForRange();
 
     // Make sure the specified percent will cause a change of one integer step or larger.
-    if (fabs(step) < 1)
-        step = fabs(percentChange) * (1 / percentChange);
+    if (std::abs(step) < 1)
+        step = std::abs(percentChange) * (1 / percentChange);
 
     value += step;
-    setValue(String::number(value));
+    setValue(String::numberToStringFixedPrecision(value));
 
     axObjectCache()->postNotification(node(), AXObjectCache::AXValueChanged);
 }

Modified: trunk/Source/WebCore/accessibility/AccessibilityScrollbar.cpp (242712 => 242713)


--- trunk/Source/WebCore/accessibility/AccessibilityScrollbar.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/accessibility/AccessibilityScrollbar.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -98,7 +98,7 @@
         return;
     
     float newValue = value * m_scrollbar->maximum();
-    if (dispatchAccessibleSetValueEvent(String::number(newValue)))
+    if (dispatchAccessibleSetValueEvent(String::numberToStringFixedPrecision(newValue)))
         return;
     m_scrollbar->scrollableArea().scrollToOffsetWithoutAnimation(m_scrollbar->orientation(), newValue);
 }

Modified: trunk/Source/WebCore/css/CSSFontVariationValue.cpp (242712 => 242713)


--- trunk/Source/WebCore/css/CSSFontVariationValue.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/css/CSSFontVariationValue.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -47,7 +47,7 @@
     for (char c : m_tag)
         builder.append(c);
     builder.appendLiteral("\" ");
-    builder.appendNumber(m_value);
+    builder.appendFixedPrecisionNumber(m_value);
     return builder.toString();
 }
 

Modified: trunk/Source/WebCore/css/CSSGradientValue.cpp (242712 => 242713)


--- trunk/Source/WebCore/css/CSSGradientValue.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/css/CSSGradientValue.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -693,7 +693,7 @@
                 result.append(')');
             } else {
                 result.appendLiteral("color-stop(");
-                result.appendNumber(position);
+                result.appendFixedPrecisionNumber(position);
                 result.appendLiteral(", ");
                 result.append(stop.m_color->cssText());
                 result.append(')');
@@ -974,7 +974,7 @@
                 result.append(')');
             } else {
                 result.appendLiteral("color-stop(");
-                result.appendNumber(position);
+                result.appendFixedPrecisionNumber(position);
                 result.appendLiteral(", ");
                 result.append(stop.m_color->cssText());
                 result.append(')');

Modified: trunk/Source/WebCore/css/CSSKeyframeRule.cpp (242712 => 242713)


--- trunk/Source/WebCore/css/CSSKeyframeRule.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/css/CSSKeyframeRule.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -63,7 +63,7 @@
     for (size_t i = 0; i < m_keys.size(); ++i) {
         if (i)
             keyText.append(',');
-        keyText.appendNumber(m_keys.at(i) * 100);
+        keyText.appendFixedPrecisionNumber(m_keys.at(i) * 100);
         keyText.append('%');
     }
 

Modified: trunk/Source/WebCore/css/CSSTimingFunctionValue.cpp (242712 => 242713)


--- trunk/Source/WebCore/css/CSSTimingFunctionValue.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/css/CSSTimingFunctionValue.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -34,13 +34,13 @@
 {
     StringBuilder builder;
     builder.appendLiteral("cubic-bezier(");
-    builder.appendNumber(m_x1);
+    builder.appendFixedPrecisionNumber(m_x1);
     builder.appendLiteral(", ");
-    builder.appendNumber(m_y1);
+    builder.appendFixedPrecisionNumber(m_y1);
     builder.appendLiteral(", ");
-    builder.appendNumber(m_x2);
+    builder.appendFixedPrecisionNumber(m_x2);
     builder.appendLiteral(", ");
-    builder.appendNumber(m_y2);
+    builder.appendFixedPrecisionNumber(m_y2);
     builder.append(')');    
     return builder.toString();
 }
@@ -71,13 +71,13 @@
 {
     StringBuilder builder;
     builder.appendLiteral("spring(");
-    builder.appendNumber(m_mass);
+    builder.appendFixedPrecisionNumber(m_mass);
     builder.append(' ');
-    builder.appendNumber(m_stiffness);
+    builder.appendFixedPrecisionNumber(m_stiffness);
     builder.append(' ');
-    builder.appendNumber(m_damping);
+    builder.appendFixedPrecisionNumber(m_damping);
     builder.append(' ');
-    builder.appendNumber(m_initialVelocity);
+    builder.appendFixedPrecisionNumber(m_initialVelocity);
     builder.append(')');
     return builder.toString();
 }

Modified: trunk/Source/WebCore/css/parser/CSSParserToken.cpp (242712 => 242713)


--- trunk/Source/WebCore/css/parser/CSSParserToken.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/css/parser/CSSParserToken.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -419,15 +419,15 @@
         // These won't properly preserve the NumericValueType flag
         if (m_numericSign == PlusSign)
             builder.append('+');
-        builder.appendNumber(numericValue());
+        builder.appendFixedPrecisionNumber(numericValue());
         break;
     case PercentageToken:
-        builder.appendNumber(numericValue());
+        builder.appendFixedPrecisionNumber(numericValue());
         builder.append('%');
         break;
     case DimensionToken:
         // This will incorrectly serialize e.g. 4e3e2 as 4000e2
-        builder.appendNumber(numericValue());
+        builder.appendFixedPrecisionNumber(numericValue());
         serializeIdentifier(value().toString(), builder);
         break;
     case UnicodeRangeToken:

Modified: trunk/Source/WebCore/html/HTMLImageElement.cpp (242712 => 242713)


--- trunk/Source/WebCore/html/HTMLImageElement.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/html/HTMLImageElement.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -551,7 +551,7 @@
             result.append(URL(base, candidate.string.toString()).string());
             if (candidate.density != UninitializedDescriptor) {
                 result.append(' ');
-                result.appendNumber(candidate.density);
+                result.appendFixedPrecisionNumber(candidate.density);
                 result.append('x');
             }
             if (candidate.resourceWidth != UninitializedDescriptor) {

Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (242712 => 242713)


--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -782,7 +782,7 @@
 
                 GraphicsContextStateSaver verticalLabelStateSaver(context);
                 context.translate(zoom(x) + 0.5f, scrollY);
-                context.drawText(font, TextRun(String::number(x)), { 2, rulerLabelSize });
+                context.drawText(font, TextRun(String::numberToStringFixedPrecision(x)), { 2, rulerLabelSize });
             }
 
             for (float y = multipleBelow(minY, rulerStepIncrement * 2); y < maxY; y += rulerStepIncrement * 2) {
@@ -792,7 +792,7 @@
                 GraphicsContextStateSaver horizontalLabelStateSaver(context);
                 context.translate(scrollX, zoom(y) + 0.5f);
                 context.rotate(-piOverTwoFloat);
-                context.drawText(font, TextRun(String::number(y)), { 2, rulerLabelSize });
+                context.drawText(font, TextRun(String::numberToStringFixedPrecision(y)), { 2, rulerLabelSize });
             }
         }
     }

Modified: trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp (242712 => 242713)


--- trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -412,7 +412,7 @@
     builder.append(registrableDomain.string());
     builder.append('\n');
     builder.appendLiteral("    lastSeen: ");
-    builder.appendNumber(lastSeen.secondsSinceEpoch().value());
+    builder.appendFixedPrecisionNumber(lastSeen.secondsSinceEpoch().value());
     builder.append('\n');
     
     // User interaction
@@ -419,7 +419,7 @@
     appendBoolean(builder, "hadUserInteraction", hadUserInteraction);
     builder.append('\n');
     builder.appendLiteral("    mostRecentUserInteraction: ");
-    builder.appendNumber(mostRecentUserInteractionTime.secondsSinceEpoch().value());
+    builder.appendFixedPrecisionNumber(mostRecentUserInteractionTime.secondsSinceEpoch().value());
     builder.append('\n');
     appendBoolean(builder, "grandfathered", grandfathered);
     builder.append('\n');

Modified: trunk/Source/WebCore/page/PrintContext.cpp (242712 => 242713)


--- trunk/Source/WebCore/page/PrintContext.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/page/PrintContext.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -326,10 +326,10 @@
     if (!strcmp(propertyName, "margin-left")) {
         if (style->marginLeft().isAuto())
             return "auto"_s;
-        return String::number(style->marginLeft().value());
+        return String::numberToStringFixedPrecision(style->marginLeft().value());
     }
     if (!strcmp(propertyName, "line-height"))
-        return String::number(style->lineHeight().value());
+        return String::numberToStringFixedPrecision(style->lineHeight().value());
     if (!strcmp(propertyName, "font-size"))
         return String::number(style->fontDescription().computedPixelSize());
     if (!strcmp(propertyName, "font-family"))

Modified: trunk/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm (242712 => 242713)


--- trunk/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/page/cocoa/ResourceUsageOverlayCocoa.mm	2019-03-11 17:11:13 UTC (rev 242713)
@@ -439,7 +439,7 @@
 {
     if (std::isnan(timerFireDate))
         return "[not scheduled]"_s;
-    return String::number((timerFireDate - now).seconds());
+    return String::numberToStringFixedPrecision((timerFireDate - now).seconds());
 }
 
 void ResourceUsageOverlay::platformDraw(CGContextRef context)

Modified: trunk/Source/WebCore/platform/LayoutUnit.h (242712 => 242713)


--- trunk/Source/WebCore/platform/LayoutUnit.h	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/platform/LayoutUnit.h	2019-03-11 17:11:13 UTC (rev 242713)
@@ -833,12 +833,14 @@
 } // namespace WebCore
 
 #ifndef NDEBUG
+
 namespace WTF {
+
 // This structure is used by PODIntervalTree for debugging.
-template <>
-struct ValueToString<WebCore::LayoutUnit> {
-    static String string(const WebCore::LayoutUnit value) { return String::number(value.toFloat()); }
+template<> struct ValueToString<WebCore::LayoutUnit> {
+    static String string(WebCore::LayoutUnit value) { return String::numberToStringFixedPrecision(value.toFloat()); }
 };
 
 } // namespace WTF
+
 #endif

Modified: trunk/Source/WebCore/platform/graphics/Color.cpp (242712 => 242713)


--- trunk/Source/WebCore/platform/graphics/Color.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/platform/graphics/Color.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -377,7 +377,7 @@
     builder.appendNumber(static_cast<unsigned char>(blue()));
     if (colorHasAlpha) {
         builder.appendLiteral(", ");
-        builder.appendNumber(alpha() / 255.0f);
+        builder.appendFixedPrecisionNumber(alpha() / 255.0f);
     }
         
     builder.append(')');

Modified: trunk/Source/WebCore/platform/graphics/ExtendedColor.cpp (242712 => 242713)


--- trunk/Source/WebCore/platform/graphics/ExtendedColor.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/platform/graphics/ExtendedColor.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -56,16 +56,16 @@
         return WTF::emptyString();
     }
 
-    builder.appendNumber(red());
+    builder.appendFixedPrecisionNumber(red());
     builder.append(' ');
 
-    builder.appendNumber(green());
+    builder.appendFixedPrecisionNumber(green());
     builder.append(' ');
 
-    builder.appendNumber(blue());
+    builder.appendFixedPrecisionNumber(blue());
     if (!WTF::areEssentiallyEqual(alpha(), 1.0f)) {
         builder.appendLiteral(" / ");
-        builder.appendNumber(alpha());
+        builder.appendFixedPrecisionNumber(alpha());
     }
     builder.append(')');
 

Modified: trunk/Source/WebCore/svg/SVGAngleValue.cpp (242712 => 242713)


--- trunk/Source/WebCore/svg/SVGAngleValue.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/svg/SVGAngleValue.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -73,7 +73,7 @@
         return makeString(FormattedNumber::fixedPrecision(m_valueInSpecifiedUnits), "grad");
     case SVG_ANGLETYPE_UNSPECIFIED:
     case SVG_ANGLETYPE_UNKNOWN:
-        return String::number(m_valueInSpecifiedUnits);
+        return String::numberToStringFixedPrecision(m_valueInSpecifiedUnits);
     }
 
     ASSERT_NOT_REACHED();

Modified: trunk/Source/WebCore/svg/SVGNumberListValues.cpp (242712 => 242713)


--- trunk/Source/WebCore/svg/SVGNumberListValues.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/svg/SVGNumberListValues.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -52,7 +52,7 @@
         if (i > 0)
             builder.append(' ');
 
-        builder.appendNumber(at(i));
+        builder.appendFixedPrecisionNumber(at(i));
     }
 
     return builder.toString();

Modified: trunk/Source/WebCore/svg/SVGPathStringBuilder.cpp (242712 => 242713)


--- trunk/Source/WebCore/svg/SVGPathStringBuilder.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/svg/SVGPathStringBuilder.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -57,15 +57,15 @@
 
 static void appendNumber(StringBuilder& stringBuilder, float number)
 {
-    stringBuilder.appendNumber(number);
+    stringBuilder.appendFixedPrecisionNumber(number);
     stringBuilder.append(' ');
 }
 
 static void appendPoint(StringBuilder& stringBuilder, const FloatPoint& point)
 {
-    stringBuilder.appendNumber(point.x());
+    stringBuilder.appendFixedPrecisionNumber(point.x());
     stringBuilder.append(' ');
-    stringBuilder.appendNumber(point.y());
+    stringBuilder.appendFixedPrecisionNumber(point.y());
     stringBuilder.append(' ');
 }
 

Modified: trunk/Source/WebCore/svg/SVGPointListValues.cpp (242712 => 242713)


--- trunk/Source/WebCore/svg/SVGPointListValues.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/svg/SVGPointListValues.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -36,9 +36,9 @@
             builder.append(' '); // FIXME: Shouldn't we use commas to seperate?
 
         const auto& point = at(i);
-        builder.appendNumber(point.x());
+        builder.appendFixedPrecisionNumber(point.x());
         builder.append(' ');
-        builder.appendNumber(point.y());
+        builder.appendFixedPrecisionNumber(point.y());
     }
 
     return builder.toString();

Modified: trunk/Source/WebCore/svg/SVGTransformValue.cpp (242712 => 242713)


--- trunk/Source/WebCore/svg/SVGTransformValue.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/svg/SVGTransformValue.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -167,17 +167,17 @@
     case SVG_TRANSFORM_MATRIX: {
         StringBuilder builder;
         builder.append(prefix);
-        builder.appendNumber(m_matrix.a());
+        builder.appendFixedPrecisionNumber(m_matrix.a());
         builder.append(' ');
-        builder.appendNumber(m_matrix.b());
+        builder.appendFixedPrecisionNumber(m_matrix.b());
         builder.append(' ');
-        builder.appendNumber(m_matrix.c());
+        builder.appendFixedPrecisionNumber(m_matrix.c());
         builder.append(' ');
-        builder.appendNumber(m_matrix.d());
+        builder.appendFixedPrecisionNumber(m_matrix.d());
         builder.append(' ');
-        builder.appendNumber(m_matrix.e());
+        builder.appendFixedPrecisionNumber(m_matrix.e());
         builder.append(' ');
-        builder.appendNumber(m_matrix.f());
+        builder.appendFixedPrecisionNumber(m_matrix.f());
         builder.append(')');
         return builder.toString();
     }
@@ -184,9 +184,9 @@
     case SVG_TRANSFORM_TRANSLATE: {
         StringBuilder builder;
         builder.append(prefix);
-        builder.appendNumber(m_matrix.e());
+        builder.appendFixedPrecisionNumber(m_matrix.e());
         builder.append(' ');
-        builder.appendNumber(m_matrix.f());
+        builder.appendFixedPrecisionNumber(m_matrix.f());
         builder.append(')');
         return builder.toString();
     }
@@ -193,9 +193,9 @@
     case SVG_TRANSFORM_SCALE: {
         StringBuilder builder;
         builder.append(prefix);
-        builder.appendNumber(m_matrix.xScale());
+        builder.appendFixedPrecisionNumber(m_matrix.xScale());
         builder.append(' ');
-        builder.appendNumber(m_matrix.yScale());
+        builder.appendFixedPrecisionNumber(m_matrix.yScale());
         builder.append(')');
         return builder.toString();
     }
@@ -207,12 +207,12 @@
         float cy = narrowPrecisionToFloat(cosAngle != 1 ? (m_matrix.e() * sinAngle / (1 - cosAngle) + m_matrix.f()) / 2 : 0);
         StringBuilder builder;
         builder.append(prefix);
-        builder.appendNumber(m_angle);
+        builder.appendFixedPrecisionNumber(m_angle);
         if (cx || cy) {
             builder.append(' ');
-            builder.appendNumber(cx);
+            builder.appendFixedPrecisionNumber(cx);
             builder.append(' ');
-            builder.appendNumber(cy);
+            builder.appendFixedPrecisionNumber(cy);
         }
         builder.append(')');
         return builder.toString();
@@ -221,7 +221,7 @@
     case SVG_TRANSFORM_SKEWY: {
         StringBuilder builder;
         builder.append(prefix);
-        builder.appendNumber(m_angle);
+        builder.appendFixedPrecisionNumber(m_angle);
         builder.append(')');
         return builder.toString();
     }

Modified: trunk/Source/WebCore/svg/properties/SVGPropertyTraits.h (242712 => 242713)


--- trunk/Source/WebCore/svg/properties/SVGPropertyTraits.h	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/svg/properties/SVGPropertyTraits.h	2019-03-11 17:11:13 UTC (rev 242713)
@@ -103,7 +103,7 @@
             return WTF::nullopt;
         return number;
     }
-    static String toString(float type) { return String::number(type); }
+    static String toString(float type) { return String::numberToStringFixedPrecision(type); }
 };
 
 template<>
@@ -140,9 +140,9 @@
     static String toString(const FloatPoint& type)
     {
         StringBuilder builder;
-        builder.appendNumber(type.x());
+        builder.appendFixedPrecisionNumber(type.x());
         builder.append(' ');
-        builder.appendNumber(type.y());
+        builder.appendFixedPrecisionNumber(type.y());
         return builder.toString();
     }
 };
@@ -167,13 +167,13 @@
     static String toString(const FloatRect& type)
     {
         StringBuilder builder;
-        builder.appendNumber(type.x());
+        builder.appendFixedPrecisionNumber(type.x());
         builder.append(' ');
-        builder.appendNumber(type.y());
+        builder.appendFixedPrecisionNumber(type.y());
         builder.append(' ');
-        builder.appendNumber(type.width());
+        builder.appendFixedPrecisionNumber(type.width());
         builder.append(' ');
-        builder.appendNumber(type.height());
+        builder.appendFixedPrecisionNumber(type.height());
         return builder.toString();
     }
 };

Modified: trunk/Source/WebCore/testing/Internals.cpp (242712 => 242713)


--- trunk/Source/WebCore/testing/Internals.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/testing/Internals.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -1606,13 +1606,13 @@
     rectString.appendLiteral("marker rects: ");
     for (const auto& rect : rects) {
         rectString.append('(');
-        rectString.appendNumber(rect.x());
+        rectString.appendFixedPrecisionNumber(rect.x());
         rectString.appendLiteral(", ");
-        rectString.appendNumber(rect.y());
+        rectString.appendFixedPrecisionNumber(rect.y());
         rectString.appendLiteral(", ");
-        rectString.appendNumber(rect.width());
+        rectString.appendFixedPrecisionNumber(rect.width());
         rectString.appendLiteral(", ");
-        rectString.appendNumber(rect.height());
+        rectString.appendFixedPrecisionNumber(rect.height());
         rectString.appendLiteral(") ");
     }
     return rectString.toString();
@@ -3328,14 +3328,14 @@
     if (cursor.image()) {
         FloatSize size = cursor.image()->size();
         result.appendLiteral(" image=");
-        result.appendNumber(size.width());
+        result.appendFixedPrecisionNumber(size.width());
         result.append('x');
-        result.appendNumber(size.height());
+        result.appendFixedPrecisionNumber(size.height());
     }
 #if ENABLE(MOUSE_CURSOR_SCALE)
     if (cursor.imageScaleFactor() != 1) {
         result.appendLiteral(" scale=");
-        result.appendNumber(cursor.imageScaleFactor(), 8);
+        result.appendFixedPrecisionNumber(cursor.imageScaleFactor(), 8);
     }
 #endif
     return result.toString();

Modified: trunk/Source/WebCore/xml/XPathValue.cpp (242712 => 242713)


--- trunk/Source/WebCore/xml/XPathValue.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebCore/xml/XPathValue.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -126,7 +126,7 @@
                 return "0"_s;
             if (std::isinf(m_number))
                 return std::signbit(m_number) ? "-Infinity"_s : "Infinity"_s;
-            return String::number(m_number);
+            return String::numberToStringFixedPrecision(m_number);
         case BooleanValue:
             return m_bool ? "true"_s : "false"_s;
     }

Modified: trunk/Source/WebKit/ChangeLog (242712 => 242713)


--- trunk/Source/WebKit/ChangeLog	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebKit/ChangeLog	2019-03-11 17:11:13 UTC (rev 242713)
@@ -1,3 +1,19 @@
+2019-03-11  Darin Adler  <[email protected]>
+
+        Specify fixed precision explicitly to prepare to change String::number and StringBuilder::appendNumber floating point behavior
+        https://bugs.webkit.org/show_bug.cgi?id=195533
+
+        Reviewed by Brent Fulgham.
+
+        * NetworkProcess/cache/NetworkCache.cpp:
+        (WebKit::NetworkCache::Cache::dumpContentsToFile): Use appendFixedPrecisionNumber.
+        * NetworkProcess/cache/NetworkCacheEntry.cpp:
+        (WebKit::NetworkCache::Entry::asJSON const): Ditto.
+        * Shared/Gamepad/GamepadData.cpp:
+        (WebKit::GamepadData::loggingString const): Ditto.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::logDiagnosticMessageWithValue): Use numberToStringFixedPrecision.
+
 2019-03-11  John Wilander  <[email protected]>
 
         Resource Load Statistics: Make it possible exclude localhost from classification

Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp (242712 => 242713)


--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCache.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -549,7 +549,7 @@
             epilogue.appendNumber(totals.bodySize);
             epilogue.appendLiteral(",\n");
             epilogue.appendLiteral("\"averageWorth\": ");
-            epilogue.appendNumber(totals.count ? totals.worth / totals.count : 0);
+            epilogue.appendFixedPrecisionNumber(totals.count ? totals.worth / totals.count : 0);
             epilogue.appendLiteral("\n");
             epilogue.appendLiteral("}\n}\n");
             auto writeData = epilogue.toString().utf8();

Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp (242712 => 242713)


--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheEntry.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -219,13 +219,13 @@
     json.appendNumber(info.bodySize);
     json.appendLiteral(",\n");
     json.appendLiteral("\"worth\": ");
-    json.appendNumber(info.worth);
+    json.appendFixedPrecisionNumber(info.worth);
     json.appendLiteral(",\n");
     json.appendLiteral("\"partition\": ");
     json.appendQuotedJSONString(m_key.partition());
     json.appendLiteral(",\n");
     json.appendLiteral("\"timestamp\": ");
-    json.appendNumber(m_timeStamp.secondsSinceEpoch().milliseconds());
+    json.appendFixedPrecisionNumber(m_timeStamp.secondsSinceEpoch().milliseconds());
     json.appendLiteral(",\n");
     json.appendLiteral("\"URL\": ");
     json.appendQuotedJSONString(m_response.url().string());

Modified: trunk/Source/WebKit/Shared/Gamepad/GamepadData.cpp (242712 => 242713)


--- trunk/Source/WebKit/Shared/Gamepad/GamepadData.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebKit/Shared/Gamepad/GamepadData.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -100,7 +100,7 @@
         builder.appendLiteral(" Axis ");
         builder.appendNumber(i);
         builder.appendLiteral(": ");
-        builder.appendNumber(m_axisValues[i]);
+        builder.appendFixedPrecisionNumber(m_axisValues[i]);
     }
 
     builder.append('\n');
@@ -108,7 +108,7 @@
         builder.appendLiteral(" Button ");
         builder.appendNumber(i);
         builder.appendLiteral(": ");
-        builder.appendNumber(m_buttonValues[i]);
+        builder.appendFixedPrecisionNumber(m_buttonValues[i]);
     }
 
     return builder.toString();

Modified: trunk/Source/WebKit/UIProcess/WebPageProxy.cpp (242712 => 242713)


--- trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-03-11 17:01:27 UTC (rev 242712)
+++ trunk/Source/WebKit/UIProcess/WebPageProxy.cpp	2019-03-11 17:11:13 UTC (rev 242713)
@@ -6442,7 +6442,7 @@
     if (!effectiveClient)
         return;
 
-    effectiveClient->logDiagnosticMessageWithValue(this, message, description, String::number(value, significantFigures));
+    effectiveClient->logDiagnosticMessageWithValue(this, message, description, String::numberToStringFixedPrecision(value, significantFigures));
 }
 
 void WebPageProxy::logDiagnosticMessageWithEnhancedPrivacy(const String& message, const String& description, ShouldSample shouldSample)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to