Title: [161689] trunk/Source/WebInspectorUI
Revision
161689
Author
[email protected]
Date
2014-01-10 15:54:10 -0800 (Fri, 10 Jan 2014)

Log Message

Web Inspector: support negative numbers in secondsToString and bytesToString.

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

Reviewed by Joseph Pecoraro.

* UserInterface/Utilities.js:
(Number.secondsToString): Use Math.abs in the size checks.
(Number.bytesToString): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (161688 => 161689)


--- trunk/Source/WebInspectorUI/ChangeLog	2014-01-10 23:53:04 UTC (rev 161688)
+++ trunk/Source/WebInspectorUI/ChangeLog	2014-01-10 23:54:10 UTC (rev 161689)
@@ -1,3 +1,15 @@
+2014-01-10  Timothy Hatcher  <[email protected]>
+
+        Web Inspector: support negative numbers in secondsToString and bytesToString.
+
+        https://bugs.webkit.org/show_bug.cgi?id=125708
+
+        Reviewed by Joseph Pecoraro.
+
+        * UserInterface/Utilities.js:
+        (Number.secondsToString): Use Math.abs in the size checks.
+        (Number.bytesToString): Ditto.
+
 2014-01-10  Brian Burg  <[email protected]>
 
         Web Inspector: cycle clicked breakpoints between enabled, auto-continue, and disabled

Modified: trunk/Source/WebInspectorUI/UserInterface/Utilities.js (161688 => 161689)


--- trunk/Source/WebInspectorUI/UserInterface/Utilities.js	2014-01-10 23:53:04 UTC (rev 161688)
+++ trunk/Source/WebInspectorUI/UserInterface/Utilities.js	2014-01-10 23:54:10 UTC (rev 161689)
@@ -775,25 +775,25 @@
     {
         var ms = seconds * 1000;
 
-        if (higherResolution && ms < 100)
+        if (higherResolution && Math.abs(ms) < 100)
             return WebInspector.UIString("%.2fms").format(ms);
-        else if (ms < 100)
+        else if (Math.abs(ms) < 100)
             return WebInspector.UIString("%.1fms").format(ms);
 
-        if (higherResolution && ms < 1000)
+        if (higherResolution && Math.abs(ms) < 1000)
             return WebInspector.UIString("%.1fms").format(ms);
-        else if (ms < 1000)
+        else if (Math.abs(ms) < 1000)
             return WebInspector.UIString("%.0fms").format(ms);
 
-        if (seconds < 60)
+        if (Math.abs(seconds) < 60)
             return WebInspector.UIString("%.2fs").format(seconds);
 
         var minutes = seconds / 60;
-        if (minutes < 60)
+        if (Math.abs(minutes) < 60)
             return WebInspector.UIString("%.1fmin").format(minutes);
 
         var hours = minutes / 60;
-        if (hours < 24)
+        if (Math.abs(hours) < 24)
             return WebInspector.UIString("%.1fhrs").format(hours);
 
         var days = hours / 24;
@@ -808,17 +808,17 @@
         if (higherResolution === undefined)
             higherResolution = true;
 
-        if (bytes < 1024)
+        if (Math.abs(bytes) < 1024)
             return WebInspector.UIString("%.0f B").format(bytes);
 
         var kilobytes = bytes / 1024;
-        if (kilobytes < 10 || (higherResolution && kilobytes < 1024))
+        if (Math.abs(kilobytes) < 10 || (higherResolution && Math.abs(kilobytes) < 1024))
             return WebInspector.UIString("%.2f KB").format(kilobytes);
-        else if (kilobytes < 1024)
+        else if (Math.abs(kilobytes) < 1024)
             return WebInspector.UIString("%.1f KB").format(kilobytes);
 
         var megabytes = kilobytes / 1024;
-        if (higherResolution || megabytes < 10)
+        if (higherResolution || Math.abs(megabytes) < 10)
             return WebInspector.UIString("%.2f MB").format(megabytes);
         else
             return WebInspector.UIString("%.1f MB").format(megabytes);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to