Title: [274680] trunk
Revision
274680
Author
nvasil...@apple.com
Date
2021-03-18 15:59:04 -0700 (Thu, 18 Mar 2021)

Log Message

Use 1000-based units for file sizes, per HIG
https://bugs.webkit.org/show_bug.cgi?id=208190
<rdar://problem/71045696>

Reviewed by BJ Burg.

Source/WebInspectorUI:

* UserInterface/Base/Utilities.js:
* UserInterface/Views/ResourceSizesContentView.js:
(WI.ResourceSizesContentView.prototype._formattedSizeComponent):

LayoutTests:

* inspector/unit-tests/number-utilities.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (274679 => 274680)


--- trunk/LayoutTests/ChangeLog	2021-03-18 22:53:51 UTC (rev 274679)
+++ trunk/LayoutTests/ChangeLog	2021-03-18 22:59:04 UTC (rev 274680)
@@ -1,3 +1,13 @@
+2021-03-18  Nikita Vasilyev  <nvasil...@apple.com>
+
+        Use 1000-based units for file sizes, per HIG
+        https://bugs.webkit.org/show_bug.cgi?id=208190
+        <rdar://problem/71045696>
+
+        Reviewed by BJ Burg.
+
+        * inspector/unit-tests/number-utilities.html:
+
 2021-03-18  Chris Gambrell  <cgambr...@apple.com>
 
         [ macOS Wk2 ] http/tests/security/contentSecurityPolicy/report-only-connect-src-xmlhttprequest-redirect-to-blocked.php is constantly text failing

Modified: trunk/LayoutTests/inspector/unit-tests/number-utilities.html (274679 => 274680)


--- trunk/LayoutTests/inspector/unit-tests/number-utilities.html	2021-03-18 22:53:51 UTC (rev 274679)
+++ trunk/LayoutTests/inspector/unit-tests/number-utilities.html	2021-03-18 22:59:04 UTC (rev 274680)
@@ -68,8 +68,8 @@
     suite.addTestCase({
         name: "Number.bytesToString",
         test() {
-            const kb = 1024;
-            const mb = kb * 1024;
+            const kb = 1000;
+            const mb = kb * 1000;
 
             // Normal resolution.
             InspectorTest.expectEqual(Number.bytesToString(123, false), "123 B", "normal resolution of sub 1k should be bytes");

Modified: trunk/Source/WebInspectorUI/ChangeLog (274679 => 274680)


--- trunk/Source/WebInspectorUI/ChangeLog	2021-03-18 22:53:51 UTC (rev 274679)
+++ trunk/Source/WebInspectorUI/ChangeLog	2021-03-18 22:59:04 UTC (rev 274680)
@@ -1,5 +1,17 @@
 2021-03-18  Nikita Vasilyev  <nvasil...@apple.com>
 
+        Use 1000-based units for file sizes, per HIG
+        https://bugs.webkit.org/show_bug.cgi?id=208190
+        <rdar://problem/71045696>
+
+        Reviewed by BJ Burg.
+
+        * UserInterface/Base/Utilities.js:
+        * UserInterface/Views/ResourceSizesContentView.js:
+        (WI.ResourceSizesContentView.prototype._formattedSizeComponent):
+
+2021-03-18  Nikita Vasilyev  <nvasil...@apple.com>
+
         Web Inspector: REGRESSION(r271348): Console: message source code location is not vertically aligned with containing function name
         https://bugs.webkit.org/show_bug.cgi?id=223288
         <rdar://problem/75498577>

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js (274679 => 274680)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js	2021-03-18 22:53:51 UTC (rev 274679)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js	2021-03-18 22:59:04 UTC (rev 274680)
@@ -1359,26 +1359,26 @@
     value(bytes, higherResolution, bytesThreshold)
     {
         higherResolution ??= true;
-        bytesThreshold ??= 1024;
+        bytesThreshold ??= 1000;
 
         if (Math.abs(bytes) < bytesThreshold)
             return WI.UIString("%.0f B").format(bytes);
 
-        let kilobytes = bytes / 1024;
-        if (Math.abs(kilobytes) < 1024) {
+        let kilobytes = bytes / 1000;
+        if (Math.abs(kilobytes) < 1000) {
             if (higherResolution || Math.abs(kilobytes) < 10)
                 return WI.UIString("%.2f KB").format(kilobytes);
             return WI.UIString("%.1f KB").format(kilobytes);
         }
 
-        let megabytes = kilobytes / 1024;
-        if (Math.abs(megabytes) < 1024) {
+        let megabytes = kilobytes / 1000;
+        if (Math.abs(megabytes) < 1000) {
             if (higherResolution || Math.abs(megabytes) < 10)
                 return WI.UIString("%.2f MB").format(megabytes);
             return WI.UIString("%.1f MB").format(megabytes);
         }
 
-        let gigabytes = megabytes / 1024;
+        let gigabytes = megabytes / 1000;
         if (higherResolution || Math.abs(gigabytes) < 10)
             return WI.UIString("%.2f GB").format(gigabytes);
         return WI.UIString("%.1f GB").format(gigabytes);

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSizesContentView.js (274679 => 274680)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSizesContentView.js	2021-03-18 22:53:51 UTC (rev 274679)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceSizesContentView.js	2021-03-18 22:59:04 UTC (rev 274680)
@@ -168,9 +168,9 @@
         console.assert(bytes >= 0);
 
         // Prefer KB over B. And prefer 1 decimal point to keep sizes simple
-        // but we will still need B if bytes is less than 0.1 KB (103 B).
+        // but we will still need B if bytes is less than 0.1 KB (100 B).
         const higherResolution = false;
-        const bytesThreshold = 103;
+        const bytesThreshold = 100;
         return Number.bytesToString(bytes, higherResolution, bytesThreshold);
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to