Calculate Background Image Geometries using sub-pixel values
We've long had horrible issues with zooming and background images with
offsets (spriting). This is because we calculated these offsets using
integers greedily instead of snapping them directly before paint like
we do with other sub-pixel values in the layout tree.
With this change, BackgroundImageGeometry is converted entirely to
LayoutUnits, with snapping occurring after calculation in a new
pixelSnapGeometry() method. The old sub-pixel tile size heuristic was
thrown out, but replaced by a new one that puts in extra effort for
background images that fully cover the fill layer.
A number of reference tests needed to be updated to account for new
rounding values on tests with -webkit-mask-repeat or background-repeat:
round. It's worth noting that the references for these tests don't
render the same in Firefox with or without the changes made in this
patch.
The change to repeatSpacing in drawPattern and drawTiled is for
consistency only and can happily be postponed to a subsequent patch.
This patch influenced by the following changes in WebKit:
https://bugs.webkit.org/attachment.cgi?id=228591
https://bugs.webkit.org/attachment.cgi?id=222911
So mad props to Zalan Bujtas <
zalan@apple.com>, Apple's
1337 sub-pixel h4x0r.
BUG=
66498
Committed:
https://crrev.com/b216e38c1a1812d5761b0e78d8975c807c7f3837
Cr-Commit-Position: refs/heads/master@{#362569}