Open
Bug 983511
Opened 11 years ago
Updated 3 years ago
With some css:device pixel ratios, interpolated style snaps to device pixels for some properties
Categories
(Core :: CSS Parsing and Computation, defect)
Core
CSS Parsing and Computation
Tracking
()
NEW
People
(Reporter: birtles, Unassigned)
Details
In the following test:
http://dxr.mozilla.org/mozilla-central/source/layout/style/test/test_transitions_per_property.html
running on a machine whose resolution is not 96dpi (?) I get test failures for a handful of properties including -moz-column-rule-width and border-bottom-width.
On further inspection I notice it seems to correspond to properties that are represented as nscoord inside an nsStyleAnimation::Value.
Instead of getting 6px for the 1/4 value in test_length_transition I get 5.6px.
After a bit of digging I notice we calculate the interpolated value correctly as 360 app units (/ 60 = 6px), but when we go to store it in nsStyleColumn we round it to device pixels:
mColumnRuleWidth = NS_ROUND_BORDER_TO_PIXELS(aWidth, mTwipsPerPixel);
which gives us 336 app units which produces 5.6px when calling getComputedStyle.
It's quite intentional that we're rounding to device pixels. We want to ensure that after snapping *edges* to the nearest device pixel, we end up with a border of a given width having the same displayed width on all sides.
That said, it's not necessarily required that this snapping happen as part of what we consider to be the computed style, or even as part of style data computation. But it (or at least the latter) does make things quite a bit easier.
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•