tor-browser

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

commit b060f7a1e15e4bd5f4eb98ace7b08090f77d5139
parent fe7c15268a75eb424e4be0bc47420a3da4d0c83f
Author: Emilio Cobos Álvarez <emilio@crisal.io>
Date:   Tue, 21 Oct 2025 08:02:41 +0000

Bug 1995120 - Fix coordinate confusions exposed by bug 1995049. r=win-reviewers,handyman

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

Diffstat:
Mwidget/windows/nsWindow.cpp | 16++++++----------
1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/widget/windows/nsWindow.cpp b/widget/windows/nsWindow.cpp @@ -1081,11 +1081,7 @@ nsresult nsWindow::Create(nsIWidget* aParent, const LayoutDeviceIntRect& aRect, mIsCloaked = mozilla::IsCloaked(mWnd); mFrameState->ConsumePreXULSkeletonState(WasPreXULSkeletonUIMaximized()); - // FIXME(emilio): This looks wrong, mBounds and mLastPaintBounds - // are LayoutDevice coords... - auto scale = GetDesktopToDeviceScale(); - mBounds = mLastPaintBounds = LayoutDeviceIntRect::FromUnknownRect( - DesktopIntRect::Round(GetBounds() / scale).ToUnknownRect()); + mBounds = mLastPaintBounds = GetBounds(); // Reset the WNDPROC for this window and its whole class, as we had // to use our own WNDPROC when creating the the skeleton UI window. @@ -6482,8 +6478,9 @@ void nsWindow::OnWindowPosChanged(WINDOWPOS* wp) { NS_DispatchToMainThread(NS_NewRunnableFunction( "EnforceAspectRatio", [self, this, newWidth]() -> void { if (mWnd) { - // FIXME: This seems wrong? newWidth is LayoutDevicePixel - Resize(DesktopSize(newWidth, newWidth / mAspectRatio), true); + Resize(LayoutDeviceSize(newWidth, newWidth / mAspectRatio) / + GetDesktopToDeviceScale(), + true); } })); } @@ -7046,9 +7043,8 @@ void nsWindow::OnDPIChanged(int32_t x, int32_t y, int32_t width, } } - // FIXME(emilio): This looks wrong, x / y / width / height are - // LayoutDevice coords... - Resize(DesktopRect(x, y, width, height), true); + Resize(LayoutDeviceIntRect(x, y, width, height) / GetDesktopToDeviceScale(), + true); } UpdateNonClientMargins(); ChangedDPI();