tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

commit f465bef00d657c5295a5e309a5ae38886bdd1272
parent 2cf9c646d8d6490818fd623facca74f1295ac906
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date:   Tue, 16 Dec 2025 22:25:16 +0000

Bug 2006320 - Clean up WindowMoved / WindowResized to use typed units. r=win-reviewers,gstoll

Make sure that we notify of outer position and inner sizes.

Differential Revision: https://phabricator.services.mozilla.com/D276645

Diffstat:
Mlayout/base/PresShellWidgetListener.cpp | 19+++++++++----------
Mlayout/base/PresShellWidgetListener.h | 3+--
Mlayout/xul/nsMenuPopupFrame.cpp | 32++++++++++++++------------------
Mlayout/xul/nsMenuPopupFrame.h | 5+++--
Mwidget/PuppetWidget.cpp | 5++---
Mwidget/PuppetWidget.h | 2+-
Mwidget/android/nsWindow.cpp | 11+++++------
Mwidget/android/nsWindow.h | 2+-
Mwidget/cocoa/nsCocoaWindow.mm | 5++---
Mwidget/gtk/nsWindow.cpp | 16++++++----------
Mwidget/headless/HeadlessWidget.cpp | 7+++----
Mwidget/nsIWidget.cpp | 10++++++++--
Mwidget/nsIWidget.h | 4+++-
Mwidget/nsIWidgetListener.h | 19+++++++------------
Mwidget/uikit/nsWindow.mm | 7+++----
Mwidget/windows/nsWindow.cpp | 14+++++---------
Mwidget/windows/nsWindow.h | 2+-
Mxpfe/appshell/AppWindow.cpp | 27+++++++++++----------------
Mxpfe/appshell/AppWindow.h | 9++++-----
19 files changed, 89 insertions(+), 110 deletions(-)

