Skip to content
This repository was archived by the owner on Jul 9, 2025. It is now read-only.

Commit f9d7f39

Browse files
committed
Bug 1631458 Account font scale factor for the popup placement under wayland; r=stransky
The font scale factor needs to be accounted for the popup anchor rect under Wayland. Differential Revision: https://phabricator.services.mozilla.com/D72100
1 parent 1c08c16 commit f9d7f39

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

widget/gtk/nsWindow.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,7 +1162,7 @@ void nsWindow::Move(double aX, double aY) {
11621162
if (!mCreated) return;
11631163

11641164
if (IsWaylandPopup()) {
1165-
int32_t p2a = AppUnitsPerCSSPixel();
1165+
int32_t p2a = AppUnitsPerCSSPixel() / gfxPlatformGtk::GetFontScaleFactor();
11661166
if (mPreferredPopupRect.x != mBounds.x * p2a &&
11671167
mPreferredPopupRect.y != mBounds.y * p2a) {
11681168
NativeMove();
@@ -1451,7 +1451,7 @@ void nsWindow::NativeMoveResizeWaylandPopupCB(const GdkRectangle* aFinalSize,
14511451
// Update view
14521452

14531453
if (needsSizeUpdate) {
1454-
int32_t p2a = AppUnitsPerCSSPixel();
1454+
int32_t p2a = AppUnitsPerCSSPixel() / gfxPlatformGtk::GetFontScaleFactor();
14551455
mPreferredPopupRect = nsRect(NSIntPixelsToAppUnits(newBounds.x, p2a),
14561456
NSIntPixelsToAppUnits(newBounds.y, p2a),
14571457
NSIntPixelsToAppUnits(newBounds.width, p2a),
@@ -1550,10 +1550,11 @@ void nsWindow::NativeMoveResizeWaylandPopup(GdkPoint* aPosition,
15501550
// Get anchor rectangle
15511551
LayoutDeviceIntRect anchorRect(0, 0, 0, 0);
15521552
nsMenuPopupFrame* popupFrame = GetMenuPopupFrame(GetFrame());
1553+
int32_t p2a = AppUnitsPerCSSPixel() / gfxPlatformGtk::GetFontScaleFactor();
15531554
if (popupFrame) {
15541555
#ifdef MOZ_WAYLAND
15551556
anchorRect = LayoutDeviceIntRect::FromAppUnitsToNearest(
1556-
popupFrame->GetAnchorRect(), AppUnitsPerCSSPixel());
1557+
popupFrame->GetAnchorRect(), p2a);
15571558
#endif
15581559
}
15591560

@@ -1689,7 +1690,6 @@ void nsWindow::NativeMoveResizeWaylandPopup(GdkPoint* aPosition,
16891690
G_CALLBACK(NativeMoveResizeWaylandPopupCallback), this);
16901691
}
16911692

1692-
int32_t p2a = AppUnitsPerCSSPixel();
16931693
LOG((" popup window cursor offset x: %d y: %d\n", cursorOffset.x / p2a,
16941694
cursorOffset.y / p2a));
16951695
mWaitingForMoveToRectCB = true;

0 commit comments

Comments
 (0)