Bug 160956 - SVGs are sometimes offset by 0.5px on retina
Summary: SVGs are sometimes offset by 0.5px on retina
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: SVG (show other bugs)
Version: WebKit Nightly Build
Hardware: Mac OS X 10.10
: P2 Normal
Assignee: Nobody
Depends on:
Reported: 2016-08-18 00:16 PDT by Jonas Munk
Modified: 2016-08-18 11:22 PDT (History)
3 users (show)

See Also:

Minimal test case (1.73 KB, text/html)
2016-08-18 00:16 PDT, Jonas Munk
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jonas Munk 2016-08-18 00:16:34 PDT
Created attachment 286365 [details]
Minimal test case

Sometimes SVGs are offset by .5 pixels when drawn on retina screen.

It looks like it happens randomly based on some vertical pixel-fitting.

I would expect the coordinate system for the SVG to start at a full pixel based on the container.

This is especially a problem when doing pixel-perfect/pixel-fitted icons for UI - not normally noticeable.

I have created a perfect 32x32 square SVG to test with (hopefully) + an example using xlink

In the attached test case:
1) The SVGs are drawn showing the problem where the top line in the rect is clipped
2) An image showing how Chrome draws it
3) An image showing how I see it on my machine with Webkit nightly
4) The same SVGs again - but now it draws correctly (probably because the content above makes it land on a full pixel or something)

Note it looks like Firefox has a problem with the first SVGs but only on low DPI screen.
Comment 1 Jonas Munk 2016-08-18 01:01:42 PDT
I see now that the problem occurs because of the margins on the headers resulting in a vertical position that does not land on a whole pixel.

But I would still expect that the SVGs are drawn from a full pixel.