2010-10-18 Ilya Tikhonovsky <loislo@chromium.org>
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Oct 2010 15:24:18 +0000 (15:24 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Oct 2010 15:24:18 +0000 (15:24 +0000)
        Reviewed by Yury Semikhatsky.

        Web Inspector: toJSON serialization for Numbers should be fixed.
        DecimalNumber is used instead of printf.

        https://bugs.webkit.org/show_bug.cgi?id=43832

        * inspector/InspectorValues.cpp:
        (WebCore::InspectorBasicValue::writeJSON):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@69959 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/inspector/InspectorValues.cpp

index 34bd385944d4d8c98216c889f22deaa726e4b421..3f5cd1a415cd5b4abdacb31a728485bf4f024721 100644 (file)
@@ -1,3 +1,15 @@
+2010-10-18  Ilya Tikhonovsky  <loislo@chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: toJSON serialization for Numbers should be fixed.
+        DecimalNumber is used instead of printf.
+
+        https://bugs.webkit.org/show_bug.cgi?id=43832
+
+        * inspector/InspectorValues.cpp:
+        (WebCore::InspectorBasicValue::writeJSON):
+
 2010-10-18  Ilya Tikhonovsky  <loislo@chromium.org>
 
         Reviewed by Yury Semikhatsky.
index 452fa7f99a2bcd5993d9ee7b29c3b46112bcf681..318d7bbc3fb5edb62b44e1e430b4922507dff649 100644 (file)
@@ -33,6 +33,8 @@
 
 #if ENABLE(INSPECTOR)
 
+#include <wtf/DecimalNumber.h>
+
 namespace WebCore {
 
 namespace {
@@ -604,9 +606,9 @@ void InspectorBasicValue::writeJSON(Vector<UChar>* output) const
         else
             output->append(falseString, 5);
     } else if (type() == TypeNumber) {
-        String value = String::format("%f", m_doubleValue);
-        value.replace(',', '.');
-        output->append(value.characters(), value.length());
+        NumberToStringBuffer buffer;
+        unsigned length = DecimalNumber(m_doubleValue).toStringDecimal(buffer);
+        output->append(buffer, length);
     }
 }