Stops certain methods from snapping values to physical pixels, specifically scrollTop(), scrollLeft(), scrollX(), scrollY(), scrollTo(), and so on. Currently, calling window.scrollTo(0, 123.678) will snap the scroll offset to the nearest physical pixel. On a device with devicePixelRatio equal to 2 this would be 123.5, which is what is returned after this change.
This behavior is surprising to developers as it's not clear why or how their scroll values are being modified. It leads to subtle bugs that only reproduce when used at specific zoom levels or devices with specific screen densities. It also means we don't actually change the scroll offset when the user zooms in and out. Consider a page that's zoomed into 200%, allowing scrolls on 0.5 CSS pixel increments. When we zoom back out to 100%, scrolls get snapped to integer pixels. This causes a real scroll and fires scroll events which leads to unexpected behavior. crbug.com/414283 tracks a number of cases this has bitten web authors and chromium developers alike. This change makes the behavior far more intuitive, making pixel-snapping a rendering artifact.
Proposal in a personal repository, no adoption from community
Status in Chromium
In developer trial (Behind a flag)
Consensus & Standardization
- No signal
- No signal
- No signals
Search tagsscroll, float, double, fractional, rendering, independent, offset,
Last updated on 2021-12-13