Changeset 196284 in webkit


Ignore:
Timestamp:
Feb 8, 2016 5:50:08 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Zooming in on the timeline graph does not increase its time resolution from minutes
https://bugs.webkit.org/show_bug.cgi?id=154013
<rdar://problem/23844527>

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2016-02-08
Reviewed by Brian Burg.

Source/WebInspectorUI:

  • UserInterface/Base/Utilities.js:

(Number.secondsToString):
Simplify logic and ensure that when under high resolution we
don't go above seconds for our units.

(Number.bytesToString):
Simplify logic.

  • UserInterface/Views/LinearTimelineOverview.js:

(WebInspector.LinearTimelineOverview):
Reduce the rather large maximum seconds per pixel from 60 seconds
per pixel to 2 seconds per pixel. This means when the user zooms
out of a timeline they don't see such large time values.

LayoutTests:

  • inspector/unit-tests/number-utilities-expected.txt: Added.
  • inspector/unit-tests/number-utilities.html: Added.

Basic tests for our Number utilities methods.

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r196283 r196284  
     12016-02-08  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Zooming in on the timeline graph does not increase its time resolution from minutes
     4        https://bugs.webkit.org/show_bug.cgi?id=154013
     5        <rdar://problem/23844527>
     6
     7        Reviewed by Brian Burg.
     8
     9        * inspector/unit-tests/number-utilities-expected.txt: Added.
     10        * inspector/unit-tests/number-utilities.html: Added.
     11        Basic tests for our Number utilities methods.
     12
    1132016-02-08  Daniel Bates  <dabates@apple.com>
    214
  • trunk/Source/WebInspectorUI/ChangeLog

    r196275 r196284  
     12016-02-08  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        Web Inspector: Zooming in on the timeline graph does not increase its time resolution from minutes
     4        https://bugs.webkit.org/show_bug.cgi?id=154013
     5        <rdar://problem/23844527>
     6
     7        Reviewed by Brian Burg.
     8
     9        * UserInterface/Base/Utilities.js:
     10        (Number.secondsToString):
     11        Simplify logic and ensure that when under high resolution we
     12        don't go above seconds for our units.
     13
     14        (Number.bytesToString):
     15        Simplify logic.
     16
     17        * UserInterface/Views/LinearTimelineOverview.js:
     18        (WebInspector.LinearTimelineOverview):
     19        Reduce the rather large maximum seconds per pixel from 60 seconds
     20        per pixel to 2 seconds per pixel. This means when the user zooms
     21        out of a timeline they don't see such large time values.
     22
    1232016-02-08  Joseph Pecoraro  <pecoraro@apple.com>
    224
  • trunk/Source/WebInspectorUI/UserInterface/Base/Utilities.js

    r196275 r196284  
    873873    value: function(seconds, higherResolution)
    874874    {
    875         var ms = seconds * 1000;
    876 
    877         if (higherResolution && Math.abs(ms) < 10)
    878             return WebInspector.UIString("%.3fms").format(ms);
    879         else if (Math.abs(ms) < 10)
     875        let ms = seconds * 1000;
     876
     877        if (Math.abs(ms) < 10) {
     878            if (higherResolution)
     879                return WebInspector.UIString("%.3fms").format(ms);
    880880            return WebInspector.UIString("%.2fms").format(ms);
    881 
    882         if (higherResolution && Math.abs(ms) < 100)
    883             return WebInspector.UIString("%.2fms").format(ms);
    884         else if (Math.abs(ms) < 100)
     881        }
     882
     883        if (Math.abs(ms) < 100) {
     884            if (higherResolution)
     885                return WebInspector.UIString("%.2fms").format(ms);
    885886            return WebInspector.UIString("%.1fms").format(ms);
    886 
    887         if (higherResolution && Math.abs(ms) < 1000)
    888             return WebInspector.UIString("%.1fms").format(ms);
    889         else if (Math.abs(ms) < 1000)
     887        }
     888
     889        if (Math.abs(ms) < 1000) {
     890            if (higherResolution)
     891                return WebInspector.UIString("%.1fms").format(ms);
    890892            return WebInspector.UIString("%.0fms").format(ms);
    891 
    892         if (Math.abs(seconds) < 60)
     893        }
     894
     895        // Do not go over seconds when in high resolution mode.
     896        if (higherResolution || Math.abs(seconds) < 60)
    893897            return WebInspector.UIString("%.2fs").format(seconds);
    894898
    895         var minutes = seconds / 60;
     899        let minutes = seconds / 60;
    896900        if (Math.abs(minutes) < 60)
    897901            return WebInspector.UIString("%.1fmin").format(minutes);
    898902
    899         var hours = minutes / 60;
     903        let hours = minutes / 60;
    900904        if (Math.abs(hours) < 24)
    901905            return WebInspector.UIString("%.1fhrs").format(hours);
    902906
    903         var days = hours / 24;
     907        let days = hours / 24;
    904908        return WebInspector.UIString("%.1f days").format(days);
    905909    }
     
    916920            return WebInspector.UIString("%.0f B").format(bytes);
    917921
    918         var kilobytes = bytes / 1024;
    919         if (Math.abs(kilobytes) < 10 || (higherResolution && Math.abs(kilobytes) < 1024))
    920             return WebInspector.UIString("%.2f KB").format(kilobytes);
    921         else if (Math.abs(kilobytes) < 1024)
     922        let kilobytes = bytes / 1024;
     923        if (Math.abs(kilobytes) < 1024) {
     924            if (higherResolution || Math.abs(kilobytes) < 10)
     925                return WebInspector.UIString("%.2f KB").format(kilobytes);
    922926            return WebInspector.UIString("%.1f KB").format(kilobytes);
    923 
    924         var megabytes = kilobytes / 1024;
     927        }
     928
     929        let megabytes = kilobytes / 1024;
    925930        if (higherResolution || Math.abs(megabytes) < 10)
    926931            return WebInspector.UIString("%.2f MB").format(megabytes);
    927         else
    928             return WebInspector.UIString("%.1f MB").format(megabytes);
     932        return WebInspector.UIString("%.1f MB").format(megabytes);
    929933    }
    930934});
  • trunk/Source/WebInspectorUI/UserInterface/Views/LinearTimelineOverview.js

    r187689 r196284  
    3434        };
    3535
    36         super("linear", timelineRecording, 0.0001, 60, defaultSettingsValues);
     36        super("linear", timelineRecording, 0.0001, 2, defaultSettingsValues);
    3737    }
    3838
Note: See TracChangeset for help on using the changeset viewer.