diff --git a/layout/base/PresShellWidgetListener.cpp b/layout/base/PresShellWidgetListener.cpp @@ -113,16 +113,16 @@ void PresShellWidgetListener::DetachFromTopLevelWidget() { PresShell* PresShellWidgetListener::GetPresShell() { return mPresShell; } -bool PresShellWidgetListener::WindowResized(nsIWidget* aWidget, int32_t aWidth, - int32_t aHeight) { +void PresShellWidgetListener::WindowResized(nsIWidget*, + const LayoutDeviceIntSize& aSize) { RefPtr<PresShell> ps = GetPresShell(); if (!ps) { - return false; + return; } nsPresContext* pc = ps->GetPresContext(); if (!pc) { - return false; + return; } // ensure DPI is up-to-date, in case of window being opened and sized @@ -135,18 +135,16 @@ bool PresShellWidgetListener::WindowResized(nsIWidget* aWidget, int32_t aWidth, // due to a call to e.g. nsDocumentViewer::GetContentSize or so. frame->InvalidateFrame(); } - const LayoutDeviceIntSize size(aWidth, aHeight); - ps->SetLayoutViewportSize(LayoutDeviceIntSize::ToAppUnits(size, p2a), + ps->SetLayoutViewportSize(LayoutDeviceIntSize::ToAppUnits(aSize, p2a), /* aDelay = */ false); if (nsXULPopupManager* pm = nsXULPopupManager::GetInstance()) { pm->AdjustPopupsOnWindowChange(ps); } - - return true; } -void PresShellWidgetListener::DynamicToolbarMaxHeightChanged(ScreenIntCoord aHeight) { +void PresShellWidgetListener::DynamicToolbarMaxHeightChanged( + ScreenIntCoord aHeight) { MOZ_ASSERT(XRE_IsParentProcess(), "Should be only called for the browser parent process"); CallOnAllRemoteChildren( @@ -156,7 +154,8 @@ void PresShellWidgetListener::DynamicToolbarMaxHeightChanged(ScreenIntCoord aHei }); } -void PresShellWidgetListener::DynamicToolbarOffsetChanged(ScreenIntCoord aOffset) { +void PresShellWidgetListener::DynamicToolbarOffsetChanged( + ScreenIntCoord aOffset) { MOZ_ASSERT(XRE_IsParentProcess(), "Should be only called for the browser parent process"); CallOnAllRemoteChildren( diff --git a/layout/base/PresShellWidgetListener.h b/layout/base/PresShellWidgetListener.h @@ -57,8 +57,7 @@ class PresShellWidgetListener final : public nsIWidgetListener { bool IsPaintSuppressed() const override { return IsPrimaryFramePaintSuppressed(); } - bool WindowResized(nsIWidget* aWidget, int32_t aWidth, - int32_t aHeight) override; + void WindowResized(nsIWidget*, const LayoutDeviceIntSize&) override; void DynamicToolbarMaxHeightChanged(mozilla::ScreenIntCoord aHeight) override; void DynamicToolbarOffsetChanged(mozilla::ScreenIntCoord aOffset) override; void KeyboardHeightChanged(mozilla::ScreenIntCoord aHeight) override; diff --git a/layout/xul/nsMenuPopupFrame.cpp b/layout/xul/nsMenuPopupFrame.cpp @@ -2505,22 +2505,21 @@ void nsMenuPopupFrame::CheckForAnchorChange(nsRect& aRect) { } } -bool nsMenuPopupFrame::WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY, +void nsMenuPopupFrame::WindowMoved(nsIWidget* aWidget, + const LayoutDeviceIntPoint& aPoint, ByMoveToRect aByMoveToRect) { MOZ_ASSERT(aWidget == mWidget); if (!IsVisibleOrShowing()) { - return true; + return; } - LayoutDeviceIntPoint point(aX, aY); - // Don't do anything if the popup is already at the specified location. This // prevents recursive calls when a popup is positioned. LayoutDeviceIntRect curDevBounds = CalcWidgetBounds(); - if (curDevBounds.TopLeft() == point && + if (curDevBounds.TopLeft() == aPoint && aWidget->GetClientOffset() == GetLastClientOffset()) { - return true; + return; } // Update the popup's position using SetPopupPosition if the popup is @@ -2532,46 +2531,43 @@ bool nsMenuPopupFrame::WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY, aByMoveToRect == ByMoveToRect::No) { SetPopupPosition(true); } else { - CSSPoint cssPos = point / PresContext()->CSSToDevPixelScale(); + CSSPoint cssPos = aPoint / PresContext()->CSSToDevPixelScale(); MoveTo(cssPos, false, aByMoveToRect == ByMoveToRect::Yes); } - return true; } -bool nsMenuPopupFrame::WindowResized(nsIWidget* aWidget, int32_t aWidth, - int32_t aHeight) { +void nsMenuPopupFrame::WindowResized(nsIWidget* aWidget, + const LayoutDeviceIntSize& aSize) { MOZ_ASSERT(aWidget == mWidget); if (!IsVisibleOrShowing()) { - return true; + return; } - LayoutDeviceIntSize size(aWidth, aHeight); const LayoutDeviceIntRect curDevBounds = CalcWidgetBounds(); // If the size is what we think it is, we have nothing to do. - if (curDevBounds.Size() == size) { - return true; + if (curDevBounds.Size() == aSize) { + return; } RefPtr<Element> popup = &PopupElement(); // Only set the width and height if the popup already has these attributes. if (!popup->HasAttr(nsGkAtoms::width) || !popup->HasAttr(nsGkAtoms::height)) { - return true; + return; } // The size is different. Convert the actual size to css pixels and store it // as 'width' and 'height' attributes on the popup. nsPresContext* presContext = PresContext(); - CSSIntSize newCSS(presContext->DevPixelsToIntCSSPixels(size.width), - presContext->DevPixelsToIntCSSPixels(size.height)); + CSSIntSize newCSS(presContext->DevPixelsToIntCSSPixels(aSize.width), + presContext->DevPixelsToIntCSSPixels(aSize.height)); nsAutoString width, height; width.AppendInt(newCSS.width); height.AppendInt(newCSS.height); popup->SetAttr(kNameSpaceID_None, nsGkAtoms::width, width, true); popup->SetAttr(kNameSpaceID_None, nsGkAtoms::height, height, true); - return true; } bool nsMenuPopupFrame::RequestWindowClose(nsIWidget* aWidget) { diff --git a/layout/xul/nsMenuPopupFrame.h b/layout/xul/nsMenuPopupFrame.h @@ -200,8 +200,9 @@ class nsMenuPopupFrame final : public nsBlockFrame, public nsIWidgetListener { // nsIWidgetListener mozilla::PresShell* GetPresShell() override { return PresShell(); } nsMenuPopupFrame* GetAsMenuPopupFrame() override { return this; } - bool WindowMoved(nsIWidget*, int32_t aX, int32_t aY, ByMoveToRect) override; - bool WindowResized(nsIWidget*, int32_t aWidth, int32_t aHeight) override; + void WindowMoved(nsIWidget*, const mozilla::LayoutDeviceIntPoint&, + ByMoveToRect) override; + void WindowResized(nsIWidget*, const mozilla::LayoutDeviceIntSize&) override; bool RequestWindowClose(nsIWidget*) override; MOZ_CAN_RUN_SCRIPT_BOUNDARY nsEventStatus HandleEvent(mozilla::WidgetGUIEvent* aEvent) override; diff --git a/widget/PuppetWidget.cpp b/widget/PuppetWidget.cpp @@ -172,10 +172,9 @@ void PuppetWidget::Resize(const DesktopSize& aSize, bool aRepaint) { if (!oldBounds.IsEqualEdges(mBounds) && mAttachedWidgetListener) { if (auto* paintListener = GetPaintListener(); paintListener && paintListener != mAttachedWidgetListener) { - paintListener->WindowResized(this, mBounds.Width(), mBounds.Height()); + paintListener->WindowResized(this, mBounds.Size()); } - mAttachedWidgetListener->WindowResized(this, mBounds.Width(), - mBounds.Height()); + mAttachedWidgetListener->WindowResized(this, mBounds.Size()); } } diff --git a/widget/PuppetWidget.h b/widget/PuppetWidget.h @@ -90,7 +90,7 @@ class PuppetWidget final : public nsIWidget, void Resize(const DesktopRect& aRect, bool aRepaint) override { auto targetRect = gfx::RoundedToInt(aRect * GetDesktopToDeviceScale()); if (mBounds.TopLeft() != targetRect.TopLeft()) { - NotifyWindowMoved(targetRect.X(), targetRect.Y()); + NotifyWindowMoved(targetRect.TopLeft()); } mBounds.MoveTo(targetRect.TopLeft()); return Resize(aRect.Size(), aRepaint); diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp @@ -2510,7 +2510,7 @@ void nsWindow::DoResize(double aX, double aY, double aWidth, double aHeight, bool needSizeDispatch = mBounds.Size() != oldBounds.Size(); if (needSizeDispatch) { - OnSizeChanged(mBounds.Size().ToUnknownSize()); + OnSizeChanged(mBounds.Size()); } if (needPositionDispatch) { @@ -2842,21 +2842,20 @@ void nsWindow::UpdateDragImage(java::sdk::Bitmap::LocalRef aBitmap) { } } -void nsWindow::OnSizeChanged(const gfx::IntSize& aSize) { +void nsWindow::OnSizeChanged(const LayoutDeviceIntSize& aSize) { ALOG("nsWindow: %p OnSizeChanged [%d %d]", (void*)this, aSize.width, aSize.height); if (mWidgetListener) { - mWidgetListener->WindowResized(this, aSize.width, aSize.height); + mWidgetListener->WindowResized(this, aSize); } if (mAttachedWidgetListener) { - mAttachedWidgetListener->WindowResized(this, aSize.width, aSize.height); + mAttachedWidgetListener->WindowResized(this, aSize); } if (mCompositorWidgetDelegate) { - mCompositorWidgetDelegate->NotifyClientSizeChanged( - LayoutDeviceIntSize::FromUnknownSize(aSize)); + mCompositorWidgetDelegate->NotifyClientSizeChanged(aSize); } } diff --git a/widget/android/nsWindow.h b/widget/android/nsWindow.h @@ -282,7 +282,7 @@ class nsWindow final : public nsIWidget { void CreateLayerManager(); void RedrawAll(); - void OnSizeChanged(const mozilla::gfx::IntSize& aSize); + void OnSizeChanged(const mozilla::LayoutDeviceIntSize& aSize); mozilla::layers::LayersId GetRootLayerId() const; RefPtr<mozilla::layers::UiCompositorControllerChild> diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm @@ -6606,11 +6606,10 @@ void nsCocoaWindow::ReportSizeEvent() { UpdateBounds(); LayoutDeviceIntRect innerBounds = GetClientBounds(); if (mWidgetListener) { - mWidgetListener->WindowResized(this, innerBounds.width, innerBounds.height); + mWidgetListener->WindowResized(this, innerBounds.Size()); } if (mAttachedWidgetListener) { - mAttachedWidgetListener->WindowResized(this, innerBounds.width, - innerBounds.height); + mAttachedWidgetListener->WindowResized(this, innerBounds.Size()); } NS_OBJC_END_TRY_IGNORE_BLOCK; } diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp @@ -622,11 +622,10 @@ void nsWindow::DispatchResized() { } if (mWidgetListener) { - mWidgetListener->WindowResized(this, clientSize.width, clientSize.height); + mWidgetListener->WindowResized(this, clientSize); } if (mAttachedWidgetListener) { - mAttachedWidgetListener->WindowResized(this, clientSize.width, - clientSize.height); + mAttachedWidgetListener->WindowResized(this, clientSize); } } @@ -2070,9 +2069,8 @@ void nsWindow::WaylandPopupPropagateChangesToLayout(bool aMove, bool aResize) { } } if (aMove) { - auto pos = ToLayoutDevicePixels(mClientArea); - LOG(" needPositionUpdate, bounds [%d, %d]", pos.x, pos.y); - NotifyWindowMoved(pos.x, pos.y, ByMoveToRect::Yes); + LOG(" needPositionUpdate, bounds [%d, %d]", mClientArea.x, mClientArea.y); + NotifyWindowMoved(mClientArea.TopLeft(), ByMoveToRect::Yes); } } @@ -3587,8 +3585,7 @@ void nsWindow::RecomputeBounds(bool aMayChangeCsdMargin, bool aScaleChange) { oldClientArea.Size() != mClientArea.Size(); if (moved) { - auto pos = ToLayoutDevicePixels(mClientArea.TopLeft()); - NotifyWindowMoved(pos.x, pos.y); + NotifyWindowMoved(GetScreenBoundsUnscaled().TopLeft()); } if (resized) { DispatchResized(); @@ -6858,8 +6855,7 @@ void nsWindow::NativeMoveResize(bool aMoved, bool aResized) { } if (aMoved) { mClientArea.MoveTo(mLastMoveRequest); - auto pos = ToLayoutDevicePixels(mLastMoveRequest); - NotifyWindowMoved(pos.x, pos.y); + NotifyWindowMoved(mClientArea.TopLeft()); } if (aResized) { DispatchResized(); diff --git a/widget/headless/HeadlessWidget.cpp b/widget/headless/HeadlessWidget.cpp @@ -223,7 +223,7 @@ void HeadlessWidget::MoveInternal(int32_t aX, int32_t aY) { } mBounds.MoveTo(aX, aY); - NotifyWindowMoved(aX, aY); + NotifyWindowMoved(mBounds.TopLeft()); } LayoutDeviceIntPoint HeadlessWidget::WidgetToScreenOffset() { @@ -264,11 +264,10 @@ void HeadlessWidget::ResizeInternal(int32_t aWidth, int32_t aHeight, mCompositorWidget->NotifyClientSizeChanged(mBounds.Size()); } if (mWidgetListener) { - mWidgetListener->WindowResized(this, mBounds.Width(), mBounds.Height()); + mWidgetListener->WindowResized(this, mBounds.Size()); } if (mAttachedWidgetListener) { - mAttachedWidgetListener->WindowResized(this, mBounds.Width(), - mBounds.Height()); + mAttachedWidgetListener->WindowResized(this, mBounds.Size()); } } diff --git a/widget/nsIWidget.cpp b/widget/nsIWidget.cpp @@ -1896,10 +1896,10 @@ void nsIWidget::NotifyWindowDestroyed() { } } -void nsIWidget::NotifyWindowMoved(int32_t aX, int32_t aY, +void nsIWidget::NotifyWindowMoved(const LayoutDeviceIntPoint& aPoint, ByMoveToRect aByMoveToRect) { if (mWidgetListener) { - mWidgetListener->WindowMoved(this, aX, aY, aByMoveToRect); + mWidgetListener->WindowMoved(this, aPoint, aByMoveToRect); } if (mIMEHasFocus && IMENotificationRequestsRef().WantPositionChanged()) { @@ -1907,6 +1907,12 @@ void nsIWidget::NotifyWindowMoved(int32_t aX, int32_t aY, } } +void nsIWidget::NotifyWindowMoved(const DesktopIntPoint& aPoint, + ByMoveToRect aByMoveToRect) { + return NotifyWindowMoved( + LayoutDeviceIntPoint::Round(aPoint * GetDesktopToDeviceScale())); +} + void nsIWidget::NotifySizeMoveDone() { if (!mWidgetListener) { return; diff --git a/widget/nsIWidget.h b/widget/nsIWidget.h @@ -1300,7 +1300,9 @@ class nsIWidget : public nsSupportsWeakReference { void NotifyWindowDestroyed(); void NotifySizeMoveDone(); using ByMoveToRect = nsIWidgetListener::ByMoveToRect; - void NotifyWindowMoved(int32_t aX, int32_t aY, + void NotifyWindowMoved(const LayoutDeviceIntPoint&, + ByMoveToRect = ByMoveToRect::No); + void NotifyWindowMoved(const DesktopIntPoint&, ByMoveToRect = ByMoveToRect::No); // Should be called by derived implementations to notify on system color and // theme changes. (Only one invocation per change is needed, not one diff --git a/widget/nsIWidgetListener.h b/widget/nsIWidgetListener.h @@ -55,23 +55,18 @@ class nsIWidgetListener { virtual mozilla::PresShell* GetPresShell() { return nullptr; } /** - * Called when a window is moved to location (x, y). Returns true if the - * notification was handled. Coordinates are outer window screen coordinates. + * Called when a window is moved to location. + * Coordinates are outer window screen coordinates. */ enum class ByMoveToRect : bool { No, Yes }; - virtual bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY, - ByMoveToRect) { - return false; - } + virtual void WindowMoved(nsIWidget*, const mozilla::LayoutDeviceIntPoint&, + ByMoveToRect) {} /** - * Called when a window is resized to (width, height). Returns true if the - * notification was handled. Coordinates are outer window screen coordinates. + * Called when a window is resized. + * Coordinates are outer window screen coordinates. */ - virtual bool WindowResized(nsIWidget* aWidget, int32_t aWidth, - int32_t aHeight) { - return false; - } + virtual void WindowResized(nsIWidget*, const mozilla::LayoutDeviceIntSize&) {} /** * Called when the size mode (minimized, maximized, fullscreen) is changed. diff --git a/widget/uikit/nsWindow.mm b/widget/uikit/nsWindow.mm @@ -960,7 +960,7 @@ void nsWindow::PaintWindow() { } } -void nsWindow::ReportMoveEvent() { NotifyWindowMoved(mBounds.x, mBounds.y); } +void nsWindow::ReportMoveEvent() { NotifyWindowMoved(mBounds.TopLeft()); } void nsWindow::ReportSizeModeEvent(nsSizeMode aMode) { if (mWidgetListener) { @@ -984,12 +984,11 @@ void nsWindow::ReportSizeEvent() { LayoutDeviceIntRect innerBounds = GetClientBounds(); if (mWidgetListener) { - mWidgetListener->WindowResized(this, innerBounds.width, innerBounds.height); + mWidgetListener->WindowResized(this, innerBounds.Size()); } if (mAttachedWidgetListener) { - mAttachedWidgetListener->WindowResized(this, innerBounds.width, - innerBounds.height); + mAttachedWidgetListener->WindowResized(this, innerBounds.Size()); } } diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp @@ -6382,7 +6382,7 @@ void nsWindow::OnWindowPosChanged(WINDOWPOS* wp) { // Handle window position changes if (!(wp->flags & SWP_NOMOVE)) { mBounds.MoveTo(wp->x, wp->y); - NotifyWindowMoved(wp->x, wp->y); + NotifyWindowMoved(mBounds.TopLeft()); } // Handle window size changes @@ -6912,25 +6912,21 @@ void nsWindow::OnDestroy() { } // Send a resize message to the listener -bool nsWindow::OnResize(const LayoutDeviceIntSize& aSize) { +void nsWindow::OnResize(const LayoutDeviceIntSize& aSize) { if (mCompositorWidgetDelegate && !mCompositorWidgetDelegate->OnWindowResize(aSize)) { - return false; + return; } - bool result = false; if (mWidgetListener) { - result = mWidgetListener->WindowResized(this, aSize.width, aSize.height); + mWidgetListener->WindowResized(this, aSize); } // If there is an attached view, inform it as well as the normal widget // listener. if (mAttachedWidgetListener) { - return mAttachedWidgetListener->WindowResized(this, aSize.width, - aSize.height); + mAttachedWidgetListener->WindowResized(this, aSize); } - - return result; } void nsWindow::OnSizeModeChange() { diff --git a/widget/windows/nsWindow.h b/widget/windows/nsWindow.h @@ -578,7 +578,7 @@ class nsWindow final : public nsIWidget { * Event handlers */ void OnDestroy() override; - bool OnResize(const LayoutDeviceIntSize& aSize); + void OnResize(const LayoutDeviceIntSize& aSize); void OnSizeModeChange(); bool OnGesture(WPARAM wParam, LPARAM lParam); bool OnTouch(WPARAM wParam, LPARAM lParam); diff --git a/xpfe/appshell/AppWindow.cpp b/xpfe/appshell/AppWindow.cpp @@ -2621,9 +2621,8 @@ PresShell* AppWindow::GetPresShell() { return mDocShell->GetPresShell(); } -bool AppWindow::WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y) { - nsXULPopupManager* pm = nsXULPopupManager::GetInstance(); - if (pm) { +void AppWindow::WindowMoved(nsIWidget*, const LayoutDeviceIntPoint&) { + if (nsXULPopupManager* pm = nsXULPopupManager::GetInstance()) { nsCOMPtr<nsPIDOMWindowOuter> window = mDocShell ? mDocShell->GetWindow() : nullptr; pm->AdjustPopupsOnWindowChange(window); @@ -2641,14 +2640,13 @@ bool AppWindow::WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y) { // Persist position, but not immediately, in case this OS is firing // repeated move events as the user drags the window PersistentAttributesDirty(PersistentAttribute::Position, Async); - return false; } -bool AppWindow::WindowResized(nsIWidget* aWidget, int32_t aWidth, - int32_t aHeight) { +void AppWindow::WindowResized(nsIWidget* aWidget, + const LayoutDeviceIntSize& aSize) { mDominantClientSize = false; if (mDocShell) { - mDocShell->SetPositionAndSize(0, 0, aWidth, aHeight, 0); + mDocShell->SetPositionAndSize(0, 0, aSize.width, aSize.height, 0); } // Persist size, but not immediately, in case this OS is firing // repeated size events as the user drags the sizing handle @@ -2670,7 +2668,6 @@ bool AppWindow::WindowResized(nsIWidget* aWidget, int32_t aWidth, case FullscreenChangeState::NotChanging: break; } - return true; } bool AppWindow::RequestWindowClose(nsIWidget* aWidget) { @@ -3192,18 +3189,16 @@ PresShell* AppWindow::WidgetListenerDelegate::GetPresShell() { return mAppWindow->GetPresShell(); } -bool AppWindow::WidgetListenerDelegate::WindowMoved(nsIWidget* aWidget, - int32_t aX, int32_t aY, - ByMoveToRect) { +void AppWindow::WidgetListenerDelegate::WindowMoved( + nsIWidget* aWidget, const LayoutDeviceIntPoint& aPoint, ByMoveToRect) { RefPtr<AppWindow> holder = mAppWindow; - return holder->WindowMoved(aWidget, aX, aY); + holder->WindowMoved(aWidget, aPoint); } -bool AppWindow::WidgetListenerDelegate::WindowResized(nsIWidget* aWidget, - int32_t aWidth, - int32_t aHeight) { +void AppWindow::WidgetListenerDelegate::WindowResized( + nsIWidget* aWidget, const LayoutDeviceIntSize& aSize) { RefPtr<AppWindow> holder = mAppWindow; - return holder->WindowResized(aWidget, aWidth, aHeight); + holder->WindowResized(aWidget, aSize); } bool AppWindow::WidgetListenerDelegate::RequestWindowClose(nsIWidget* aWidget) { diff --git a/xpfe/appshell/AppWindow.h b/xpfe/appshell/AppWindow.h @@ -89,11 +89,10 @@ class AppWindow final : public nsIBaseWindow, MOZ_CAN_RUN_SCRIPT_BOUNDARY mozilla::PresShell* GetPresShell() override; MOZ_CAN_RUN_SCRIPT_BOUNDARY - bool WindowMoved(nsIWidget* aWidget, int32_t x, int32_t y, + void WindowMoved(nsIWidget*, const LayoutDeviceIntPoint&, ByMoveToRect) override; MOZ_CAN_RUN_SCRIPT_BOUNDARY - bool WindowResized(nsIWidget* aWidget, int32_t aWidth, - int32_t aHeight) override; + void WindowResized(nsIWidget*, const LayoutDeviceIntSize&) override; MOZ_CAN_RUN_SCRIPT_BOUNDARY bool RequestWindowClose(nsIWidget* aWidget) override; MOZ_CAN_RUN_SCRIPT_BOUNDARY @@ -149,9 +148,9 @@ class AppWindow final : public nsIBaseWindow, nsIAppWindow* GetAppWindow() { return this; } mozilla::PresShell* GetPresShell(); MOZ_CAN_RUN_SCRIPT - bool WindowMoved(nsIWidget* aWidget, int32_t aX, int32_t aY); + void WindowMoved(nsIWidget*, const mozilla::LayoutDeviceIntPoint&); MOZ_CAN_RUN_SCRIPT - bool WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHeight); + void WindowResized(nsIWidget*, const mozilla::LayoutDeviceIntSize&); MOZ_CAN_RUN_SCRIPT bool RequestWindowClose(nsIWidget* aWidget); MOZ_CAN_RUN_SCRIPT void SizeModeChanged(nsSizeMode aSizeMode); MOZ_CAN_RUN_SCRIPT void FullscreenWillChange(bool aInFullscreen);