Bug 254990

Summary: transform loses accuracy on page zoom
Product: WebKit Reporter: Carlos Lopez <clshortfuse>
Component: CSSAssignee: Nobody <webkit-unassigned>
Status: NEW ---    
Severity: Normal CC: ahmad.saleem792, karlcow, simon.fraser, webkit-bug-importer, zalan
Priority: P2 Keywords: BrowserCompat, InRadar
Version: Safari 16   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Screenshot none

Description Carlos Lopez 2023-04-04 06:36:15 PDT
When using page zoom, a transform will lose accuracy at times. Note the following codepen:

https://codepen.io/shortfuse/pen/qBJWbbd

When zooming in and out on the page, the black dot will move around, not staying in sync with the red circle.

The lines causing the problem are (with --value fixed as 1):

```css
#thumb-anchor {
  inline-size: 1%;
  transform: translateX(calc(var(--value) * 100 * 100%));
}
```

Removing CSS Variables shows the issue is not related to CSS Vars:


```css
#thumb-anchor {
  inline-size: 1%;
  transform: translateX(10000%);
}
```

It's personally low priority for me since I found a fix, but it's still a strange bug:

```css
#thumb-anchor {
  inline-size: 100%;
  transform: translateX(calc(var(--value) * 100%));
}
```
Comment 1 Ahmad Saleem 2023-04-04 15:18:50 PDT
I am able to reproduce this on WebKit ToT (262590@main) as well, I zoomed out and 'black' dot moved while it didn't in Chrome Canary 114.
Comment 2 Simon Fraser (smfr) 2023-04-05 15:51:35 PDT
Created attachment 465786 [details]
Screenshot
Comment 3 Radar WebKit Bug Importer 2023-04-05 15:51:57 PDT
<rdar://problem/107682651>