mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-26 12:20:56 +00:00

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
52 lines
1.7 KiB
C++
52 lines
1.7 KiB
C++
/* -*- 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/. */
|
|
|
|
#include "ThemeCocoa.h"
|
|
|
|
#include "cocoa/MacThemeGeometryType.h"
|
|
#include "gfxPlatform.h"
|
|
#include "mozilla/ClearOnShutdown.h"
|
|
#include "mozilla/gfx/Helpers.h"
|
|
#include "mozilla/LookAndFeel.h"
|
|
#include "mozilla/ServoStyleConsts.h"
|
|
|
|
namespace mozilla::widget {
|
|
|
|
LayoutDeviceIntSize ThemeCocoa::GetMinimumWidgetSize(
|
|
nsPresContext* aPresContext, nsIFrame* aFrame,
|
|
StyleAppearance aAppearance) {
|
|
if (aAppearance == StyleAppearance::MozMenulistArrowButton) {
|
|
LayoutDeviceIntCoord size = ScrollbarDrawingCocoa::GetScrollbarSize(
|
|
StyleScrollbarWidth::Auto, /* aOverlay = */ false,
|
|
GetDPIRatio(aFrame, aAppearance));
|
|
return {size, size};
|
|
}
|
|
return Theme::GetMinimumWidgetSize(aPresContext, aFrame, aAppearance);
|
|
}
|
|
|
|
nsITheme::ThemeGeometryType ThemeCocoa::ThemeGeometryTypeForWidget(
|
|
nsIFrame* aFrame, StyleAppearance aAppearance) {
|
|
switch (aAppearance) {
|
|
case StyleAppearance::Tooltip:
|
|
return eThemeGeometryTypeTooltip;
|
|
default:
|
|
break;
|
|
}
|
|
return Theme::ThemeGeometryTypeForWidget(aFrame, aAppearance);
|
|
}
|
|
|
|
bool ThemeCocoa::ThemeSupportsWidget(nsPresContext* aPc, nsIFrame* aFrame,
|
|
StyleAppearance aAppearance) {
|
|
switch (aAppearance) {
|
|
case StyleAppearance::Tooltip:
|
|
return true;
|
|
default:
|
|
break;
|
|
}
|
|
return Theme::ThemeSupportsWidget(aPc, aFrame, aAppearance);
|
|
}
|
|
|
|
} // namespace mozilla::widget
|