firefox/mozilla-1669495.patch

131 lines
5.2 KiB
Diff
Raw Normal View History

diff -up firefox-81.0.1/layout/xul/nsMenuPopupFrame.cpp.1669495 firefox-81.0.1/layout/xul/nsMenuPopupFrame.cpp
--- firefox-81.0.1/layout/xul/nsMenuPopupFrame.cpp.1669495 2020-10-08 10:09:23.765819989 +0200
+++ firefox-81.0.1/layout/xul/nsMenuPopupFrame.cpp 2020-10-08 10:09:23.771820010 +0200
@@ -533,6 +533,26 @@ void nsMenuPopupFrame::LayoutPopup(nsBox
}
prefSize = XULBoundsCheck(minSize, prefSize, maxSize);
+#ifdef MOZ_WAYLAND
+ static bool inWayland = gdk_display_get_default() &&
+ !GDK_IS_X11_DISPLAY(gdk_display_get_default());
+#else
+ static bool inWayland = false;
+#endif
+ if (inWayland) {
+ // If prefSize it is not a whole number in css pixels we need round it up
+ // to avoid reflow of the tooltips/popups and putting the text on two lines
+ // (usually happens with 200% scale factor and font scale factor <> 1)
+ // because GTK thrown away the decimals.
+ int32_t appPerCSS = AppUnitsPerCSSPixel();
+ if (prefSize.width % appPerCSS > 0) {
+ prefSize.width += appPerCSS;
+ }
+ if (prefSize.height % appPerCSS > 0) {
+ prefSize.height += appPerCSS;
+ }
+ }
+
bool sizeChanged = (mPrefSize != prefSize);
// if the size changed then set the bounds to be the preferred size
if (sizeChanged) {
diff -up firefox-81.0.1/widget/gtk/nsWindow.cpp.1669495 firefox-81.0.1/widget/gtk/nsWindow.cpp
--- firefox-81.0.1/widget/gtk/nsWindow.cpp.1669495 2020-10-08 10:09:23.770820007 +0200
+++ firefox-81.0.1/widget/gtk/nsWindow.cpp 2020-10-08 10:10:29.225052014 +0200
@@ -1090,11 +1090,13 @@ void nsWindow::Show(bool aState) {
void nsWindow::ResizeInt(int aX, int aY, int aWidth, int aHeight, bool aMove,
bool aRepaint) {
- LOG(("nsWindow::ResizeInt [%p] %d %d -> %d %d repaint %d\n", (void*)this, aX,
- aY, aWidth, aHeight, aRepaint));
+ LOG(("nsWindow::ResizeInt [%p] x:%d y:%d -> w:%d h:%d repaint %d aMove %d\n",
+ (void*)this, aX, aY, aWidth, aHeight, aRepaint, aMove));
ConstrainSize(&aWidth, &aHeight);
+ LOG((" ConstrainSize: w:%d h;%d\n", aWidth, aHeight));
+
if (aMove) {
mBounds.x = aX;
mBounds.y = aY;
@@ -1132,8 +1134,7 @@ void nsWindow::ResizeInt(int aX, int aY,
}
void nsWindow::Resize(double aWidth, double aHeight, bool aRepaint) {
- LOG(("nsWindow::Resize [%p] %d %d\n", (void*)this, (int)aWidth,
- (int)aHeight));
+ LOG(("nsWindow::Resize [%p] %f %f\n", (void*)this, aWidth, aHeight));
double scale =
BoundsUseDesktopPixels() ? GetDesktopToDeviceScale().scale : 1.0;
@@ -1145,8 +1146,8 @@ void nsWindow::Resize(double aWidth, dou
void nsWindow::Resize(double aX, double aY, double aWidth, double aHeight,
bool aRepaint) {
- LOG(("nsWindow::Resize [%p] %d %d repaint %d\n", (void*)this, (int)aWidth,
- (int)aHeight, aRepaint));
+ LOG(("nsWindow::Resize [%p] %f %f repaint %d\n", (void*)this, aWidth, aHeight,
+ aRepaint));
double scale =
BoundsUseDesktopPixels() ? GetDesktopToDeviceScale().scale : 1.0;
@@ -1469,14 +1470,15 @@ void nsWindow::NativeMoveResizeWaylandPo
newBounds.x = GdkCoordToDevicePixels(newBounds.x);
newBounds.y = GdkCoordToDevicePixels(newBounds.y);
- LOG((" new mBounds x=%d y=%d width=%d height=%d\n", newBounds.x,
- newBounds.y, newBounds.width, newBounds.height));
double scale =
BoundsUseDesktopPixels() ? GetDesktopToDeviceScale().scale : 1.0;
int32_t newWidth = NSToIntRound(scale * newBounds.width);
int32_t newHeight = NSToIntRound(scale * newBounds.height);
+ LOG((" new mBounds x=%d y=%d width=%d height=%d\n", newBounds.x,
+ newBounds.y, newWidth, newHeight));
+
bool needsPositionUpdate =
(newBounds.x != mBounds.x || newBounds.y != mBounds.y);
bool needsSizeUpdate =
@@ -1484,6 +1486,7 @@ void nsWindow::NativeMoveResizeWaylandPo
// Update view
if (needsSizeUpdate) {
+ LOG((" needSizeUpdate\n"));
int32_t p2a = AppUnitsPerCSSPixel() / gfxPlatformGtk::GetFontScaleFactor();
mPreferredPopupRect = nsRect(NSIntPixelsToAppUnits(newBounds.x, p2a),
NSIntPixelsToAppUnits(newBounds.y, p2a),
@@ -1502,6 +1505,7 @@ void nsWindow::NativeMoveResizeWaylandPo
}
if (needsPositionUpdate) {
+ LOG((" needPositionUpdate\n"));
// The newBounds are in coordinates relative to the parent window/popup.
// The NotifyWindowMoved requires the coordinates relative to the toplevel.
// We use the gdk_window_get_origin to get correct coordinates.
@@ -4211,6 +4215,8 @@ nsresult nsWindow::Create(nsIWidget* aPa
// save our bounds
mBounds = aRect;
+ LOG((" mBounds: x:%d y:%d w:%d h:%d\n", mBounds.x, mBounds.y, mBounds.width,
+ mBounds.height));
mPreferredPopupRectFlushed = false;
@@ -5061,13 +5067,16 @@ void nsWindow::NativeShow(bool aAction)
}
}
+ LOG((" calling gtk_widget_show(mShell)\n"));
gtk_widget_show(mShell);
if (!mIsX11Display) {
WaylandStartVsync();
}
} else if (mContainer) {
+ LOG((" calling gtk_widget_show(mContainer)\n"));
gtk_widget_show(GTK_WIDGET(mContainer));
} else if (mGdkWindow) {
+ LOG((" calling gdk_window_show_unraised\n"));
gdk_window_show_unraised(mGdkWindow);
}
} else {