diff --git a/layout/xul/nsMenuPopupFrame.cpp b/layout/xul/nsMenuPopupFrame.cpp index d481fe4af443..3898eeee1162 100644 --- a/layout/xul/nsMenuPopupFrame.cpp +++ b/layout/xul/nsMenuPopupFrame.cpp @@ -1569,23 +1569,23 @@ nsresult nsMenuPopupFrame::SetPopupPosition(nsIFrame* aAnchorFrame, #ifdef MOZ_WAYLAND if (IS_WAYLAND_DISPLAY()) { if (nsIWidget* widget = GetWidget()) { - nsRect prefRect = LayoutDeviceIntRect::ToAppUnits( - widget->GetMoveToRectPopupRect(), presContext->AppUnitsPerDevPixel()); - if (prefRect.width > 0 && mRect.width > prefRect.width) { + nsSize prefSize = LayoutDeviceIntRect::ToAppUnits( + widget->GetMoveToRectPopupSize(), presContext->AppUnitsPerDevPixel()); + if (prefSize.width > 0 && mRect.width > prefSize.width) { LOG_WAYLAND( "nsMenuPopupFrame::SetPopupPosition [%p]: MoveToRect change " "width from %d to %d", widget, mRect.width / presContext->AppUnitsPerDevPixel(), - prefRect.width / presContext->AppUnitsPerDevPixel()); - mRect.width = prefRect.width; + prefSize.width / presContext->AppUnitsPerDevPixel()); + mRect.width = prefSize.width; } - if (prefRect.height > 0 && mRect.height > prefRect.height) { + if (prefSize.height > 0 && mRect.height > prefSize.height) { LOG_WAYLAND( "nsMenuPopupFrame::SetPopupPosition [%p]: MoveToRect change " "height from %d to %d", widget, mRect.height / presContext->AppUnitsPerDevPixel(), - prefRect.height / presContext->AppUnitsPerDevPixel()); - mRect.height = prefRect.height; + prefSize.height / presContext->AppUnitsPerDevPixel()); + mRect.height = prefSize.height; } } } diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp index bd9e502ec41d..723182b0d918 100644 --- a/widget/gtk/nsWindow.cpp +++ b/widget/gtk/nsWindow.cpp @@ -1030,19 +1030,8 @@ void nsWindow::Move(double aX, double aY) { return; } - if (IsWaylandPopup()) { - // TODO: Do we need this? - auto prefBounds = mMoveToRectPopupRect; - if (prefBounds.TopLeft() != mBounds.TopLeft()) { - NativeMoveResize(/* move */ true, /* resize */ false); - NotifyRollupGeometryChange(); - } else { - LOG(" mBounds same as mMoveToRectPopupRect, no need to move"); - } - } else { - NativeMoveResize(/* move */ true, /* resize */ false); - NotifyRollupGeometryChange(); - } + NativeMoveResize(/* move */ true, /* resize */ false); + NotifyRollupGeometryChange(); } bool nsWindow::IsPopup() const { return mWindowType == eWindowType_popup; } @@ -1928,13 +1917,13 @@ void nsWindow::NativeMoveResizeWaylandPopupCallback( // Wayland compositor changed popup size request from layout. // Set the constraints to use them in nsMenuPopupFrame::SetPopupPosition(). if (newBounds.width < mBounds.width) { - mMoveToRectPopupRect.width = newBounds.width; + mMoveToRectPopupSize.width = newBounds.width; } if (newBounds.height < mBounds.height) { - mMoveToRectPopupRect.height = newBounds.height; + mMoveToRectPopupSize.height = newBounds.height; } - LOG(" mMoveToRectPopupRect set to [%d, %d]", mMoveToRectPopupRect.width, - mMoveToRectPopupRect.height); + LOG(" mMoveToRectPopupSize set to [%d, %d]", mMoveToRectPopupSize.width, + mMoveToRectPopupSize.height); } mBounds = newBounds; WaylandPopupPropagateChangesToLayout(needsPositionUpdate, needsSizeUpdate); diff --git a/widget/gtk/nsWindow.h b/widget/gtk/nsWindow.h index 088fe5f780a1..f9be816f281a 100644 --- a/widget/gtk/nsWindow.h +++ b/widget/gtk/nsWindow.h @@ -406,8 +406,8 @@ class nsWindow final : public nsBaseWidget { const LayoutDeviceIntPoint& aLockCenter) override; void LockNativePointer() override; void UnlockNativePointer() override; - LayoutDeviceIntRect GetMoveToRectPopupRect() const override { - return mMoveToRectPopupRect; + LayoutDeviceIntSize GetMoveToRectPopupSize() const override { + return mMoveToRectPopupSize; }; #endif @@ -821,9 +821,9 @@ class nsWindow final : public nsBaseWidget { RefPtr mWaylandPopupPrev; // When popup is resized by Gtk by move-to-rect callback, - // we store final popup size here. Then we use mMoveToRectPopupRect size + // we store final popup size here. Then we use mMoveToRectPopupSize size // in following popup operations unless mLayoutPopupSizeCleared is set. - LayoutDeviceIntRect mMoveToRectPopupRect; + LayoutDeviceIntSize mMoveToRectPopupSize; LayoutDeviceIntRect mNewBoundsAfterMoveToRect; diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h index 0142361a0064..499fa38f4cee 100644 --- a/widget/nsIWidget.h +++ b/widget/nsIWidget.h @@ -1710,9 +1710,9 @@ class nsIWidget : public nsISupports { /** * Wayland specific routines. */ - virtual LayoutDeviceIntRect GetMoveToRectPopupRect() const { + virtual LayoutDeviceIntSize GetMoveToRectPopupSize() const { NS_WARNING("GetLayoutPopupRect implemented only for wayland"); - return LayoutDeviceIntRect(); + return LayoutDeviceIntSize(); } /**