Closed
Bug 1493181
Opened 6 years ago
Closed 6 years ago
The size of the 'ch' unit may be inappropriately rounded up when converting to appUnits
Categories
(Core :: CSS Parsing and Computation, enhancement, P3)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla64
Tracking | Status | |
---|---|---|
firefox64 | --- | fixed |
People
(Reporter: jfkthame, Assigned: jfkthame)
References
Details
Attachments
(3 files)
1.61 KB,
text/html
|
Details | |
4.08 KB,
patch
|
manishearth
:
review+
|
Details | Diff | Splinter Review |
23.29 KB,
patch
|
manishearth
:
review+
|
Details | Diff | Splinter Review |
When converting the width of a font's '0' glyph from floating-point device pixels into integer appUnits for use as the basis of the CSS 'ch' unit, we apply the ceiling function rather than rounding, here: https://searchfox.org/mozilla-central/rev/0b8ed772d24605d7cb44c1af6d59e4ca023bd5f5/layout/style/ServoBindings.cpp#2559 This tends to sometimes make 'ch' fractionally (one appUnit) larger than would be expected, affecting layout when sizes are expressed in multiples of 'ch' units. See attached testcase, which shows failures on a few of the test elements -- exactly which ones varies if you zoom in/out, as this affects where the rounding errors occur -- on macOS, Windows and Android; only Linux seems immune (probably because glyph advances are pixel-rounded by the font backend). Resolving this will be required in order to reliably fix bug 1432198, as it can affect the computation of tab positions.
Assignee | ||
Comment 1•6 years ago
|
||
Reftest form of the testcase here, which currently fails across all platforms except Linux.
Attachment #9010956 -
Flags: review?(manishearth)
Assignee | ||
Updated•6 years ago
|
Assignee: nobody → jfkthame
Status: NEW → ASSIGNED
Assignee | ||
Comment 2•6 years ago
|
||
The trivial fix of changing ceil() to round() resolves the problem; and as a nice bonus, it also fixes a bunch of other currently-failing testcases, so we can remove those failure annotations as well.
Attachment #9010957 -
Flags: review?(manishearth)
Updated•6 years ago
|
Attachment #9010957 -
Flags: review?(manishearth) → review+
Updated•6 years ago
|
Attachment #9010956 -
Flags: review?(manishearth) → review+
Pushed by jkew@mozilla.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/70160e10c604 Test for expected width of CSS 'ch' unit. r=manishearth https://hg.mozilla.org/integration/mozilla-inbound/rev/0b11e726fe9c Use rounding instead of ceiling when computing 'ch' width; update test expectations accordingly. r=manishearth
Comment 4•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/70160e10c604 https://hg.mozilla.org/mozilla-central/rev/0b11e726fe9c
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox64:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla64
You need to log in
before you can comment on or make changes to this bug.
Description
•