Closed Bug 1586278 Opened 5 years ago Closed 5 years ago

about:config should always display the default values of floating-point values with a decimal part, to distinguish visually from integers

Categories

(Core :: Preferences: Backend, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla71
Tracking Status
firefox71 --- fixed

People

(Reporter: jfkthame, Assigned: jfkthame)

Details

Attachments

(1 file)

When a pref that has a floating-point type is displayed in about:config, it would be helpful to ensure that a trailing decimal is always included (i.e. append ".0" if the value happens to be an integer), to distinguish from values of integer type.

For example, until recently the default value of layout.css.devPixelsPerPx was defined in libpref/init/all.js as pref("layout.css.devPixelsPerPx", "-1.0");, deliberately including a decimal so that when viewing in about:config, it's clear that fractional values are accepted. But since it was converted to StaticPrefs in bug 1573992, with a type of AtomicFloat and default value -1.0f, it appears in about:config as a bare "-1", which is easily misinterpreted as suggesting it is an integer preference.

(It was always the case that a floating-point pref could end up displayed with no decimal, if it was explicitly given such a value; but with the move from defining the default as a string in all.js to a float in StaticPrefList.yaml, we no longer have the ability to ensure the initial value shows a decimal, so this has become a more significant issue.)

Actually, it looks like about:config only knows about boolean, integer (which it - misleadingly - refers to as Number), and string prefs, so perhaps this is really a request for StaticPrefs to store floating-point values as strings that always include a decimal.

AFAICS, prior to bug 1493955 such values would normally have displayed with decimals (via printf-like formatting), but the change to using nsTSubstring::AppendFloat, which uses FormatWithoutTrailingZeros, means that trailing zeroes are now stripped.

I think for clarity we should restore a trailing ".0" to the string form when the floating-point pref has an integer value.

Component: Preferences → Preferences: Backend
Product: Toolkit → Core
Summary: about:config should always display floating-point values with a decimal part, to distinguish visually from integers → about:config should always display the default values of floating-point values with a decimal part, to distinguish visually from integers
Pushed by jkew@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e7d483d8420e
Append ".0" to stringified default values of floating-point prefs to distinguish them from integers in about:config. r=njn
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
Assignee: nobody → jfkthame
You need to log in before you can comment on or make changes to this bug.