bug 861270 - prefer to use precise scale factor from GetDefaultScale() rather than approximate factor based on appUnits per devpix. r=roc

This commit is contained in:
Jonathan Kew 2013-04-18 16:35:49 +01:00
parent e73c910d32
commit 4c7c6fe7b8

View File

@ -261,7 +261,24 @@ void nsView::DoResetWidgetBounds(bool aMoveOnly,
// (bug 814434).
nsRefPtr<nsDeviceContext> dx;
mViewManager->GetDeviceContext(*getter_AddRefs(dx));
double invScale = dx->UnscaledAppUnitsPerDevPixel() / 60.0;
double invScale;
// Bug 861270: for correct widget manipulation at arbitrary scale factors,
// prefer to base scaling on mWindow->GetDefaultScale(). But only do this if
// it matches the view manager's device context scale after allowing for the
// quantization to app units, because of OS X multiscreen issues (where the
// only two scales are 1.0 or 2.0, and so the quantization doesn't actually
// cause problems anyhow).
// In the case of a mismatch, fall back to scaling based on the dev context's
// unscaledAppUnitsPerDevPixel value. On platforms where the device-pixel
// scale is uniform across all displays (currently all except OS X), we'll
// always use the precise value from mWindow->GetDefaultScale here.
double scale = mWindow->GetDefaultScale();
if (NSToIntRound(60.0 / scale) == dx->UnscaledAppUnitsPerDevPixel()) {
invScale = 1.0 / scale;
} else {
invScale = dx->UnscaledAppUnitsPerDevPixel() / 60.0;
}
if (changedPos) {
if (changedSize && !aMoveOnly) {