firefox/mozilla-1669495.patch
Troy Dawson 3e50e17831 RHEL 9.0.0 Alpha bootstrap
The content of this branch was automatically imported from Fedora ELN
with the following as its source:
https://src.fedoraproject.org/rpms/firefox#78a2fca4c6a65a6d27fe55bf52a27ed21e6aec3b
2020-10-20 06:49:17 -07:00

131 lines
5.3 KiB
Diff

diff -up firefox-82.0/layout/xul/nsMenuPopupFrame.cpp.1669495 firefox-82.0/layout/xul/nsMenuPopupFrame.cpp
--- firefox-82.0/layout/xul/nsMenuPopupFrame.cpp.1669495 2020-10-15 16:13:12.304471453 +0200
+++ firefox-82.0/layout/xul/nsMenuPopupFrame.cpp 2020-10-15 16:13:12.308471463 +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-82.0/widget/gtk/nsWindow.cpp.1669495 firefox-82.0/widget/gtk/nsWindow.cpp
--- firefox-82.0/widget/gtk/nsWindow.cpp.1669495 2020-10-15 16:13:12.307471461 +0200
+++ firefox-82.0/widget/gtk/nsWindow.cpp 2020-10-15 16:15:49.243882006 +0200
@@ -1092,11 +1092,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 we used to have insane bounds, we may have skipped actually positioning
// the widget in NativeMoveResizeWaylandPopup, in which case we need to
// actually position it now as well.
@@ -1141,8 +1143,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;
@@ -1154,8 +1155,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;
@@ -1478,14 +1479,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 =
@@ -1493,6 +1495,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),
@@ -1511,6 +1514,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.
@@ -4245,6 +4249,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;
@@ -5083,13 +5089,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 {