2021-11-15 15:39:38 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 40; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2022-01-12 19:33:31 +03:00
|
|
|
#include "ThemeCocoa.h"
|
2021-11-15 15:39:38 +03:00
|
|
|
|
|
|
|
#include "cocoa/MacThemeGeometryType.h"
|
|
|
|
#include "gfxPlatform.h"
|
|
|
|
#include "mozilla/ClearOnShutdown.h"
|
|
|
|
#include "mozilla/gfx/Helpers.h"
|
|
|
|
#include "mozilla/LookAndFeel.h"
|
|
|
|
#include "mozilla/ServoStyleConsts.h"
|
|
|
|
|
2022-01-12 19:33:31 +03:00
|
|
|
namespace mozilla::widget {
|
2021-11-15 15:39:38 +03:00
|
|
|
|
Bug 1793689 - Make GetMinimumWidgetSize work properly on non-XUL flexbox. r=TYLin,layout-reviewers
The XUL behavior in nsBox.cpp is fairly different to what the non-XUL
layout code paths do. In particular, canOverride=false means that the
min-{width,height} properties cannot go under the min widget size of the
widget, but that doesn't mean that intrinsic sizes don't affect the
final size of the widget.
This is very visible if you turn on flex emulation on Windows or macOS,
where the toolbar has an appearance that returns
width=0,height=N,canOverride=false.
With flex emulation we'd collapse the item to be zero-width, which is
not good at all.
The good thing is that this is no longer exposed to the web
(non-native-theme always returns canOverride=true), and our front-end
code doesn't seem to rely on this, so we can just remove support for
canOverride=false.
Differential Revision: https://phabricator.services.mozilla.com/D158608
2022-10-05 22:09:29 +03:00
|
|
|
LayoutDeviceIntSize ThemeCocoa::GetMinimumWidgetSize(
|
|
|
|
nsPresContext* aPresContext, nsIFrame* aFrame,
|
|
|
|
StyleAppearance aAppearance) {
|
2021-11-15 15:39:38 +03:00
|
|
|
if (aAppearance == StyleAppearance::MozMenulistArrowButton) {
|
2023-01-29 00:35:51 +03:00
|
|
|
auto size =
|
|
|
|
GetScrollbarSize(aPresContext, StyleScrollbarWidth::Auto, Overlay::No);
|
Bug 1793689 - Make GetMinimumWidgetSize work properly on non-XUL flexbox. r=TYLin,layout-reviewers
The XUL behavior in nsBox.cpp is fairly different to what the non-XUL
layout code paths do. In particular, canOverride=false means that the
min-{width,height} properties cannot go under the min widget size of the
widget, but that doesn't mean that intrinsic sizes don't affect the
final size of the widget.
This is very visible if you turn on flex emulation on Windows or macOS,
where the toolbar has an appearance that returns
width=0,height=N,canOverride=false.
With flex emulation we'd collapse the item to be zero-width, which is
not good at all.
The good thing is that this is no longer exposed to the web
(non-native-theme always returns canOverride=true), and our front-end
code doesn't seem to rely on this, so we can just remove support for
canOverride=false.
Differential Revision: https://phabricator.services.mozilla.com/D158608
2022-10-05 22:09:29 +03:00
|
|
|
return {size, size};
|
2021-11-15 15:39:38 +03:00
|
|
|
}
|
Bug 1793689 - Make GetMinimumWidgetSize work properly on non-XUL flexbox. r=TYLin,layout-reviewers
The XUL behavior in nsBox.cpp is fairly different to what the non-XUL
layout code paths do. In particular, canOverride=false means that the
min-{width,height} properties cannot go under the min widget size of the
widget, but that doesn't mean that intrinsic sizes don't affect the
final size of the widget.
This is very visible if you turn on flex emulation on Windows or macOS,
where the toolbar has an appearance that returns
width=0,height=N,canOverride=false.
With flex emulation we'd collapse the item to be zero-width, which is
not good at all.
The good thing is that this is no longer exposed to the web
(non-native-theme always returns canOverride=true), and our front-end
code doesn't seem to rely on this, so we can just remove support for
canOverride=false.
Differential Revision: https://phabricator.services.mozilla.com/D158608
2022-10-05 22:09:29 +03:00
|
|
|
return Theme::GetMinimumWidgetSize(aPresContext, aFrame, aAppearance);
|
2021-11-15 15:39:38 +03:00
|
|
|
}
|
|
|
|
|
2022-01-12 19:33:31 +03:00
|
|
|
} // namespace mozilla::widget
|