Bug 1375232 - Snap window transforms that are translations. r=spohl

MozReview-Commit-ID: Jelbo3IraxR

--HG--
extra : rebase_source : 456c39867247993022233a95f518c6328223cbff
This commit is contained in:
Markus Stange 2017-06-21 15:48:30 -04:00
parent 56bd8d22b1
commit b551842590

View File

@ -2268,6 +2268,14 @@ nsCocoaWindow::SetWindowTransform(const gfx::Matrix& aTransform)
transform.PreTranslate(-mBounds.x, -mBounds.y);
// Snap translations to device pixels, to match what we do for CSS transforms
// and because the window server rounds down instead of to nearest.
if (!transform.HasNonTranslation() && transform.HasNonIntegerTranslation()) {
auto snappedTranslation = gfx::IntPoint::Round(transform.GetTranslation());
transform = gfx::Matrix::Translation(snappedTranslation.x,
snappedTranslation.y);
}
// We also need to account for the backing scale factor: aTransform is given
// in device pixels, but CGSSetWindowTransform works with logical display
// pixels.