forked from mirrors/gecko-dev
Bug 1786588 - Don't unnecessarily MoveResize windows if they haven't moved or resize. r=stransky
I was looking into bug 1786525 and this caused some useless notifications which we can avoid. Differential Revision: https://phabricator.services.mozilla.com/D155407
This commit is contained in:
parent
cf74fba975
commit
163b9c7bda
1 changed files with 10 additions and 4 deletions
|
|
@ -930,15 +930,17 @@ void nsWindow::Show(bool aState) {
|
|||
void nsWindow::ResizeInt(const Maybe<LayoutDeviceIntPoint>& aMove,
|
||||
LayoutDeviceIntSize aSize) {
|
||||
LOG("nsWindow::ResizeInt w:%d h:%d\n", aSize.width, aSize.height);
|
||||
if (aMove) {
|
||||
mBounds.x = aMove->x;
|
||||
mBounds.y = aMove->y;
|
||||
const bool moved = aMove && *aMove != mBounds.TopLeft();
|
||||
if (moved) {
|
||||
mBounds.MoveTo(*aMove);
|
||||
LOG(" with move to left:%d top:%d", aMove->x, aMove->y);
|
||||
}
|
||||
|
||||
ConstrainSize(&aSize.width, &aSize.height);
|
||||
LOG(" ConstrainSize: w:%d h;%d\n", aSize.width, aSize.height);
|
||||
|
||||
const bool resized = aSize != mLastSizeRequest;
|
||||
|
||||
// For top-level windows, aSize should possibly be
|
||||
// interpreted as frame bounds, but NativeMoveResize treats these as window
|
||||
// bounds (Bug 581866).
|
||||
|
|
@ -959,7 +961,11 @@ void nsWindow::ResizeInt(const Maybe<LayoutDeviceIntPoint>& aMove,
|
|||
return;
|
||||
}
|
||||
|
||||
NativeMoveResize(aMove.isSome(), true);
|
||||
if (!moved && !resized) {
|
||||
return;
|
||||
}
|
||||
|
||||
NativeMoveResize(moved, resized);
|
||||
|
||||
// We optimistically assume size changes immediately in two cases:
|
||||
// 1. Override-redirect window: Size is controlled by only us.
|
||||
|
|
|
|||
Loading…
Reference in a new issue