Bug 1592739 - Remove vibrancy code for sheet windows. r=spohl

With -moz-appearance: dialog now always being transparent, setting up our own
vibrant views for sheet windows is no longer necessary. We now let the regular
sheet window background show through, and that background is already vibrant.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Markus Stange 2019-11-05 18:48:15 +00:00
parent 41d42f6f41
commit 7bb6e93a25
5 changed files with 5 additions and 29 deletions

View File

@ -27,7 +27,6 @@ enum class VibrancyType {
TOOLTIP,
MENU,
HIGHLIGHTED_MENUITEM,
SHEET,
SOURCE_LIST,
SOURCE_LIST_SELECTION,
ACTIVE_SOURCE_LIST_SELECTION

View File

@ -66,7 +66,6 @@ static id AppearanceForVibrancyType(VibrancyType aType) {
case VibrancyType::TOOLTIP:
case VibrancyType::MENU:
case VibrancyType::HIGHLIGHTED_MENUITEM:
case VibrancyType::SHEET:
case VibrancyType::SOURCE_LIST:
case VibrancyType::SOURCE_LIST_SELECTION:
case VibrancyType::ACTIVE_SOURCE_LIST_SELECTION:
@ -97,10 +96,8 @@ static NSUInteger VisualEffectStateForVibrancyType(VibrancyType aType) {
case VibrancyType::TOOLTIP:
case VibrancyType::MENU:
case VibrancyType::HIGHLIGHTED_MENUITEM:
case VibrancyType::SHEET:
// Tooltip and menu windows are never "key" and sheets always looks
// active, so we need to tell the vibrancy effect to look active
// regardless of window state.
// Tooltip and menu windows are never "key", so we need to tell the vibrancy effect to look
// active regardless of window state.
return NSVisualEffectStateActive;
default:
return NSVisualEffectStateFollowsWindowActiveState;

View File

@ -2372,8 +2372,6 @@ static Maybe<VibrancyType> ThemeGeometryTypeToVibrancyType(
case nsNativeThemeCocoa::eThemeGeometryTypeVibrancyDark:
case nsNativeThemeCocoa::eThemeGeometryTypeVibrantTitlebarDark:
return Some(VibrancyType::DARK);
case nsNativeThemeCocoa::eThemeGeometryTypeSheet:
return Some(VibrancyType::SHEET);
case nsNativeThemeCocoa::eThemeGeometryTypeTooltip:
return Some(VibrancyType::TOOLTIP);
case nsNativeThemeCocoa::eThemeGeometryTypeMenu:
@ -2427,7 +2425,6 @@ void nsChildView::UpdateVibrancy(const nsTArray<ThemeGeometry>& aThemeGeometries
return;
}
LayoutDeviceIntRegion sheetRegion = GatherVibrantRegion(aThemeGeometries, VibrancyType::SHEET);
LayoutDeviceIntRegion vibrantLightRegion =
GatherVibrantRegion(aThemeGeometries, VibrancyType::LIGHT);
LayoutDeviceIntRegion vibrantDarkRegion =
@ -2444,9 +2441,9 @@ void nsChildView::UpdateVibrancy(const nsTArray<ThemeGeometry>& aThemeGeometries
LayoutDeviceIntRegion activeSourceListSelectionRegion =
GatherVibrantRegion(aThemeGeometries, VibrancyType::ACTIVE_SOURCE_LIST_SELECTION);
MakeRegionsNonOverlapping(sheetRegion, vibrantLightRegion, vibrantDarkRegion, menuRegion,
tooltipRegion, highlightedMenuItemRegion, sourceListRegion,
sourceListSelectionRegion, activeSourceListSelectionRegion);
MakeRegionsNonOverlapping(vibrantLightRegion, vibrantDarkRegion, menuRegion, tooltipRegion,
highlightedMenuItemRegion, sourceListRegion, sourceListSelectionRegion,
activeSourceListSelectionRegion);
auto& vm = EnsureVibrancyManager();
bool changed = false;
@ -2455,7 +2452,6 @@ void nsChildView::UpdateVibrancy(const nsTArray<ThemeGeometry>& aThemeGeometries
changed |= vm.UpdateVibrantRegion(VibrancyType::MENU, menuRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::TOOLTIP, tooltipRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::HIGHLIGHTED_MENUITEM, highlightedMenuItemRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::SHEET, sheetRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::SOURCE_LIST, sourceListRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::SOURCE_LIST_SELECTION, sourceListSelectionRegion);
changed |= vm.UpdateVibrantRegion(VibrancyType::ACTIVE_SOURCE_LIST_SELECTION,

View File

@ -43,7 +43,6 @@ class nsNativeThemeCocoa : private nsNativeTheme, public nsITheme {
eThemeGeometryTypeVibrantTitlebarLight,
eThemeGeometryTypeVibrantTitlebarDark,
eThemeGeometryTypeTooltip,
eThemeGeometryTypeSheet,
eThemeGeometryTypeSourceList,
eThemeGeometryTypeSourceListSelection,
eThemeGeometryTypeActiveSourceListSelection
@ -439,7 +438,6 @@ class nsNativeThemeCocoa : private nsNativeTheme, public nsITheme {
LayoutDeviceIntMargin DirectionAwareMargin(const LayoutDeviceIntMargin& aMargin,
nsIFrame* aFrame);
nsIFrame* SeparatorResponsibility(nsIFrame* aBefore, nsIFrame* aAfter);
bool IsWindowSheet(nsIFrame* aFrame);
ControlParams ComputeControlParams(nsIFrame* aFrame, mozilla::EventStates aEventState);
MenuBackgroundParams ComputeMenuBackgroundParams(nsIFrame* aFrame,
mozilla::EventStates aEventState);

View File

@ -4263,16 +4263,6 @@ bool nsNativeThemeCocoa::WidgetAppearanceDependsOnWindowFocus(StyleAppearance aA
}
}
bool nsNativeThemeCocoa::IsWindowSheet(nsIFrame* aFrame) {
NSWindow* win = NativeWindowForFrame(aFrame);
id winDelegate = [win delegate];
nsIWidget* widget = [(WindowDelegate*)winDelegate geckoWidget];
if (!widget) {
return false;
}
return (widget->WindowType() == eWindowType_sheet);
}
bool nsNativeThemeCocoa::NeedToClearBackgroundBehindWidget(nsIFrame* aFrame,
StyleAppearance aAppearance) {
switch (aAppearance) {
@ -4292,8 +4282,6 @@ bool nsNativeThemeCocoa::NeedToClearBackgroundBehindWidget(nsIFrame* aFrame,
case StyleAppearance::Menuitem:
case StyleAppearance::Checkmenuitem:
return true;
case StyleAppearance::Dialog:
return IsWindowSheet(aFrame);
default:
return false;
}
@ -4331,8 +4319,6 @@ nsITheme::ThemeGeometryType nsNativeThemeCocoa::ThemeGeometryTypeForWidget(
bool isSelected = !isDisabled && CheckBooleanAttr(aFrame, nsGkAtoms::menuactive);
return isSelected ? eThemeGeometryTypeHighlightedMenuItem : eThemeGeometryTypeMenu;
}
case StyleAppearance::Dialog:
return IsWindowSheet(aFrame) ? eThemeGeometryTypeSheet : eThemeGeometryTypeUnknown;
case StyleAppearance::MozMacSourceList:
return eThemeGeometryTypeSourceList;
case StyleAppearance::MozMacSourceListSelection: