Bug 1259065 - Don't constrain window position (only its size) when DPI-rescaling during a move. r=emk a=ritu
MozReview-Commit-ID: Dx8o4tFYBU3
--- a/widget/windows/nsWindow.cpp
+++ b/widget/windows/nsWindow.cpp
@@ -6898,26 +6898,29 @@ nsWindow::OnDPIChanged(int32_t x, int32_
int32_t h = sr.height - cr.height + NSToIntRound(cr.height * ratio);
// Adjust x and y to preserve the center point of the suggested rect.
x -= (w - width) / 2;
y -= (h - height) / 2;
width = w;
height = h;
}
- // Limit the position & size, if it would overflow the destination screen
+ // Limit the position (if not in the middle of a drag-move) & size,
+ // if it would overflow the destination screen
nsCOMPtr<nsIScreenManager> sm = do_GetService(sScreenManagerContractID);
if (sm) {
nsCOMPtr<nsIScreen> screen;
sm->ScreenForRect(x, y, width, height, getter_AddRefs(screen));
if (screen) {
int32_t availLeft, availTop, availWidth, availHeight;
screen->GetAvailRect(&availLeft, &availTop, &availWidth, &availHeight);
- x = std::max(x, availLeft);
- y = std::max(y, availTop);
+ if (mResizeState != MOVING) {
+ x = std::max(x, availLeft);
+ y = std::max(y, availTop);
+ }
width = std::min(width, availWidth);
height = std::min(height, availHeight);
}
}
Resize(x, y, width, height, true);
}
ChangedDPI();