Bug 1602563 - [Linux] Allow nsWindow::Resize() reset aspect ratio, r=jhorak

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Martin Stransky 2019-12-10 11:34:38 +00:00
Родитель 34bbeae92a
Коммит 0ab7343b2f
2 изменённых файлов: 18 добавлений и 2 удалений

Просмотреть файл

@ -986,6 +986,12 @@ void nsWindow::SetSizeConstraints(const SizeConstraints& aConstraints) {
mSizeConstraints.mMinSize = GetSafeWindowSize(aConstraints.mMinSize);
mSizeConstraints.mMaxSize = GetSafeWindowSize(aConstraints.mMaxSize);
ApplySizeConstraints();
}
void nsWindow::ApplySizeConstraints(void) {
LOG(("nsWindow::ApplySizeConstraints [%p]\n", (void*)this));
if (mShell) {
GdkGeometry geometry;
geometry.min_width =
@ -1003,10 +1009,11 @@ void nsWindow::SetSizeConstraints(const SizeConstraints& aConstraints) {
geometry.max_height));
uint32_t hints = 0;
if (aConstraints.mMinSize != LayoutDeviceIntSize(0, 0)) {
if (mSizeConstraints.mMinSize != LayoutDeviceIntSize(0, 0)) {
hints |= GDK_HINT_MIN_SIZE;
}
if (aConstraints.mMaxSize != LayoutDeviceIntSize(NS_MAXSIZE, NS_MAXSIZE)) {
if (mSizeConstraints.mMaxSize !=
LayoutDeviceIntSize(NS_MAXSIZE, NS_MAXSIZE)) {
hints |= GDK_HINT_MAX_SIZE;
}
@ -1074,6 +1081,11 @@ void nsWindow::Resize(double aWidth, double aHeight, bool aRepaint) {
mBounds.SizeTo(width, height);
// Recalculate aspect ratio when resized from DOM
if (mAspectRatio != 0.0) {
LockAspectRatio(true);
}
if (!mCreated) return;
NativeResize();
@ -7615,6 +7627,8 @@ void nsWindow::LockAspectRatio(bool aShouldLock) {
LOG(("nsWindow::LockAspectRatio() [%p] removed aspect ratio\n",
(void*)this));
}
ApplySizeConstraints();
}
#ifdef MOZ_WAYLAND

Просмотреть файл

@ -645,6 +645,8 @@ class nsWindow final : public nsBaseWidget {
void SetPopupWindowDecoration(bool aShowOnTaskbar);
void ApplySizeConstraints(void);
bool IsMainMenuWindow();
GtkWidget* ConfigureWaylandPopupWindows();
void HideWaylandWindow();