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
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2016-08-18 00:16 PDT by Jonas Munk
Modified: 2022-07-15 17:24 PDT (History)
8 users (show)

See Also:


Attachments
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.
Comment 2 Ahmad Saleem 2022-06-29 16:31:46 PDT
I am able to reproduce this bug in Safari 15.5 and Safari TP 148 on macOS 12.4. The first SVG have top border finer (thinner) than other borders. All other browsers (Chrome Canary 105 and Firefox Nightly 104) render it fine. Thanks!
Comment 3 Brent Fulgham 2022-07-15 17:24:02 PDT
Confirmed.
Comment 4 Radar WebKit Bug Importer 2022-07-15 17:24:13 PDT
<rdar://problem/97102392>