forked from mirrors/gecko-dev
Bug 1801844 - Remove some min-widget-size for various menuitem bits. r=cmartin
This fixes bug 1799460 for good. You can test this on Win10 with browser.display.windows.non_native_menus=0 or HCM, but same applies to Win7/8. The front-end sets their own sizes anyways, and when the windows sizes are less than the ones the front-end sets, we see that bug. This is rather annoying because, even though it's fixable (we can fix the intrinsic sizing code in the web to deal with this properly), it's probably not worth fixing, as no web-exposed widget has a min-widget size other than scrollbars and internal form control parts. Removing this code altogether just works, since as I said before the front-end sizes the menu parts anyways, so enforcing a given size in C++ is not necessary. Differential Revision: https://phabricator.services.mozilla.com/D162709
This commit is contained in:
parent
e802672180
commit
ed168ca161
2 changed files with 3 additions and 48 deletions
|
|
@ -56,8 +56,7 @@ nsNativeThemeWin::nsNativeThemeWin()
|
|||
mProgressDeterminateTimeStamp(TimeStamp::Now()),
|
||||
mProgressIndeterminateTimeStamp(TimeStamp::Now()),
|
||||
mBorderCacheValid(),
|
||||
mMinimumWidgetSizeCacheValid(),
|
||||
mGutterSizeCacheValid(false) {
|
||||
mMinimumWidgetSizeCacheValid() {
|
||||
// If there is a relevant change in forms.css for windows platform,
|
||||
// static widget style variables (e.g. sButtonBorderSize) should be
|
||||
// reinitialized here.
|
||||
|
|
@ -226,17 +225,6 @@ static SIZE GetGutterSize(HANDLE theme, HDC hdc) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
SIZE nsNativeThemeWin::GetCachedGutterSize(HANDLE theme) {
|
||||
if (mGutterSizeCacheValid) {
|
||||
return mGutterSizeCache;
|
||||
}
|
||||
|
||||
mGutterSizeCache = GetGutterSize(theme, nullptr);
|
||||
mGutterSizeCacheValid = true;
|
||||
|
||||
return mGutterSizeCache;
|
||||
}
|
||||
|
||||
/* DrawThemeBGRTLAware - render a theme part based on rtl state.
|
||||
* Some widgets are not direction-neutral and need to be drawn reversed for
|
||||
* RTL. Windows provides a way to do this with SetLayout, but this reverses
|
||||
|
|
@ -2100,9 +2088,9 @@ LayoutDeviceIntSize nsNativeThemeWin::GetMinimumWidgetSize(
|
|||
return Theme::GetMinimumWidgetSize(aPresContext, aFrame, aAppearance);
|
||||
}
|
||||
|
||||
mozilla::Maybe<nsUXThemeClass> themeClass = GetThemeClass(aAppearance);
|
||||
HTHEME theme = NULL;
|
||||
if (!themeClass.isNothing()) {
|
||||
Maybe<nsUXThemeClass> themeClass = GetThemeClass(aAppearance);
|
||||
if (themeClass.isSome()) {
|
||||
theme = nsUXThemeData::GetTheme(themeClass.value());
|
||||
}
|
||||
if (!theme) {
|
||||
|
|
@ -2147,28 +2135,7 @@ LayoutDeviceIntSize nsNativeThemeWin::GetMinimumWidgetSize(
|
|||
ScaleForFrameDPI(&result, aFrame);
|
||||
return result;
|
||||
}
|
||||
case StyleAppearance::Menuitem:
|
||||
case StyleAppearance::Checkmenuitem:
|
||||
case StyleAppearance::Radiomenuitem:
|
||||
if (!IsTopLevelMenu(aFrame)) {
|
||||
SIZE gutterSize(GetCachedGutterSize(theme));
|
||||
LayoutDeviceIntSize result(gutterSize.cx, gutterSize.cy);
|
||||
ScaleForFrameDPI(&result, aFrame);
|
||||
return result;
|
||||
}
|
||||
break;
|
||||
|
||||
case StyleAppearance::Menuimage:
|
||||
case StyleAppearance::Menucheckbox:
|
||||
case StyleAppearance::Menuradio: {
|
||||
SIZE boxSize(GetCachedGutterSize(theme));
|
||||
LayoutDeviceIntSize result(boxSize.cx + 2, boxSize.cy);
|
||||
ScaleForFrameDPI(&result, aFrame);
|
||||
return result;
|
||||
}
|
||||
|
||||
case StyleAppearance::Menuitemtext:
|
||||
return {};
|
||||
|
||||
case StyleAppearance::ProgressBar:
|
||||
// Best-fit size for progress meters is too large for most
|
||||
|
|
@ -2361,7 +2328,6 @@ nsNativeThemeWin::ThemeChanged() {
|
|||
nsUXThemeData::Invalidate();
|
||||
memset(mBorderCacheValid, 0, sizeof(mBorderCacheValid));
|
||||
memset(mMinimumWidgetSizeCacheValid, 0, sizeof(mMinimumWidgetSizeCacheValid));
|
||||
mGutterSizeCacheValid = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
@ -2655,12 +2621,6 @@ LayoutDeviceIntSize nsNativeThemeWin::ClassicGetMinimumWidgetSize(
|
|||
case StyleAppearance::Checkbox:
|
||||
result.width = result.height = 13;
|
||||
break;
|
||||
case StyleAppearance::Menucheckbox:
|
||||
case StyleAppearance::Menuradio:
|
||||
case StyleAppearance::Menuarrow:
|
||||
result.width = ::GetSystemMetrics(SM_CXMENUCHECK);
|
||||
result.height = ::GetSystemMetrics(SM_CYMENUCHECK);
|
||||
break;
|
||||
case StyleAppearance::SpinnerUpbutton:
|
||||
case StyleAppearance::SpinnerDownbutton:
|
||||
result.width = ::GetSystemMetrics(SM_CXVSCROLL);
|
||||
|
|
|
|||
|
|
@ -141,8 +141,6 @@ class nsNativeThemeWin : public Theme {
|
|||
THEMESIZE aSizeReq,
|
||||
LayoutDeviceIntSize* aResult);
|
||||
|
||||
SIZE GetCachedGutterSize(HANDLE theme);
|
||||
|
||||
private:
|
||||
TimeStamp mProgressDeterminateTimeStamp;
|
||||
TimeStamp mProgressIndeterminateTimeStamp;
|
||||
|
|
@ -165,9 +163,6 @@ class nsNativeThemeWin : public Theme {
|
|||
[(eUXNumClasses * THEME_PART_DISTINCT_VALUE_COUNT + 7) / 8];
|
||||
LayoutDeviceIntSize
|
||||
mMinimumWidgetSizeCache[eUXNumClasses * THEME_PART_DISTINCT_VALUE_COUNT];
|
||||
|
||||
bool mGutterSizeCacheValid;
|
||||
SIZE mGutterSizeCache;
|
||||
};
|
||||
|
||||
} // namespace mozilla::widget
|
||||
|
|
|
|||
Loading…
Reference in a new issue