https://bugs.webkit.org/show_bug.cgi?id=194108
<rdar://problem/
47714273>
Patch by Joseph Pecoraro <pecoraro@apple.com> on 2019-01-31
Reviewed by Devin Rousso.
Source/WebInspectorUI:
* UserInterface/Base/Utilities.js:
Check under epsilon for the zero case.
LayoutTests:
* inspector/unit-tests/number-utilities-expected.txt:
* inspector/unit-tests/number-utilities.html:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@240824
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2019-01-31 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Timeline time range selection sometimes shows 0.000, should be just 0
+ https://bugs.webkit.org/show_bug.cgi?id=194108
+ <rdar://problem/47714273>
+
+ Reviewed by Devin Rousso.
+
+ * inspector/unit-tests/number-utilities-expected.txt:
+ * inspector/unit-tests/number-utilities.html:
+
2019-01-31 Chris Dumez <cdumez@apple.com>
[ MacOS ] Layout Test performance-api/performance-observer-callback-after-gc.html is flaky
PASS: normal resolution of greater than 1hr but sub 1 day should be hrs
PASS: normal resolution of greater than 1 day should be days
PASS: normal resolution of greater than 1 day should be days
+PASS: normal resolution of super small value should be ms with no decimals
PASS: high resolution of 0ms should be ms with no decimals
PASS: high resolution of sub 1ms should be ms with decimals
PASS: high resolution of sub 10ms should be ms with decimals
PASS: high resolution of greater than 1s should be seconds with decimals
PASS: high resolution of greater than 1s should be seconds with decimals
PASS: high resolution greater than 1s should be seconds with decimals
+PASS: high resolution of super small value should be ms with no decimals
-- Running test case: Number.bytesToString
PASS: normal resolution of sub 1k should be bytes
<script>
function test()
{
+ // This is the floating point precision error value from: `0.3 - 0.2 - 0.1`
+ const superSmallValue = -2.7755575615628914e-17;
+
let suite = InspectorTest.createSyncSuite("NumberUtilities");
suite.addTestCase({
InspectorTest.expectEqual(Number.secondsToString(12345, false), "3.4hrs", "normal resolution of greater than 1hr but sub 1 day should be hrs");
InspectorTest.expectEqual(Number.secondsToString(123456, false), "1.4 days", "normal resolution of greater than 1 day should be days");
InspectorTest.expectEqual(Number.secondsToString(1234567, false), "14.3 days", "normal resolution of greater than 1 day should be days");
+ InspectorTest.expectEqual(Number.secondsToString(superSmallValue, false), "0ms", "normal resolution of super small value should be ms with no decimals");
// High resolution.
InspectorTest.expectEqual(Number.secondsToString(0, true), "0ms", "high resolution of 0ms should be ms with no decimals");
InspectorTest.expectEqual(Number.secondsToString(30.123456, true), "30.12s", "high resolution of greater than 1s should be seconds with decimals");
InspectorTest.expectEqual(Number.secondsToString(60.123456, true), "60.12s", "high resolution of greater than 1s should be seconds with decimals");
InspectorTest.expectEqual(Number.secondsToString(100.123456, true), "100.12s", "high resolution greater than 1s should be seconds with decimals");
+ InspectorTest.expectEqual(Number.secondsToString(superSmallValue, true), "0ms", "high resolution of super small value should be ms with no decimals");
return true;
}
+2019-01-31 Joseph Pecoraro <pecoraro@apple.com>
+
+ Web Inspector: Timeline time range selection sometimes shows 0.000, should be just 0
+ https://bugs.webkit.org/show_bug.cgi?id=194108
+ <rdar://problem/47714273>
+
+ Reviewed by Devin Rousso.
+
+ * UserInterface/Base/Utilities.js:
+ Check under epsilon for the zero case.
+
2019-01-31 Matt Baker <mattbaker@apple.com>
REGRESSION(r?): Web Inspector: Clicking on text doesn't move text caret when editing innerHTML/tagName/attribute
{
value(seconds, higherResolution)
{
+ const epsilon = 0.0001;
+
let ms = seconds * 1000;
- if (!ms)
+ if (ms < epsilon)
return WI.UIString("%.0fms").format(0);
- const epsilon = 0.0001;
-
if (Math.abs(ms) < (10 + epsilon)) {
if (higherResolution)
return WI.UIString("%.3fms").format(ms);