mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 06:11:37 +00:00
Bug 1417709 - Implement -moz-appearance: -moz-mac-vibrant-titlebar-light/dark on macOS. r=jrmuizel
MozReview-Commit-ID: ElMpYslSXOg --HG-- extra : rebase_source : cae49ca995c8bf8a8b3dc64c07ede390510b033f
This commit is contained in:
parent
077922bc53
commit
cf505c6dbe
@ -2484,9 +2484,10 @@ FindTitlebarBottom(const nsTArray<nsIWidget::ThemeGeometry>& aThemeGeometries,
|
||||
int32_t aWindowWidth)
|
||||
{
|
||||
int32_t titlebarBottom = 0;
|
||||
for (uint32_t i = 0; i < aThemeGeometries.Length(); ++i) {
|
||||
const nsIWidget::ThemeGeometry& g = aThemeGeometries[i];
|
||||
if ((g.mType == nsNativeThemeCocoa::eThemeGeometryTypeTitlebar) &&
|
||||
for (auto& g : aThemeGeometries) {
|
||||
if ((g.mType == nsNativeThemeCocoa::eThemeGeometryTypeTitlebar ||
|
||||
g.mType == nsNativeThemeCocoa::eThemeGeometryTypeVibrantTitlebarLight ||
|
||||
g.mType == nsNativeThemeCocoa::eThemeGeometryTypeVibrantTitlebarDark) &&
|
||||
g.mRect.X() <= 0 &&
|
||||
g.mRect.XMost() >= aWindowWidth &&
|
||||
g.mRect.Y() <= 0) {
|
||||
@ -2565,8 +2566,10 @@ ThemeGeometryTypeToVibrancyType(nsITheme::ThemeGeometryType aThemeGeometryType)
|
||||
{
|
||||
switch (aThemeGeometryType) {
|
||||
case nsNativeThemeCocoa::eThemeGeometryTypeVibrancyLight:
|
||||
case nsNativeThemeCocoa::eThemeGeometryTypeVibrantTitlebarLight:
|
||||
return Some(VibrancyType::LIGHT);
|
||||
case nsNativeThemeCocoa::eThemeGeometryTypeVibrancyDark:
|
||||
case nsNativeThemeCocoa::eThemeGeometryTypeVibrantTitlebarDark:
|
||||
return Some(VibrancyType::DARK);
|
||||
case nsNativeThemeCocoa::eThemeGeometryTypeSheet:
|
||||
return Some(VibrancyType::SHEET);
|
||||
|
@ -38,6 +38,8 @@ public:
|
||||
eThemeGeometryTypeHighlightedMenuItem,
|
||||
eThemeGeometryTypeVibrancyLight,
|
||||
eThemeGeometryTypeVibrancyDark,
|
||||
eThemeGeometryTypeVibrantTitlebarLight,
|
||||
eThemeGeometryTypeVibrantTitlebarDark,
|
||||
eThemeGeometryTypeTooltip,
|
||||
eThemeGeometryTypeSheet,
|
||||
eThemeGeometryTypeSourceList,
|
||||
|
@ -2969,7 +2969,9 @@ nsNativeThemeCocoa::DrawWidgetBackground(gfxContext* aContext,
|
||||
break;
|
||||
|
||||
case NS_THEME_MAC_VIBRANCY_LIGHT:
|
||||
case NS_THEME_MAC_VIBRANCY_DARK: {
|
||||
case NS_THEME_MAC_VIBRANCY_DARK:
|
||||
case NS_THEME_MAC_VIBRANT_TITLEBAR_LIGHT:
|
||||
case NS_THEME_MAC_VIBRANT_TITLEBAR_DARK: {
|
||||
ThemeGeometryType type = ThemeGeometryTypeForWidget(aFrame, aWidgetType);
|
||||
DrawVibrancyBackground(cgContext, macRect, aFrame, type);
|
||||
break;
|
||||
@ -3143,7 +3145,9 @@ nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(mozilla::wr::DisplayListBui
|
||||
return false;
|
||||
|
||||
case NS_THEME_MAC_VIBRANCY_LIGHT:
|
||||
case NS_THEME_MAC_VIBRANCY_DARK: {
|
||||
case NS_THEME_MAC_VIBRANCY_DARK:
|
||||
case NS_THEME_MAC_VIBRANT_TITLEBAR_LIGHT:
|
||||
case NS_THEME_MAC_VIBRANT_TITLEBAR_DARK: {
|
||||
ThemeGeometryType type = ThemeGeometryTypeForWidget(aFrame, aWidgetType);
|
||||
aBuilder.PushRect(bounds, bounds, true,
|
||||
wr::ToColorF(VibrancyFillColor(aFrame, type)));
|
||||
@ -3736,6 +3740,8 @@ nsNativeThemeCocoa::WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType,
|
||||
case NS_THEME_METERCHUNK:
|
||||
case NS_THEME_MAC_VIBRANCY_LIGHT:
|
||||
case NS_THEME_MAC_VIBRANCY_DARK:
|
||||
case NS_THEME_MAC_VIBRANT_TITLEBAR_LIGHT:
|
||||
case NS_THEME_MAC_VIBRANT_TITLEBAR_DARK:
|
||||
*aShouldRepaint = false;
|
||||
return NS_OK;
|
||||
}
|
||||
@ -3898,6 +3904,8 @@ nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* a
|
||||
|
||||
case NS_THEME_MAC_VIBRANCY_LIGHT:
|
||||
case NS_THEME_MAC_VIBRANCY_DARK:
|
||||
case NS_THEME_MAC_VIBRANT_TITLEBAR_LIGHT:
|
||||
case NS_THEME_MAC_VIBRANT_TITLEBAR_DARK:
|
||||
return VibrancyManager::SystemSupportsVibrancy();
|
||||
}
|
||||
|
||||
@ -4005,6 +4013,8 @@ nsNativeThemeCocoa::NeedToClearBackgroundBehindWidget(nsIFrame* aFrame,
|
||||
case NS_THEME_MAC_ACTIVE_SOURCE_LIST_SELECTION:
|
||||
case NS_THEME_MAC_VIBRANCY_LIGHT:
|
||||
case NS_THEME_MAC_VIBRANCY_DARK:
|
||||
case NS_THEME_MAC_VIBRANT_TITLEBAR_LIGHT:
|
||||
case NS_THEME_MAC_VIBRANT_TITLEBAR_DARK:
|
||||
case NS_THEME_TOOLTIP:
|
||||
case NS_THEME_MENUPOPUP:
|
||||
case NS_THEME_MENUITEM:
|
||||
@ -4035,6 +4045,10 @@ nsNativeThemeCocoa::ThemeGeometryTypeForWidget(nsIFrame* aFrame, uint8_t aWidget
|
||||
return eThemeGeometryTypeVibrancyLight;
|
||||
case NS_THEME_MAC_VIBRANCY_DARK:
|
||||
return eThemeGeometryTypeVibrancyDark;
|
||||
case NS_THEME_MAC_VIBRANT_TITLEBAR_LIGHT:
|
||||
return eThemeGeometryTypeVibrantTitlebarLight;
|
||||
case NS_THEME_MAC_VIBRANT_TITLEBAR_DARK:
|
||||
return eThemeGeometryTypeVibrantTitlebarDark;
|
||||
case NS_THEME_TOOLTIP:
|
||||
return eThemeGeometryTypeTooltip;
|
||||
case NS_THEME_MENUPOPUP:
|
||||
|
Loading…
Reference in New Issue
Block a user