зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1861954 - Remove vibrancy on the osx sidebar. r=desktop-theme-reviewers,dao
This accidentally broke in 119 and nobody noticed on the whole nightly + beta cycle (other than due to bug 1861669). Given sidebars are not super-commonly used these days, this makes the code a bit less fragile, and it still looks pretty good IMO. Also, since we want to get rid of <xul:tree>s, this is one less thing to worry about. Depends on D192102 Differential Revision: https://phabricator.services.mozilla.com/D192103
This commit is contained in:
Родитель
533c58ddf0
Коммит
40c5cc4d11
|
@ -10,9 +10,6 @@
|
|||
:root {
|
||||
appearance: none;
|
||||
|
||||
/* This allows vibrancy to work, see bug 1861669 */
|
||||
background-color: transparent;
|
||||
|
||||
--arrowpanel-field-background: light-dark(rgba(249, 249, 250, .3), rgba(12, 12, 13, .3));
|
||||
|
||||
--sidebar-border-color: hsla(240, 5%, 5%, .1);
|
||||
|
@ -222,16 +219,6 @@ moz-input-box > menupopup .context-menu-add-engine > .menu-iconic-left {
|
|||
#sidebar-box {
|
||||
/* Default font size is 11px on mac, so this is 12px */
|
||||
font-size: 1.0909rem;
|
||||
|
||||
/* Give the sidebar a vibrant appearance. Only do this when no lwtheme sidebar
|
||||
* rules are in use. Vibrant appearance values only work if there is no
|
||||
* background-color rendered behind the element. If the active theme has sidebar
|
||||
* rules, we want to show the theme's background-color in the sidebar. */
|
||||
:root:not([lwt-sidebar]) & {
|
||||
appearance: auto;
|
||||
-moz-default-appearance: -moz-mac-source-list;
|
||||
-moz-font-smoothing-background-color: -moz-mac-source-list;
|
||||
}
|
||||
}
|
||||
|
||||
/* ::::: tabbrowser ::::: */
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
/* Places Organizer Sidebars */
|
||||
|
||||
#placesList {
|
||||
appearance: auto;
|
||||
-moz-default-appearance: -moz-mac-source-list;
|
||||
width: 160px;
|
||||
min-width: 100px;
|
||||
max-width: 400px;
|
||||
|
@ -16,18 +14,6 @@
|
|||
margin-inline-end: 6px;
|
||||
}
|
||||
|
||||
#placesList > treechildren::-moz-tree-row(selected) {
|
||||
appearance: auto;
|
||||
-moz-default-appearance: -moz-mac-source-list-selection;
|
||||
-moz-font-smoothing-background-color: -moz-mac-source-list-selection;
|
||||
}
|
||||
|
||||
#placesList > treechildren::-moz-tree-row(selected,focus) {
|
||||
appearance: auto;
|
||||
-moz-default-appearance: -moz-mac-active-source-list-selection;
|
||||
-moz-font-smoothing-background-color: -moz-mac-active-source-list-selection;
|
||||
}
|
||||
|
||||
#placesList > treechildren::-moz-tree-cell(separator) {
|
||||
cursor: default;
|
||||
}
|
||||
|
|
|
@ -191,18 +191,6 @@
|
|||
margin: 0 10px;
|
||||
}
|
||||
|
||||
.sidebar-panel:not([lwt-sidebar]) .sidebar-placesTreechildren::-moz-tree-row(selected,blur) {
|
||||
appearance: auto;
|
||||
-moz-default-appearance: -moz-mac-source-list-selection;
|
||||
-moz-font-smoothing-background-color: -moz-mac-source-list-selection;
|
||||
}
|
||||
|
||||
.sidebar-panel:not([lwt-sidebar-highlight]) .sidebar-placesTreechildren::-moz-tree-row(selected,focus) {
|
||||
appearance: auto;
|
||||
-moz-default-appearance: -moz-mac-active-source-list-selection;
|
||||
-moz-font-smoothing-background-color: -moz-mac-active-source-list-selection;
|
||||
}
|
||||
|
||||
.sidebar-placesTreechildren::-moz-tree-cell-text {
|
||||
margin-inline-end: 6px;
|
||||
}
|
||||
|
|
|
@ -340,18 +340,6 @@ body {
|
|||
.item-title {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
:root:not([lwt-sidebar]) .item.selected:not(:focus) > .item-title-container {
|
||||
appearance: auto;
|
||||
-moz-default-appearance: -moz-mac-source-list-selection;
|
||||
-moz-font-smoothing-background-color: -moz-mac-source-list-selection;
|
||||
}
|
||||
|
||||
:root:not([lwt-sidebar-highlight]) .item.selected:focus > .item-title-container {
|
||||
appearance: auto;
|
||||
-moz-default-appearance: -moz-mac-active-source-list-selection;
|
||||
-moz-font-smoothing-background-color: -moz-mac-active-source-list-selection;
|
||||
}
|
||||
}
|
||||
|
||||
@media (-moz-platform: windows) {
|
||||
|
|
|
@ -2518,19 +2518,6 @@ class nsDisplayTreeBody final : public nsPaintedDisplayItem {
|
|||
|
||||
} // namespace mozilla
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
static bool IsInSourceList(nsIFrame* aFrame) {
|
||||
for (nsIFrame* frame = aFrame; frame;
|
||||
frame = nsLayoutUtils::GetCrossDocParentFrameInProcess(frame)) {
|
||||
if (frame->StyleDisplay()->EffectiveAppearance() ==
|
||||
StyleAppearance::MozMacSourceList) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
// Painting routines
|
||||
void nsTreeBodyFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
||||
const nsDisplayListSet& aLists) {
|
||||
|
@ -2546,53 +2533,6 @@ void nsTreeBodyFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
nsDisplayItem* item = MakeDisplayItem<nsDisplayTreeBody>(aBuilder, this);
|
||||
aLists.Content()->AppendToTop(item);
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
XULTreeElement* tree = GetBaseElement();
|
||||
nsIFrame* treeFrame = tree ? tree->GetPrimaryFrame() : nullptr;
|
||||
nsCOMPtr<nsITreeView> view = GetExistingView();
|
||||
nsCOMPtr<nsITreeSelection> selection = GetSelection();
|
||||
nsITheme* theme = PresContext()->Theme();
|
||||
// On Mac, we support native theming of selected rows. On 10.10 and higher,
|
||||
// this means applying vibrancy which require us to register the theme
|
||||
// geometrics for the row. In order to make the vibrancy effect to work
|
||||
// properly, we also need an ancestor frame to be themed as a source list.
|
||||
if (selection && theme && IsInSourceList(treeFrame)) {
|
||||
// Loop through our onscreen rows. If the row is selected and a
|
||||
// -moz-appearance is provided, RegisterThemeGeometry might be necessary.
|
||||
const auto end = std::min(mRowCount, LastVisibleRow() + 1);
|
||||
for (auto i = FirstVisibleRow(); i < end; i++) {
|
||||
bool isSelected;
|
||||
selection->IsSelected(i, &isSelected);
|
||||
if (isSelected) {
|
||||
PrefillPropertyArray(i, nullptr);
|
||||
nsAutoString properties;
|
||||
view->GetRowProperties(i, properties);
|
||||
nsTreeUtils::TokenizeProperties(properties, mScratchArray);
|
||||
ComputedStyle* rowContext =
|
||||
GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeRow());
|
||||
auto appearance = rowContext->StyleDisplay()->EffectiveAppearance();
|
||||
if (appearance != StyleAppearance::None) {
|
||||
if (theme->ThemeSupportsWidget(PresContext(), this, appearance)) {
|
||||
nsITheme::ThemeGeometryType type =
|
||||
theme->ThemeGeometryTypeForWidget(this, appearance);
|
||||
if (type != nsITheme::eThemeGeometryTypeUnknown) {
|
||||
nsRect rowRect(mInnerBox.x,
|
||||
mInnerBox.y + mRowHeight * (i - FirstVisibleRow()),
|
||||
mInnerBox.width, mRowHeight);
|
||||
aBuilder->RegisterThemeGeometry(
|
||||
type, item,
|
||||
LayoutDeviceIntRect::FromUnknownRect(
|
||||
(rowRect + aBuilder->ToReferenceFrame(this))
|
||||
.ToNearestPixels(
|
||||
PresContext()->AppUnitsPerDevPixel())));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
ImgDrawResult nsTreeBodyFrame::PaintTreeBody(gfxContext& aRenderingContext,
|
||||
|
|
|
@ -1634,16 +1634,10 @@ pub enum Appearance {
|
|||
#[parse(condition = "ParserContext::chrome_rules_enabled")]
|
||||
MozWindowDecorations,
|
||||
|
||||
#[parse(condition = "ParserContext::chrome_rules_enabled")]
|
||||
MozMacActiveSourceListSelection,
|
||||
#[parse(condition = "ParserContext::chrome_rules_enabled")]
|
||||
MozMacDisclosureButtonClosed,
|
||||
#[parse(condition = "ParserContext::chrome_rules_enabled")]
|
||||
MozMacDisclosureButtonOpen,
|
||||
#[parse(condition = "ParserContext::chrome_rules_enabled")]
|
||||
MozMacSourceList,
|
||||
#[parse(condition = "ParserContext::chrome_rules_enabled")]
|
||||
MozMacSourceListSelection,
|
||||
|
||||
/// A themed focus outline (for outline:auto).
|
||||
///
|
||||
|
|
|
@ -12,9 +12,6 @@ enum MacThemeGeometryType {
|
|||
eThemeGeometryTypeWindowButtons,
|
||||
eThemeGeometryTypeMenu,
|
||||
eThemeGeometryTypeTooltip,
|
||||
eThemeGeometryTypeSourceList,
|
||||
eThemeGeometryTypeSourceListSelection,
|
||||
eThemeGeometryTypeActiveSourceListSelection
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,9 +24,6 @@ namespace mozilla {
|
|||
enum class VibrancyType {
|
||||
TOOLTIP,
|
||||
MENU,
|
||||
SOURCE_LIST,
|
||||
SOURCE_LIST_SELECTION,
|
||||
ACTIVE_SOURCE_LIST_SELECTION
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -42,13 +42,6 @@ static NSVisualEffectMaterial VisualEffectMaterialForVibrancyType(
|
|||
return (NSVisualEffectMaterial)NSVisualEffectMaterialToolTip;
|
||||
case VibrancyType::MENU:
|
||||
return NSVisualEffectMaterialMenu;
|
||||
case VibrancyType::SOURCE_LIST:
|
||||
return NSVisualEffectMaterialSidebar;
|
||||
case VibrancyType::SOURCE_LIST_SELECTION:
|
||||
return NSVisualEffectMaterialSelection;
|
||||
case VibrancyType::ACTIVE_SOURCE_LIST_SELECTION:
|
||||
*aOutIsEmphasized = YES;
|
||||
return NSVisualEffectMaterialSelection;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1769,12 +1769,6 @@ static Maybe<VibrancyType> ThemeGeometryTypeToVibrancyType(
|
|||
return Some(VibrancyType::TOOLTIP);
|
||||
case eThemeGeometryTypeMenu:
|
||||
return Some(VibrancyType::MENU);
|
||||
case eThemeGeometryTypeSourceList:
|
||||
return Some(VibrancyType::SOURCE_LIST);
|
||||
case eThemeGeometryTypeSourceListSelection:
|
||||
return Some(VibrancyType::SOURCE_LIST_SELECTION);
|
||||
case eThemeGeometryTypeActiveSourceListSelection:
|
||||
return Some(VibrancyType::ACTIVE_SOURCE_LIST_SELECTION);
|
||||
default:
|
||||
return Nothing();
|
||||
}
|
||||
|
@ -1820,27 +1814,13 @@ void nsChildView::UpdateVibrancy(
|
|||
GatherVibrantRegion(aThemeGeometries, VibrancyType::MENU);
|
||||
LayoutDeviceIntRegion tooltipRegion =
|
||||
GatherVibrantRegion(aThemeGeometries, VibrancyType::TOOLTIP);
|
||||
LayoutDeviceIntRegion sourceListRegion =
|
||||
GatherVibrantRegion(aThemeGeometries, VibrancyType::SOURCE_LIST);
|
||||
LayoutDeviceIntRegion sourceListSelectionRegion = GatherVibrantRegion(
|
||||
aThemeGeometries, VibrancyType::SOURCE_LIST_SELECTION);
|
||||
LayoutDeviceIntRegion activeSourceListSelectionRegion = GatherVibrantRegion(
|
||||
aThemeGeometries, VibrancyType::ACTIVE_SOURCE_LIST_SELECTION);
|
||||
|
||||
MakeRegionsNonOverlapping(menuRegion, tooltipRegion, sourceListRegion,
|
||||
sourceListSelectionRegion,
|
||||
activeSourceListSelectionRegion);
|
||||
MakeRegionsNonOverlapping(menuRegion, tooltipRegion);
|
||||
|
||||
auto& vm = EnsureVibrancyManager();
|
||||
bool changed = false;
|
||||
changed |= vm.UpdateVibrantRegion(VibrancyType::MENU, menuRegion);
|
||||
changed |= vm.UpdateVibrantRegion(VibrancyType::TOOLTIP, tooltipRegion);
|
||||
changed |=
|
||||
vm.UpdateVibrantRegion(VibrancyType::SOURCE_LIST, sourceListRegion);
|
||||
changed |= vm.UpdateVibrantRegion(VibrancyType::SOURCE_LIST_SELECTION,
|
||||
sourceListSelectionRegion);
|
||||
changed |= vm.UpdateVibrantRegion(VibrancyType::ACTIVE_SOURCE_LIST_SELECTION,
|
||||
activeSourceListSelectionRegion);
|
||||
|
||||
if (changed) {
|
||||
SuspendAsyncCATransactions();
|
||||
|
|
|
@ -170,8 +170,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
|
|||
eScale, // ScaleParams
|
||||
eMultilineTextField, // bool
|
||||
eListBox,
|
||||
eActiveSourceListSelection, // bool
|
||||
eInactiveSourceListSelection, // bool
|
||||
eTabPanel,
|
||||
};
|
||||
|
||||
|
@ -237,12 +235,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
|
|||
return WidgetInfo(Widget::eMultilineTextField, aParams);
|
||||
}
|
||||
static WidgetInfo ListBox() { return WidgetInfo(Widget::eListBox, false); }
|
||||
static WidgetInfo ActiveSourceListSelection(bool aParams) {
|
||||
return WidgetInfo(Widget::eActiveSourceListSelection, aParams);
|
||||
}
|
||||
static WidgetInfo InactiveSourceListSelection(bool aParams) {
|
||||
return WidgetInfo(Widget::eInactiveSourceListSelection, aParams);
|
||||
}
|
||||
static WidgetInfo TabPanel(bool aParams) {
|
||||
return WidgetInfo(Widget::eTabPanel, aParams);
|
||||
}
|
||||
|
@ -391,9 +383,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
|
|||
bool aIsMain);
|
||||
void DrawMultilineTextField(CGContextRef cgContext, const CGRect& inBoxRect,
|
||||
bool aIsFocused);
|
||||
void DrawSourceListSelection(CGContextRef aContext, const CGRect& aRect,
|
||||
bool aWindowIsActive, bool aSelectionIsActive);
|
||||
|
||||
void RenderWidget(const WidgetInfo& aWidgetInfo, mozilla::ColorScheme,
|
||||
mozilla::gfx::DrawTarget& aDrawTarget,
|
||||
const mozilla::gfx::Rect& aWidgetRect,
|
||||
|
|
|
@ -404,17 +404,6 @@ static BOOL IsActive(nsIFrame* aFrame, BOOL aIsToolbarControl) {
|
|||
return FrameIsInActiveWindow(aFrame);
|
||||
}
|
||||
|
||||
static bool IsInSourceList(nsIFrame* aFrame) {
|
||||
for (nsIFrame* frame = aFrame->GetParent(); frame;
|
||||
frame = nsLayoutUtils::GetCrossDocParentFrameInProcess(frame)) {
|
||||
if (frame->StyleDisplay()->EffectiveAppearance() ==
|
||||
StyleAppearance::MozMacSourceList) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsNativeThemeCocoa, nsNativeTheme, nsITheme)
|
||||
|
||||
nsNativeThemeCocoa::nsNativeThemeCocoa() : ThemeCocoa(ScrollbarStyle()) {
|
||||
|
@ -2170,26 +2159,6 @@ void nsNativeThemeCocoa::DrawMultilineTextField(CGContextRef cgContext,
|
|||
NSGraphicsContext.currentContext = savedContext;
|
||||
}
|
||||
|
||||
void nsNativeThemeCocoa::DrawSourceListSelection(CGContextRef aContext,
|
||||
const CGRect& aRect,
|
||||
bool aWindowIsActive,
|
||||
bool aSelectionIsActive) {
|
||||
NSColor* fillColor;
|
||||
if (aSelectionIsActive) {
|
||||
// Active selection, blue or graphite.
|
||||
fillColor = [NSColor controlAccentColor];
|
||||
} else {
|
||||
// Inactive selection, gray.
|
||||
if (aWindowIsActive) {
|
||||
fillColor = [NSColor colorWithWhite:0.871 alpha:1.0];
|
||||
} else {
|
||||
fillColor = [NSColor colorWithWhite:0.808 alpha:1.0];
|
||||
}
|
||||
}
|
||||
CGContextSetFillColorWithColor(aContext, [fillColor CGColor]);
|
||||
CGContextFillRect(aContext, aRect);
|
||||
}
|
||||
|
||||
static bool IsHiDPIContext(nsDeviceContext* aContext) {
|
||||
return AppUnitsPerCSSPixel() >=
|
||||
2 * aContext->AppUnitsPerDevPixelAtUnitFullZoom();
|
||||
|
@ -2464,24 +2433,6 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
|
|||
case StyleAppearance::Listbox:
|
||||
return Some(WidgetInfo::ListBox());
|
||||
|
||||
case StyleAppearance::MozMacSourceList: {
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
case StyleAppearance::MozMacSourceListSelection:
|
||||
case StyleAppearance::MozMacActiveSourceListSelection: {
|
||||
// We only support vibrancy for source list selections if we're inside
|
||||
// a source list, because we need the background to be transparent.
|
||||
if (IsInSourceList(aFrame)) {
|
||||
return Nothing();
|
||||
}
|
||||
bool isInActiveWindow = FrameIsInActiveWindow(aFrame);
|
||||
if (aAppearance == StyleAppearance::MozMacActiveSourceListSelection) {
|
||||
return Some(WidgetInfo::ActiveSourceListSelection(isInActiveWindow));
|
||||
}
|
||||
return Some(WidgetInfo::InactiveSourceListSelection(isInActiveWindow));
|
||||
}
|
||||
|
||||
case StyleAppearance::Tab: {
|
||||
SegmentParams params =
|
||||
ComputeSegmentParams(aFrame, elementState, SegmentType::eTab);
|
||||
|
@ -2714,15 +2665,6 @@ void nsNativeThemeCocoa::RenderWidget(const WidgetInfo& aWidgetInfo,
|
|||
});
|
||||
break;
|
||||
}
|
||||
case Widget::eActiveSourceListSelection:
|
||||
case Widget::eInactiveSourceListSelection: {
|
||||
bool isInActiveWindow = aWidgetInfo.Params<bool>();
|
||||
bool isActiveSelection =
|
||||
aWidgetInfo.Widget() == Widget::eActiveSourceListSelection;
|
||||
DrawSourceListSelection(cgContext, macRect, isInActiveWindow,
|
||||
isActiveSelection);
|
||||
break;
|
||||
}
|
||||
case Widget::eTabPanel: {
|
||||
bool isInsideActiveWindow = aWidgetInfo.Params<bool>();
|
||||
DrawTabPanel(cgContext, macRect, isInsideActiveWindow);
|
||||
|
@ -3263,9 +3205,6 @@ bool nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext,
|
|||
case StyleAppearance::Treeheadersortarrow:
|
||||
case StyleAppearance::Treeitem:
|
||||
case StyleAppearance::Treeline:
|
||||
case StyleAppearance::MozMacSourceList:
|
||||
case StyleAppearance::MozMacSourceListSelection:
|
||||
case StyleAppearance::MozMacActiveSourceListSelection:
|
||||
|
||||
case StyleAppearance::Range:
|
||||
return !IsWidgetStyled(aPresContext, aFrame, aAppearance);
|
||||
|
@ -3359,15 +3298,6 @@ nsITheme::ThemeGeometryType nsNativeThemeCocoa::ThemeGeometryTypeForWidget(
|
|||
return eThemeGeometryTypeTooltip;
|
||||
case StyleAppearance::Menupopup:
|
||||
return eThemeGeometryTypeMenu;
|
||||
case StyleAppearance::MozMacSourceList:
|
||||
return eThemeGeometryTypeSourceList;
|
||||
case StyleAppearance::MozMacSourceListSelection:
|
||||
return IsInSourceList(aFrame) ? eThemeGeometryTypeSourceListSelection
|
||||
: eThemeGeometryTypeUnknown;
|
||||
case StyleAppearance::MozMacActiveSourceListSelection:
|
||||
return IsInSourceList(aFrame)
|
||||
? eThemeGeometryTypeActiveSourceListSelection
|
||||
: eThemeGeometryTypeUnknown;
|
||||
default:
|
||||
return eThemeGeometryTypeUnknown;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче