The default bug view has changed. See this FAQ.

layout.css.devPixelsPerPx parsed in locale-dependent manner

RESOLVED FIXED in mozilla22

Status

()

Core
Widget
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: Carl Nettelblad, Assigned: jfkthame)

Tracking

Trunk
mozilla22
x86_64
Windows 7
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

4 years ago
User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/17.0 Firefox/17.0
Build ID: 20121113065533

Steps to reproduce:

In about:config, the property layout.css.devPixelsPerPx is of string type. The parsing of this (decimal) string is dependent on the current locale, i.e. 1.25 should be entered as 1,25 in a locale using comma as the decimal separator. This also means that a configuration transferred between locales might be parsed incorrectly.


Actual results:

1.25 is silently ignored as invalid, 1,25 works correctly - if current locale uses comma as the decimal separator.


Expected results:

Strings in configuration data should be locale agnostic.
(Reporter)

Comment 1

4 years ago
This bug is also discussed in the comments in https://bugzilla.mozilla.org/show_bug.cgi?id=433664 , but only in passing.
nsIWidget::GetDefaultScale does:

389     devPixelsPerCSSPixel = static_cast<float>(atof(prefString));
Component: Layout → Widget
That's in:
http://hg.mozilla.org/mozilla-central/file/6e61c4a26591/widget/xpwidgets/nsBaseWidget.cpp#l380
Status: UNCONFIRMED → NEW
Ever confirmed: true
Is PR_strtod the replacement?
(Assignee)

Comment 5

4 years ago
Created attachment 717961 [details] [diff] [review]
interpreting the devPixelsPerPx value from about:config should not depend on locale

Indeed, looks to me like PR_strtod would be better here. It only looks at the locale if nspr is built with USE_LOCALE defined, which we don't do AFAICT - but even in that case, inspecting the code shows that it would always understand '.' as decimal point, in addition to the locale's decimal_point if different. The downside of making this change, I suppose, would be that any user in a comma-decimal locale who has already modified the value (and figured out they needed to use comma) will then need to re-do their customization using the period. But I think we could live with that - after all, about:config comes with a health warning attached.
Attachment #717961 - Flags: review?(roc)
(Assignee)

Updated

4 years ago
Assignee: nobody → jfkthame
Attachment #717961 - Flags: review?(roc) → review+
(Assignee)

Comment 6

4 years ago
https://hg.mozilla.org/integration/mozilla-inbound/rev/7ec9cda146fb
Target Milestone: --- → mozilla22
Version: 17 Branch → Trunk
https://hg.mozilla.org/mozilla-central/rev/7ec9cda146fb
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.