Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(299)

Unified Diff: Source/WebCore/inspector/InspectorValues.cpp

Issue 7145019: Merge 88444 (Closed) Base URL: http://svn.webkit.org/repository/webkit/branches/chromium/782/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/WebCore/inspector/InspectorValues.cpp
===================================================================
--- Source/WebCore/inspector/InspectorValues.cpp (revision 88760)
+++ Source/WebCore/inspector/InspectorValues.cpp (working copy)
@@ -620,7 +620,18 @@
output->append(falseString, 5);
} else if (type() == TypeNumber) {
NumberToStringBuffer buffer;
- unsigned length = DecimalNumber(m_doubleValue).toStringDecimal(buffer, WTF::NumberToStringBufferLength);
+ DecimalNumber decimal = m_doubleValue;
+ unsigned length = 0;
+ if (decimal.bufferLengthForStringDecimal() > WTF::NumberToStringBufferLength) {
+ // Not enough room for decimal. Use exponential format.
+ if (decimal.bufferLengthForStringExponential() > WTF::NumberToStringBufferLength) {
+ // Fallback for an abnormal case if it's too little even for exponential.
+ output->append("NaN", 3);
+ return;
+ }
+ length = decimal.toStringExponential(buffer, WTF::NumberToStringBufferLength);
+ } else
+ length = decimal.toStringDecimal(buffer, WTF::NumberToStringBufferLength);
output->append(buffer, length);
}
}
« no previous file with comments | « Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698