Bug 1889429 - Remove most native tree code. r=mac-reviewers,desktop-theme-reviewers,places-reviewers,win-reviewers,dao,handyman,mstange

Most of this code is already dead. The native appearance on macOS
doesn't work on dark mode, and on Windows and Linux we are already
overriding it.

Add a first-column tree property to be able to align the inner borders
on macOS properly.

Differential Revision: https://phabricator.services.mozilla.com/D206526
This commit is contained in:
Emilio Cobos Álvarez 2024-05-06 19:22:35 +00:00
parent ea9db1a2ff
commit fb06f366ae
22 changed files with 200 additions and 622 deletions

View File

@ -184,15 +184,21 @@
#placeContent {
appearance: none;
border: none;
}
#placeContent > treechildren::-moz-tree-cell,
#placeContent > treechildren::-moz-tree-column {
border-inline-end: 1px solid color-mix(in srgb, FieldText 30%, transparent);
}
> treechildren::-moz-tree-cell,
> treechildren::-moz-tree-column {
border-inline-start: 1px solid color-mix(in srgb, FieldText 30%, transparent);
}
#placeContent > treechildren::-moz-tree-cell(separator) {
border-color: transparent;
> treechildren::-moz-tree-column(first-column),
> treechildren::-moz-tree-cell(first-column) {
/* This matches the treecol separator in tree.css */
border-inline-start: none;
}
> treechildren::-moz-tree-cell(separator) {
border-color: transparent;
}
}
/**

View File

@ -47,13 +47,11 @@
#include "nsContainerFrame.h"
#include "nsView.h"
#include "nsViewManager.h"
#include "nsVariant.h"
#include "nsWidgetsCID.h"
#include "nsIFrameInlines.h"
#include "nsTreeContentView.h"
#include "nsTreeUtils.h"
#include "nsStyleConsts.h"
#include "nsITheme.h"
#include "imgIRequest.h"
#include "imgIContainer.h"
#include "mozilla/dom/NodeInfo.h"
@ -1711,115 +1709,133 @@ void nsTreeBodyFrame::PrefillPropertyArray(int32_t aRowIndex,
mScratchArray.Clear();
// focus
if (mFocused)
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::focus);
else
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::blur);
if (mFocused) {
mScratchArray.AppendElement(nsGkAtoms::focus);
} else {
mScratchArray.AppendElement(nsGkAtoms::blur);
}
// sort
bool sorted = false;
mView->IsSorted(&sorted);
if (sorted) mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::sorted);
if (sorted) {
mScratchArray.AppendElement(nsGkAtoms::sorted);
}
// drag session
if (mSlots && mSlots->mIsDragging)
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::dragSession);
if (mSlots && mSlots->mIsDragging) {
mScratchArray.AppendElement(nsGkAtoms::dragSession);
}
if (aRowIndex != -1) {
if (aRowIndex == mMouseOverRow)
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::hover);
if (aRowIndex == mMouseOverRow) {
mScratchArray.AppendElement(nsGkAtoms::hover);
}
nsCOMPtr<nsITreeSelection> selection = GetSelection();
if (selection) {
// selected
bool isSelected;
selection->IsSelected(aRowIndex, &isSelected);
if (isSelected)
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::selected);
if (isSelected) {
mScratchArray.AppendElement(nsGkAtoms::selected);
}
// current
int32_t currentIndex;
selection->GetCurrentIndex(&currentIndex);
if (aRowIndex == currentIndex)
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::current);
if (aRowIndex == currentIndex) {
mScratchArray.AppendElement(nsGkAtoms::current);
}
}
// container or leaf
bool isContainer = false;
mView->IsContainer(aRowIndex, &isContainer);
if (isContainer) {
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::container);
mScratchArray.AppendElement(nsGkAtoms::container);
// open or closed
bool isOpen = false;
mView->IsContainerOpen(aRowIndex, &isOpen);
if (isOpen)
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::open);
else
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::closed);
if (isOpen) {
mScratchArray.AppendElement(nsGkAtoms::open);
} else {
mScratchArray.AppendElement(nsGkAtoms::closed);
}
} else {
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::leaf);
mScratchArray.AppendElement(nsGkAtoms::leaf);
}
// drop orientation
if (mSlots && mSlots->mDropAllowed && mSlots->mDropRow == aRowIndex) {
if (mSlots->mDropOrient == nsITreeView::DROP_BEFORE)
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::dropBefore);
else if (mSlots->mDropOrient == nsITreeView::DROP_ON)
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::dropOn);
else if (mSlots->mDropOrient == nsITreeView::DROP_AFTER)
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::dropAfter);
if (mSlots->mDropOrient == nsITreeView::DROP_BEFORE) {
mScratchArray.AppendElement(nsGkAtoms::dropBefore);
} else if (mSlots->mDropOrient == nsITreeView::DROP_ON) {
mScratchArray.AppendElement(nsGkAtoms::dropOn);
} else if (mSlots->mDropOrient == nsITreeView::DROP_AFTER) {
mScratchArray.AppendElement(nsGkAtoms::dropAfter);
}
}
// odd or even
if (aRowIndex % 2)
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::odd);
else
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::even);
if (aRowIndex % 2) {
mScratchArray.AppendElement(nsGkAtoms::odd);
} else {
mScratchArray.AppendElement(nsGkAtoms::even);
}
XULTreeElement* tree = GetBaseElement();
if (tree && tree->HasAttr(nsGkAtoms::editing)) {
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::editing);
mScratchArray.AppendElement(nsGkAtoms::editing);
}
// multiple columns
if (mColumns->GetColumnAt(1))
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::multicol);
if (mColumns->GetColumnAt(1)) {
mScratchArray.AppendElement(nsGkAtoms::multicol);
}
}
if (aCol) {
mScratchArray.AppendElement(aCol->GetAtom());
if (aCol->IsPrimary())
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::primary);
if (aCol->IsPrimary()) {
mScratchArray.AppendElement(nsGkAtoms::primary);
}
if (aCol->GetType() == TreeColumn_Binding::TYPE_CHECKBOX) {
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::checkbox);
mScratchArray.AppendElement(nsGkAtoms::checkbox);
if (aRowIndex != -1) {
nsAutoString value;
mView->GetCellValue(aRowIndex, aCol, value);
if (value.EqualsLiteral("true"))
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::checked);
if (value.EqualsLiteral("true")) {
mScratchArray.AppendElement(nsGkAtoms::checked);
}
}
}
if (aCol->mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::ordinal,
u"1"_ns, eIgnoreCase)) {
mScratchArray.AppendElement(nsGkAtoms::firstColumn);
}
// Read special properties from attributes on the column content node
if (aCol->mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::insertbefore,
nsGkAtoms::_true, eCaseMatters))
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::insertbefore);
nsGkAtoms::_true, eCaseMatters)) {
mScratchArray.AppendElement(nsGkAtoms::insertbefore);
}
if (aCol->mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::insertafter,
nsGkAtoms::_true, eCaseMatters))
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::insertafter);
nsGkAtoms::_true, eCaseMatters)) {
mScratchArray.AppendElement(nsGkAtoms::insertafter);
}
}
}
nsITheme* nsTreeBodyFrame::GetTwistyRect(int32_t aRowIndex,
nsTreeColumn* aColumn,
nsRect& aImageRect,
nsRect& aTwistyRect,
nsPresContext* aPresContext,
ComputedStyle* aTwistyContext) {
void nsTreeBodyFrame::GetTwistyRect(int32_t aRowIndex, nsTreeColumn* aColumn,
nsRect& aImageRect, nsRect& aTwistyRect,
nsPresContext* aPresContext,
ComputedStyle* aTwistyContext) {
// The twisty rect extends all the way to the end of the cell. This is
// incorrect. We need to determine the twisty rect's true width. This is
// done by examining the ComputedStyle for a width first. If it has one, we
@ -1828,40 +1844,14 @@ nsITheme* nsTreeBodyFrame::GetTwistyRect(int32_t aRowIndex,
// a -moz-appearance involved, adjust the rect by the minimum widget size
// provided by the theme implementation.
aImageRect = GetImageSize(aRowIndex, aColumn, true, aTwistyContext);
if (aImageRect.height > aTwistyRect.height)
if (aImageRect.height > aTwistyRect.height) {
aImageRect.height = aTwistyRect.height;
if (aImageRect.width > aTwistyRect.width)
}
if (aImageRect.width > aTwistyRect.width) {
aImageRect.width = aTwistyRect.width;
else
} else {
aTwistyRect.width = aImageRect.width;
bool useTheme = false;
nsITheme* theme = nullptr;
StyleAppearance appearance =
aTwistyContext->StyleDisplay()->EffectiveAppearance();
if (appearance != StyleAppearance::None) {
theme = aPresContext->Theme();
if (theme->ThemeSupportsWidget(aPresContext, nullptr, appearance))
useTheme = true;
}
if (useTheme) {
LayoutDeviceIntSize minTwistySizePx =
theme->GetMinimumWidgetSize(aPresContext, this, appearance);
// GMWS() returns size in pixels, we need to convert it back to app units
nsSize minTwistySize;
minTwistySize.width =
aPresContext->DevPixelsToAppUnits(minTwistySizePx.width);
minTwistySize.height =
aPresContext->DevPixelsToAppUnits(minTwistySizePx.height);
if (aTwistyRect.width < minTwistySize.width) {
aTwistyRect.width = minTwistySize.width;
}
}
return useTheme ? theme : nullptr;
}
nsresult nsTreeBodyFrame::GetImage(int32_t aRowIndex, nsTreeColumn* aCol,
@ -2693,21 +2683,8 @@ ImgDrawResult nsTreeBodyFrame::PaintRow(int32_t aRowIndex,
ImgDrawResult result = ImgDrawResult::SUCCESS;
// Paint our borders and background for our row rect.
nsITheme* theme = nullptr;
auto appearance = rowContext->StyleDisplay()->EffectiveAppearance();
if (appearance != StyleAppearance::None) {
theme = aPresContext->Theme();
}
if (theme && theme->ThemeSupportsWidget(aPresContext, nullptr, appearance)) {
nsRect dirty;
dirty.IntersectRect(rowRect, aDirtyRect);
theme->DrawWidgetBackground(&aRenderingContext, this, appearance, rowRect,
dirty);
} else {
result &= PaintBackgroundLayer(rowContext, aPresContext, aRenderingContext,
rowRect, aDirtyRect);
}
result &= PaintBackgroundLayer(rowContext, aPresContext, aRenderingContext,
rowRect, aDirtyRect);
// Adjust the rect for its border and padding.
nsRect originalRowRect = rowRect;
@ -2820,54 +2797,32 @@ ImgDrawResult nsTreeBodyFrame::PaintSeparator(int32_t aRowIndex,
// Resolve style for the separator.
ComputedStyle* separatorContext =
GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeSeparator());
bool useTheme = false;
nsITheme* theme = nullptr;
StyleAppearance appearance =
separatorContext->StyleDisplay()->EffectiveAppearance();
if (appearance != StyleAppearance::None) {
theme = aPresContext->Theme();
if (theme->ThemeSupportsWidget(aPresContext, nullptr, appearance))
useTheme = true;
}
ImgDrawResult result = ImgDrawResult::SUCCESS;
const nsStylePosition* stylePosition = separatorContext->StylePosition();
// use -moz-appearance if provided.
if (useTheme) {
nsRect dirty;
dirty.IntersectRect(aSeparatorRect, aDirtyRect);
theme->DrawWidgetBackground(&aRenderingContext, this, appearance,
aSeparatorRect, dirty);
// Obtain the height for the separator or use the default value.
nscoord height;
if (stylePosition->mHeight.ConvertsToLength()) {
height = stylePosition->mHeight.ToLength();
} else {
const nsStylePosition* stylePosition = separatorContext->StylePosition();
// Obtain the height for the separator or use the default value.
nscoord height;
if (stylePosition->mHeight.ConvertsToLength()) {
height = stylePosition->mHeight.ToLength();
} else {
// Use default height 2px.
height = nsPresContext::CSSPixelsToAppUnits(2);
}
// Obtain the margins for the separator and then deflate our rect by that
// amount. The separator is assumed to be contained within the deflated
// rect.
nsRect separatorRect(aSeparatorRect.x, aSeparatorRect.y,
aSeparatorRect.width, height);
nsMargin separatorMargin;
separatorContext->StyleMargin()->GetMargin(separatorMargin);
separatorRect.Deflate(separatorMargin);
// Center the separator.
separatorRect.y += (aSeparatorRect.height - height) / 2;
result &=
PaintBackgroundLayer(separatorContext, aPresContext, aRenderingContext,
separatorRect, aDirtyRect);
// Use default height 2px.
height = nsPresContext::CSSPixelsToAppUnits(2);
}
return result;
// Obtain the margins for the separator and then deflate our rect by that
// amount. The separator is assumed to be contained within the deflated
// rect.
nsRect separatorRect(aSeparatorRect.x, aSeparatorRect.y, aSeparatorRect.width,
height);
nsMargin separatorMargin;
separatorContext->StyleMargin()->GetMargin(separatorMargin);
separatorRect.Deflate(separatorMargin);
// Center the separator.
separatorRect.y += (aSeparatorRect.height - height) / 2;
return PaintBackgroundLayer(separatorContext, aPresContext, aRenderingContext,
separatorRect, aDirtyRect);
}
ImgDrawResult nsTreeBodyFrame::PaintCell(
@ -3084,68 +3039,57 @@ ImgDrawResult nsTreeBodyFrame::PaintTwisty(
twistyRect.Deflate(twistyMargin);
nsRect imageSize;
nsITheme* theme = GetTwistyRect(aRowIndex, aColumn, imageSize, twistyRect,
aPresContext, twistyContext);
GetTwistyRect(aRowIndex, aColumn, imageSize, twistyRect, aPresContext,
twistyContext);
// Subtract out the remaining width. This is done even when we don't actually
// paint a twisty in this cell, so that cells in different rows still line up.
nsRect copyRect(twistyRect);
copyRect.Inflate(twistyMargin);
aRemainingWidth -= copyRect.width;
if (!isRTL) aCurrX += copyRect.width;
ImgDrawResult result = ImgDrawResult::SUCCESS;
if (shouldPaint) {
// Paint our borders and background for our image rect.
result &= PaintBackgroundLayer(twistyContext, aPresContext,
aRenderingContext, twistyRect, aDirtyRect);
if (theme) {
if (isRTL) twistyRect.x = rightEdge - twistyRect.width;
// yeah, I know it says we're drawing a background, but a twisty is really
// a fg object since it doesn't have anything that gecko would want to
// draw over it. Besides, we have to prevent imagelib from drawing it.
nsRect dirty;
dirty.IntersectRect(twistyRect, aDirtyRect);
theme->DrawWidgetBackground(
&aRenderingContext, this,
twistyContext->StyleDisplay()->EffectiveAppearance(), twistyRect,
dirty);
} else {
// Time to paint the twisty.
// Adjust the rect for its border and padding.
nsMargin bp(0, 0, 0, 0);
GetBorderPadding(twistyContext, bp);
twistyRect.Deflate(bp);
if (isRTL) twistyRect.x = rightEdge - twistyRect.width;
imageSize.Deflate(bp);
// Get the image for drawing.
nsCOMPtr<imgIContainer> image;
GetImage(aRowIndex, aColumn, true, twistyContext, getter_AddRefs(image));
if (image) {
nsPoint anchorPoint = twistyRect.TopLeft();
// Center the image. XXX Obey vertical-align style prop?
if (imageSize.height < twistyRect.height) {
anchorPoint.y += (twistyRect.height - imageSize.height) / 2;
}
// Apply context paint if applicable
SVGImageContext svgContext;
SVGImageContext::MaybeStoreContextPaint(svgContext, *aPresContext,
*twistyContext, image);
// Paint the image.
result &= nsLayoutUtils::DrawSingleUnscaledImage(
aRenderingContext, aPresContext, image, SamplingFilter::POINT,
anchorPoint, &aDirtyRect, svgContext, imgIContainer::FLAG_NONE,
&imageSize);
}
}
if (!isRTL) {
aCurrX += copyRect.width;
}
auto result = ImgDrawResult::SUCCESS;
if (!shouldPaint) {
return result;
}
// Paint our borders and background for our image rect.
result &= PaintBackgroundLayer(twistyContext, aPresContext, aRenderingContext,
twistyRect, aDirtyRect);
// Time to paint the twisty.
// Adjust the rect for its border and padding.
nsMargin bp;
GetBorderPadding(twistyContext, bp);
twistyRect.Deflate(bp);
if (isRTL) twistyRect.x = rightEdge - twistyRect.width;
imageSize.Deflate(bp);
// Get the image for drawing.
nsCOMPtr<imgIContainer> image;
GetImage(aRowIndex, aColumn, true, twistyContext, getter_AddRefs(image));
if (!image) {
return result;
}
nsPoint anchorPoint = twistyRect.TopLeft();
// Center the image. XXX Obey vertical-align style prop?
if (imageSize.height < twistyRect.height) {
anchorPoint.y += (twistyRect.height - imageSize.height) / 2;
}
// Apply context paint if applicable
SVGImageContext svgContext;
SVGImageContext::MaybeStoreContextPaint(svgContext, *aPresContext,
*twistyContext, image);
// Paint the image.
result &= nsLayoutUtils::DrawSingleUnscaledImage(
aRenderingContext, aPresContext, image, SamplingFilter::POINT,
anchorPoint, &aDirtyRect, svgContext, imgIContainer::FLAG_NONE,
&imageSize);
return result;
}

View File

@ -295,10 +295,10 @@ class nsTreeBodyFrame final : public mozilla::SimpleXULLeafFrame,
nsCSSAnonBoxPseudoStaticAtom** aChildElt);
// Retrieve the area for the twisty for a cell.
nsITheme* GetTwistyRect(int32_t aRowIndex, nsTreeColumn* aColumn,
nsRect& aImageRect, nsRect& aTwistyRect,
nsPresContext* aPresContext,
ComputedStyle* aTwistyContext);
void GetTwistyRect(int32_t aRowIndex, nsTreeColumn* aColumn,
nsRect& aImageRect, nsRect& aTwistyRect,
nsPresContext* aPresContext,
ComputedStyle* aTwistyContext);
// Fetch an image from the image cache.
nsresult GetImage(int32_t aRowIndex, nsTreeColumn* aCol, bool aUseContext,

View File

@ -1579,27 +1579,6 @@ pub enum Appearance {
/// A tooltip.
#[parse(condition = "ParserContext::chrome_rules_enabled")]
Tooltip,
/// A listbox or tree widget header
#[parse(condition = "ParserContext::chrome_rules_enabled")]
Treeheader,
/// An individual header cell
#[parse(condition = "ParserContext::chrome_rules_enabled")]
Treeheadercell,
/// A tree item.
#[parse(condition = "ParserContext::chrome_rules_enabled")]
Treeitem,
/// A tree widget branch line
#[parse(condition = "ParserContext::chrome_rules_enabled")]
Treeline,
/// A tree widget twisty.
#[parse(condition = "ParserContext::chrome_rules_enabled")]
Treetwisty,
/// Open tree widget twisty.
#[parse(condition = "ParserContext::chrome_rules_enabled")]
Treetwistyopen,
/// A tree widget.
#[parse(condition = "ParserContext::chrome_rules_enabled")]
Treeview,
/// Mac help button.
#[parse(condition = "ParserContext::chrome_rules_enabled")]

View File

@ -22,4 +22,4 @@
@import url("chrome://global/skin/tabbox.css");
@import url("chrome://global/skin/toolbar.css");
@import url("chrome://global/skin/toolbarbutton.css");
@import url("chrome://global/skin/tree.css");
@import url("chrome://global/skin/tree/tree.css");

View File

@ -600,20 +600,6 @@ menulist[popuponly] {
padding: 0 !important;
}
/********** splitter **********/
.tree-splitter {
margin-inline: -4px;
width: 8px;
max-width: 8px;
min-width: 8px;
appearance: none !important;
border: none !important;
background: none !important;
order: 2147483646;
z-index: 2147483646;
}
/******** scrollbar ********/
slider {

View File

@ -46,7 +46,7 @@
skin/classic/global/popupnotification.css (../../shared/popupnotification.css)
skin/classic/global/splitter.css (../../shared/splitter.css)
skin/classic/global/toolbarbutton.css (../../shared/toolbarbutton.css)
skin/classic/global/tree.css (../../shared/tree.css)
skin/classic/global/tree/tree.css (../../shared/tree/tree.css)
skin/classic/global/dirListing/dirListing.css (../../shared/dirListing/dirListing.css)
#ifdef XP_MACOSX
skin/classic/global/dirListing/folder.png (../../shared/dirListing/folder-osx.png)
@ -160,3 +160,5 @@
skin/classic/global/reader/character-spacing-20.svg (../../shared/reader/character-spacing-20.svg)
skin/classic/global/reader/line-spacing-20.svg (../../shared/reader/line-spacing-20.svg)
skin/classic/global/reader/content-width-20.svg (../../shared/reader/content-width-20.svg)
skin/classic/global/tree/sort-asc.svg (../../shared/tree/sort-asc.svg)
skin/classic/global/tree/sort-dsc.svg (../../shared/tree/sort-dsc.svg)

View File

@ -20,7 +20,4 @@
skin/classic/mozapps/downloads/unknownContentType.css (../../windows/mozapps/downloads/unknownContentType.css)
skin/classic/mozapps/handling/handling.css (../../windows/mozapps/handling/handling.css)
skin/classic/global/tree/sort-asc.svg (../../windows/global/tree/sort-asc.svg)
skin/classic/global/tree/sort-dsc.svg (../../windows/global/tree/sort-dsc.svg)
% override chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png chrome://mozapps/skin/extensions/extensionGeneric.svg

View File

Before

Width:  |  Height:  |  Size: 447 B

After

Width:  |  Height:  |  Size: 447 B

View File

Before

Width:  |  Height:  |  Size: 448 B

After

Width:  |  Height:  |  Size: 448 B

View File

@ -23,6 +23,21 @@ tree {
}
}
/********** splitter **********/
.tree-splitter {
margin-inline: -4px;
width: 8px;
max-width: 8px;
min-width: 8px;
appearance: none !important;
border: none !important;
background: none !important;
order: 2147483646;
z-index: 2147483646;
}
/* ::::: tree rows ::::: */
treechildren::-moz-tree-row {
@ -123,20 +138,15 @@ treechildren::-moz-tree-drop-feedback {
treecol,
.tree-columnpicker-button {
appearance: auto;
-moz-default-appearance: treeheadercell;
background-color: -moz-ColHeader;
color: -moz-ColHeaderText;
align-items: center;
justify-content: center;
padding: 0 4px;
margin: 0;
border-inline-start: 1px solid ThreeDLightShadow;
@media (-moz-platform: linux) or ((-moz-platform: windows) and (prefers-color-scheme: dark)) {
appearance: none;
box-shadow: inset 0 -1px ThreeDLightShadow;
}
border-inline-start: 1px solid ThreeDLightShadow;
box-shadow: inset 0 -1px ThreeDLightShadow;
&:where(:hover) {
background-color: -moz-ColHeaderHover;
@ -250,22 +260,20 @@ html|input.tree-input {
z-index: 2147483647;
}
@media not (-moz-platform: macos) {
/* ::::: sort direction indicator ::::: */
.treecol-sortdirection {
list-style-image: url("chrome://global/skin/tree/sort-asc.svg");
-moz-context-properties: fill;
fill: currentColor;
visibility: hidden;
/* ::::: sort direction indicator ::::: */
.treecol-sortdirection {
list-style-image: url("chrome://global/skin/tree/sort-asc.svg");
-moz-context-properties: fill;
fill: currentColor;
visibility: hidden;
treecol[sortDirection="ascending"]:not([hideheader="true"]) > & {
visibility: inherit;
}
treecol[sortDirection="ascending"]:not([hideheader="true"]) > & {
visibility: inherit;
}
treecol[sortDirection="descending"]:not([hideheader="true"]) > & {
visibility: inherit;
list-style-image: url("chrome://global/skin/tree/sort-dsc.svg");
}
treecol[sortDirection="descending"]:not([hideheader="true"]) > & {
visibility: inherit;
list-style-image: url("chrome://global/skin/tree/sort-dsc.svg");
}
}

View File

@ -238,9 +238,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
case ColorID::MozButtonhoverface:
case ColorID::MozButtonactiveface:
case ColorID::MozButtondisabledface:
case ColorID::MozColheader:
case ColorID::MozColheaderhover:
case ColorID::MozColheaderactive:
color = GetColorFromNSColor(NSColor.controlColor);
if (!NS_GET_A(color)) {
color = GetColorFromNSColor(NSColor.controlBackgroundColor);
@ -300,9 +297,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
case ColorID::Menutext:
case ColorID::Infotext:
case ColorID::MozCellhighlighttext:
case ColorID::MozColheadertext:
case ColorID::MozColheaderhovertext:
case ColorID::MozColheaderactivetext:
case ColorID::MozSidebartext:
color = GetColorFromNSColor(NSColor.controlTextColor);
break;
@ -318,6 +312,17 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
// For inactive list selection
color = GetColorFromNSColor(NSColor.secondarySelectedControlColor);
break;
case ColorID::MozColheadertext:
case ColorID::MozColheaderhovertext:
case ColorID::MozColheaderactivetext:
color = GetColorFromNSColor(NSColor.headerTextColor);
break;
case ColorID::MozColheaderactive:
color = GetColorFromNSColor(
NSColor.unemphasizedSelectedContentBackgroundColor);
break;
case ColorID::MozColheader:
case ColorID::MozColheaderhover:
case ColorID::MozEventreerow:
// Background color of even list rows.
color =

View File

@ -40,8 +40,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
eSquareBezelPushButton,
eArrowButton,
eHelpButton,
eTreeTwistyPointingRight,
eTreeTwistyPointingDown,
eDisclosureButtonClosed,
eDisclosureButtonOpen
};
@ -131,12 +129,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
bool rtl = false;
};
struct TreeHeaderCellParams {
ControlParams controlParams;
TreeSortDirection sortDirection = eTreeSortDirection_Natural;
bool lastTreeHeaderCell = false;
};
struct ScaleParams {
int32_t value = 0;
int32_t min = 0;
@ -165,7 +157,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
eSearchField, // TextFieldParams
eProgressBar, // ProgressParams
eMeter, // MeterParams
eTreeHeaderCell, // TreeHeaderCellParams
eScale, // ScaleParams
eMultilineTextField, // bool
eListBox,
@ -221,9 +212,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
static WidgetInfo Meter(const MeterParams& aParams) {
return WidgetInfo(Widget::eMeter, aParams);
}
static WidgetInfo TreeHeaderCell(const TreeHeaderCellParams& aParams) {
return WidgetInfo(Widget::eTreeHeaderCell, aParams);
}
static WidgetInfo Scale(const ScaleParams& aParams) {
return WidgetInfo(Widget::eScale, aParams);
}
@ -251,7 +239,7 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
mozilla::Variant<mozilla::gfx::sRGBColor, CheckboxOrRadioParams,
ButtonParams, DropdownParams, SpinButtonParams,
SegmentParams, TextFieldParams, ProgressParams,
MeterParams, TreeHeaderCellParams, ScaleParams, bool>
MeterParams, ScaleParams, bool>
mVariant;
enum Widget mWidget;
@ -315,8 +303,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
ProgressParams ComputeProgressParams(nsIFrame*, mozilla::dom::ElementState,
bool aIsHorizontal);
MeterParams ComputeMeterParams(nsIFrame*);
TreeHeaderCellParams ComputeTreeHeaderCellParams(nsIFrame*,
mozilla::dom::ElementState);
mozilla::Maybe<ScaleParams> ComputeHTMLScaleParams(
nsIFrame*, mozilla::dom::ElementState);
@ -354,8 +340,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
const ControlParams& aParams);
void DrawButton(CGContextRef context, const HIRect& inBoxRect,
const ButtonParams& aParams);
void DrawTreeHeaderCell(CGContextRef context, const HIRect& inBoxRect,
const TreeHeaderCellParams& aParams);
void DrawDropdown(CGContextRef context, const HIRect& inBoxRect,
const DropdownParams& aParams);
HIThemeButtonDrawInfo SpinButtonDrawInfo(ThemeButtonKind aKind,
@ -387,7 +371,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
NSComboBoxCell* mComboBoxCell;
NSProgressBarCell* mProgressBarCell;
NSLevelIndicatorCell* mMeterBarCell;
NSTableHeaderCell* mTreeHeaderCell;
MOZCellDrawWindow* mCellDrawWindow = nil;
MOZCellDrawView* mCellDrawView;
};

View File

@ -458,8 +458,6 @@ nsNativeThemeCocoa::nsNativeThemeCocoa() : ThemeCocoa(ScrollbarStyle()) {
mMeterBarCell = [[NSLevelIndicatorCell alloc]
initWithLevelIndicatorStyle:NSLevelIndicatorStyleContinuousCapacity];
mTreeHeaderCell = [[NSTableHeaderCell alloc] init];
mCellDrawView = [[MOZCellDrawView alloc] init];
if (XRE_IsParentProcess()) {
@ -498,7 +496,6 @@ nsNativeThemeCocoa::~nsNativeThemeCocoa() {
[mSearchFieldCell release];
[mDropdownCell release];
[mComboBoxCell release];
[mTreeHeaderCell release];
[mCellDrawWindow release];
[mCellDrawView release];
@ -1317,17 +1314,6 @@ static void RenderButton(CGContextRef cgContext, const HIRect& aRenderRect,
NULL);
}
static ThemeDrawState ToThemeDrawState(
const nsNativeThemeCocoa::ControlParams& aParams) {
if (aParams.disabled) {
return kThemeStateUnavailable;
}
if (aParams.pressed) {
return kThemeStatePressed;
}
return kThemeStateActive;
}
void nsNativeThemeCocoa::DrawHIThemeButton(
CGContextRef cgContext, const HIRect& aRect, ThemeButtonKind aKind,
ThemeButtonValue aValue, ThemeDrawState aState,
@ -1377,16 +1363,6 @@ void nsNativeThemeCocoa::DrawButton(CGContextRef cgContext,
case ButtonType::eHelpButton:
DrawHelpButton(cgContext, inBoxRect, controlParams);
return;
case ButtonType::eTreeTwistyPointingRight:
DrawHIThemeButton(cgContext, inBoxRect, kThemeDisclosureButton,
kThemeDisclosureRight, ToThemeDrawState(controlParams),
kThemeAdornmentNone, controlParams);
return;
case ButtonType::eTreeTwistyPointingDown:
DrawHIThemeButton(cgContext, inBoxRect, kThemeDisclosureButton,
kThemeDisclosureDown, ToThemeDrawState(controlParams),
kThemeAdornmentNone, controlParams);
return;
case ButtonType::eDisclosureButtonClosed:
DrawDisclosureButton(cgContext, inBoxRect, controlParams,
NSControlStateValueOff);
@ -1398,87 +1374,6 @@ void nsNativeThemeCocoa::DrawButton(CGContextRef cgContext,
}
}
nsNativeThemeCocoa::TreeHeaderCellParams
nsNativeThemeCocoa::ComputeTreeHeaderCellParams(nsIFrame* aFrame,
ElementState aEventState) {
TreeHeaderCellParams params;
params.controlParams = ComputeControlParams(aFrame, aEventState);
params.sortDirection = GetTreeSortDirection(aFrame);
params.lastTreeHeaderCell = IsLastTreeHeaderCell(aFrame);
return params;
}
@interface NSTableHeaderCell (NSTableHeaderCell_setSortable)
// This method has been present in the same form since at least macOS 10.4.
- (void)_setSortable:(BOOL)arg1
showSortIndicator:(BOOL)arg2
ascending:(BOOL)arg3
priority:(NSInteger)arg4
highlightForSort:(BOOL)arg5;
@end
void nsNativeThemeCocoa::DrawTreeHeaderCell(
CGContextRef cgContext, const HIRect& inBoxRect,
const TreeHeaderCellParams& aParams) {
NS_OBJC_BEGIN_TRY_IGNORE_BLOCK;
// Without clearing the cell's title, it takes on a default value of "Field",
// which is displayed underneath the title set in the front-end.
NSCell* cell = (NSCell*)mTreeHeaderCell;
cell.title = @"";
if ([mTreeHeaderCell
respondsToSelector:@selector
(_setSortable:
showSortIndicator:ascending:priority:highlightForSort:)]) {
switch (aParams.sortDirection) {
case eTreeSortDirection_Ascending:
[mTreeHeaderCell _setSortable:YES
showSortIndicator:YES
ascending:YES
priority:0
highlightForSort:YES];
break;
case eTreeSortDirection_Descending:
[mTreeHeaderCell _setSortable:YES
showSortIndicator:YES
ascending:NO
priority:0
highlightForSort:YES];
break;
default:
// eTreeSortDirection_Natural
[mTreeHeaderCell _setSortable:YES
showSortIndicator:NO
ascending:YES
priority:0
highlightForSort:NO];
break;
}
}
mTreeHeaderCell.enabled = !aParams.controlParams.disabled;
mTreeHeaderCell.state =
(mTreeHeaderCell.enabled && aParams.controlParams.pressed)
? NSControlStateValueOn
: NSControlStateValueOff;
mCellDrawView._drawingEndSeparator = !aParams.lastTreeHeaderCell;
NSGraphicsContext* savedContext = NSGraphicsContext.currentContext;
NSGraphicsContext.currentContext =
[NSGraphicsContext graphicsContextWithCGContext:cgContext flipped:YES];
DrawCellIncludingFocusRing(mTreeHeaderCell, inBoxRect, mCellDrawView);
NSGraphicsContext.currentContext = savedContext;
#if DRAW_IN_FRAME_DEBUG
CGContextSetRGBFillColor(cgContext, 0.0, 0.0, 0.5, 0.25);
CGContextFillRect(cgContext, inBoxRect);
#endif
NS_OBJC_END_TRY_IGNORE_BLOCK;
}
static const CellRenderSettings dropdownSettings = {
{
NSMakeSize(0, 16), // mini
@ -2348,30 +2243,6 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
// Do nothing: progress and meter bars cases will draw chunks.
break;
case StyleAppearance::Treetwisty:
return Some(WidgetInfo::Button(
ButtonParams{ComputeControlParams(aFrame, elementState),
ButtonType::eTreeTwistyPointingRight}));
case StyleAppearance::Treetwistyopen:
return Some(WidgetInfo::Button(
ButtonParams{ComputeControlParams(aFrame, elementState),
ButtonType::eTreeTwistyPointingDown}));
case StyleAppearance::Treeheadercell:
return Some(WidgetInfo::TreeHeaderCell(
ComputeTreeHeaderCellParams(aFrame, elementState)));
case StyleAppearance::Treeitem:
case StyleAppearance::Treeview:
return Some(WidgetInfo::ColorFill(sRGBColor(1.0, 1.0, 1.0, 1.0)));
case StyleAppearance::Treeheader:
// do nothing, taken care of by individual header cells
case StyleAppearance::Treeline:
// do nothing, these lines don't exist on macos
break;
case StyleAppearance::Range: {
Maybe<ScaleParams> params = ComputeHTMLScaleParams(aFrame, elementState);
if (params) {
@ -2581,12 +2452,6 @@ void nsNativeThemeCocoa::RenderWidget(const WidgetInfo& aWidgetInfo,
DrawMeter(cgContext, macRect, params);
break;
}
case Widget::eTreeHeaderCell: {
TreeHeaderCellParams params =
aWidgetInfo.Params<TreeHeaderCellParams>();
DrawTreeHeaderCell(cgContext, macRect, params);
break;
}
case Widget::eScale: {
ScaleParams params = aWidgetInfo.Params<ScaleParams>();
DrawScale(cgContext, macRect, params);
@ -2672,11 +2537,6 @@ bool nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(
case StyleAppearance::Searchfield:
case StyleAppearance::ProgressBar:
case StyleAppearance::Meter:
case StyleAppearance::Treeheadercell:
case StyleAppearance::Treetwisty:
case StyleAppearance::Treetwistyopen:
case StyleAppearance::Treeitem:
case StyleAppearance::Treeview:
case StyleAppearance::Range:
return false;
@ -2989,23 +2849,6 @@ LayoutDeviceIntSize nsNativeThemeCocoa::GetMinimumWidgetSize(
break;
}
case StyleAppearance::Treetwisty:
case StyleAppearance::Treetwistyopen: {
SInt32 twistyHeight = 0, twistyWidth = 0;
::GetThemeMetric(kThemeMetricDisclosureButtonWidth, &twistyWidth);
::GetThemeMetric(kThemeMetricDisclosureButtonHeight, &twistyHeight);
result.SizeTo(twistyWidth, twistyHeight);
break;
}
case StyleAppearance::Treeheader:
case StyleAppearance::Treeheadercell: {
SInt32 headerHeight = 0;
::GetThemeMetric(kThemeMetricListHeaderHeight, &headerHeight);
result.SizeTo(0, headerHeight);
break;
}
case StyleAppearance::Tab: {
result.SizeTo(0, tabHeights[miniControlSize]);
break;
@ -3145,14 +2988,6 @@ bool nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext,
case StyleAppearance::Tabpanels:
case StyleAppearance::Tab:
case StyleAppearance::Treetwisty:
case StyleAppearance::Treetwistyopen:
case StyleAppearance::Treeview:
case StyleAppearance::Treeheader:
case StyleAppearance::Treeheadercell:
case StyleAppearance::Treeitem:
case StyleAppearance::Treeline:
case StyleAppearance::Range:
return !IsWidgetStyled(aPresContext, aFrame, aAppearance);
@ -3220,8 +3055,6 @@ bool nsNativeThemeCocoa::WidgetAppearanceDependsOnWindowFocus(
case StyleAppearance::NumberInput:
case StyleAppearance::PasswordInput:
case StyleAppearance::Textfield:
case StyleAppearance::Treeview:
case StyleAppearance::Treeline:
case StyleAppearance::Textarea:
case StyleAppearance::Listbox:
return false;

View File

@ -1079,11 +1079,6 @@ static GtkStyleContext* GetCssNodeStyleInternal(WidgetNodeType aNodeType) {
// TODO - create from CSS node
style = CreateSubStyleWithClass(MOZ_GTK_TREEVIEW, GTK_STYLE_CLASS_VIEW);
break;
case MOZ_GTK_TREEVIEW_EXPANDER:
// TODO - create from CSS node
style =
CreateSubStyleWithClass(MOZ_GTK_TREEVIEW, GTK_STYLE_CLASS_EXPANDER);
break;
case MOZ_GTK_SPLITTER_SEPARATOR_HORIZONTAL:
style = CreateChildCSSNode("separator", MOZ_GTK_SPLITTER_HORIZONTAL);
break;
@ -1218,10 +1213,6 @@ static GtkStyleContext* GetWidgetStyleInternal(WidgetNodeType aNodeType) {
case MOZ_GTK_TREEVIEW_VIEW:
style = CreateSubStyleWithClass(MOZ_GTK_TREEVIEW, GTK_STYLE_CLASS_VIEW);
break;
case MOZ_GTK_TREEVIEW_EXPANDER:
style =
CreateSubStyleWithClass(MOZ_GTK_TREEVIEW, GTK_STYLE_CLASS_EXPANDER);
break;
case MOZ_GTK_SPLITTER_SEPARATOR_HORIZONTAL:
style = CreateSubStyleWithClass(MOZ_GTK_SPLITTER_HORIZONTAL,
GTK_STYLE_CLASS_PANE_SEPARATOR);

View File

@ -953,54 +953,7 @@ static gint moz_gtk_treeview_paint(cairo_t* cr, GdkRectangle* rect,
return MOZ_GTK_SUCCESS;
}
static gint moz_gtk_tree_header_cell_paint(cairo_t* cr,
const GdkRectangle* aRect,
GtkWidgetState* state,
gboolean isSorted,
GtkTextDirection direction) {
moz_gtk_button_paint(cr, aRect, state, GTK_RELIEF_NORMAL,
GetWidget(MOZ_GTK_TREE_HEADER_CELL), direction);
return MOZ_GTK_SUCCESS;
}
/* See gtk_expander_paint() for reference.
*/
static gint moz_gtk_treeview_expander_paint(cairo_t* cr, GdkRectangle* rect,
GtkWidgetState* state,
GtkExpanderStyle expander_state,
GtkTextDirection direction) {
/* Because the frame we get is of the entire treeview, we can't get the
* precise event state of one expander, thus rendering hover and active
* feedback useless. */
GtkStateFlags state_flags =
state->disabled ? GTK_STATE_FLAG_INSENSITIVE : GTK_STATE_FLAG_NORMAL;
if (state->inHover)
state_flags =
static_cast<GtkStateFlags>(state_flags | GTK_STATE_FLAG_PRELIGHT);
if (state->selected)
state_flags =
static_cast<GtkStateFlags>(state_flags | GTK_STATE_FLAG_SELECTED);
/* GTK_STATE_FLAG_ACTIVE controls expanded/colapsed state rendering
* in gtk_render_expander()
*/
if (expander_state == GTK_EXPANDER_EXPANDED)
state_flags =
static_cast<GtkStateFlags>(state_flags | checkbox_check_state);
else
state_flags =
static_cast<GtkStateFlags>(state_flags & ~(checkbox_check_state));
GtkStyleContext* style = GetStyleContext(
MOZ_GTK_TREEVIEW_EXPANDER, state->image_scale, direction, state_flags);
gtk_render_expander(style, cr, rect->x, rect->y, rect->width, rect->height);
return MOZ_GTK_SUCCESS;
}
/* See gtk_separator_draw() for reference.
*/
/* See gtk_separator_draw() for reference. */
static gint moz_gtk_combo_box_paint(cairo_t* cr, const GdkRectangle* aRect,
GtkWidgetState* state,
GtkTextDirection direction) {
@ -1588,18 +1541,6 @@ gint moz_gtk_get_widget_border(WidgetNodeType widget, gint* left, gint* top,
moz_gtk_add_style_border(style, left, top, right, bottom);
return MOZ_GTK_SUCCESS;
}
case MOZ_GTK_TREE_HEADER_CELL: {
/* A Tree Header in GTK is just a different styled button
* It must be placed in a TreeView for getting the correct style
* assigned.
* That is why the following code is the same as for MOZ_GTK_BUTTON.
* */
*left = *top = *right = *bottom = gtk_container_get_border_width(
GTK_CONTAINER(GetWidget(MOZ_GTK_TREE_HEADER_CELL)));
style = GetStyleContext(MOZ_GTK_TREE_HEADER_CELL);
moz_gtk_add_border_padding(style, left, top, right, bottom);
return MOZ_GTK_SUCCESS;
}
case MOZ_GTK_DROPDOWN: {
/* We need to account for the arrow on the dropdown, so text
* doesn't come too close to the arrow, or in some cases spill
@ -1685,7 +1626,6 @@ gint moz_gtk_get_widget_border(WidgetNodeType widget, gint* left, gint* top,
case MOZ_GTK_PROGRESS_CHUNK:
case MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE:
case MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE:
case MOZ_GTK_TREEVIEW_EXPANDER:
case MOZ_GTK_HEADER_BAR:
case MOZ_GTK_HEADER_BAR_MAXIMIZED:
case MOZ_GTK_HEADER_BAR_BUTTON_CLOSE:
@ -1793,18 +1733,6 @@ void moz_gtk_get_arrow_size(WidgetNodeType widgetType, gint* width,
}
}
gint moz_gtk_get_expander_size(gint* size) {
GtkStyleContext* style = GetStyleContext(MOZ_GTK_EXPANDER);
gtk_style_context_get_style(style, "expander-size", size, NULL);
return MOZ_GTK_SUCCESS;
}
gint moz_gtk_get_treeview_expander_size(gint* size) {
GtkStyleContext* style = GetStyleContext(MOZ_GTK_TREEVIEW);
gtk_style_context_get_style(style, "expander-size", size, NULL);
return MOZ_GTK_SUCCESS;
}
void moz_gtk_get_entry_min_height(gint* min_content_height,
gint* border_padding_height) {
GtkStyleContext* style = GetStyleContext(MOZ_GTK_ENTRY);
@ -2073,11 +2001,6 @@ gint moz_gtk_widget_paint(WidgetNodeType widget, cairo_t* cr,
}
case MOZ_GTK_TREEVIEW:
return moz_gtk_treeview_paint(cr, rect, state, direction);
case MOZ_GTK_TREE_HEADER_CELL:
return moz_gtk_tree_header_cell_paint(cr, rect, state, flags, direction);
case MOZ_GTK_TREEVIEW_EXPANDER:
return moz_gtk_treeview_expander_paint(
cr, rect, state, (GtkExpanderStyle)flags, direction);
case MOZ_GTK_ENTRY:
case MOZ_GTK_DROPDOWN_ENTRY: {
GtkStyleContext* style =

View File

@ -212,8 +212,6 @@ enum WidgetNodeType : int {
MOZ_GTK_TREEVIEW_VIEW,
/* Paints treeheader cells */
MOZ_GTK_TREE_HEADER_CELL,
/* Paints an expander for a GtkTreeView */
MOZ_GTK_TREEVIEW_EXPANDER,
/* Paints the background of menus, context menus. */
MOZ_GTK_MENUPOPUP,
/* Menubar for -moz-headerbar colors */
@ -458,22 +456,6 @@ void moz_gtk_get_entry_min_height(gint* min_content_height,
*/
gint moz_gtk_get_toolbar_separator_width(gint* size);
/**
* Get the size of a regular GTK expander that shows/hides content
* size: [OUT] the size of the GTK expander, size = width = height.
*
* returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise
*/
gint moz_gtk_get_expander_size(gint* size);
/**
* Get the size of a treeview's expander (we call them twisties)
* size: [OUT] the size of the GTK expander, size = width = height.
*
* returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise
*/
gint moz_gtk_get_treeview_expander_size(gint* size);
/**
* Get the desired size of a splitter
* orientation: [IN] GTK_ORIENTATION_HORIZONTAL or GTK_ORIENTATION_VERTICAL

View File

@ -195,14 +195,6 @@ bool nsNativeThemeGTK::GetGtkWidgetAndState(StyleAppearance aAppearance,
aAppearance == StyleAppearance::Menulist ||
aAppearance == StyleAppearance::MenulistButton) {
aState->active &= aState->inHover;
} else if (aAppearance == StyleAppearance::Treetwisty ||
aAppearance == StyleAppearance::Treetwistyopen) {
if (nsTreeBodyFrame* treeBodyFrame = do_QueryFrame(aFrame)) {
const mozilla::AtomArray& atoms =
treeBodyFrame->GetPropertyArrayForCurrentDrawingItem();
aState->selected = atoms.Contains(nsGkAtoms::selected);
aState->inHover = atoms.Contains(nsGkAtoms::hover);
}
}
if (IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XUL)) {
@ -300,17 +292,8 @@ bool nsNativeThemeGTK::GetGtkWidgetAndState(StyleAppearance aAppearance,
aGtkWidgetType = MOZ_GTK_TEXT_VIEW;
break;
case StyleAppearance::Listbox:
case StyleAppearance::Treeview:
aGtkWidgetType = MOZ_GTK_TREEVIEW;
break;
case StyleAppearance::Treetwisty:
aGtkWidgetType = MOZ_GTK_TREEVIEW_EXPANDER;
if (aWidgetFlags) *aWidgetFlags = GTK_EXPANDER_COLLAPSED;
break;
case StyleAppearance::Treetwistyopen:
aGtkWidgetType = MOZ_GTK_TREEVIEW_EXPANDER;
if (aWidgetFlags) *aWidgetFlags = GTK_EXPANDER_EXPANDED;
break;
case StyleAppearance::MenulistButton:
case StyleAppearance::Menulist:
aGtkWidgetType = MOZ_GTK_DROPDOWN;
@ -1137,12 +1120,6 @@ LayoutDeviceIntSize nsNativeThemeGTK::GetMinimumWidgetSize(
result.width = 14;
result.height = 13;
break;
case StyleAppearance::Treetwisty:
case StyleAppearance::Treetwistyopen: {
gint expander_size;
moz_gtk_get_treeview_expander_size(&expander_size);
result.width = result.height = expander_size;
} break;
default:
break;
}
@ -1245,12 +1222,6 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
case StyleAppearance::ButtonArrowNext:
case StyleAppearance::ButtonArrowPrevious:
case StyleAppearance::Listbox:
case StyleAppearance::Treeview:
// case StyleAppearance::Treeitem:
case StyleAppearance::Treetwisty:
// case StyleAppearance::Treeline:
// case StyleAppearance::Treeheader:
case StyleAppearance::Treetwistyopen:
case StyleAppearance::ProgressBar:
case StyleAppearance::Progresschunk:
case StyleAppearance::Tab:

View File

@ -501,12 +501,7 @@ mozilla::Maybe<nsUXThemeClass> nsNativeThemeWin::GetThemeClass(
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
return Some(eUXCombobox);
case StyleAppearance::Treeheadercell:
return Some(eUXHeader);
case StyleAppearance::Listbox:
case StyleAppearance::Treeview:
case StyleAppearance::Treetwistyopen:
case StyleAppearance::Treeitem:
return Some(eUXListview);
default:
return Nothing();
@ -718,7 +713,6 @@ nsresult nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame,
}
return NS_OK;
}
case StyleAppearance::Treeview:
case StyleAppearance::Listbox: {
aPart = TREEVIEW_BODY;
aState = TS_NORMAL;
@ -755,17 +749,6 @@ nsresult nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame,
return NS_OK;
}
case StyleAppearance::Treeheadercell: {
aPart = 1;
if (!aFrame) {
aState = TS_NORMAL;
return NS_OK;
}
aState = StandardGetState(aFrame, aAppearance, true);
return NS_OK;
}
case StyleAppearance::MenulistButton:
case StyleAppearance::Menulist: {
nsIContent* content = aFrame->GetContent();
@ -1247,7 +1230,6 @@ LayoutDeviceIntSize nsNativeThemeWin::GetMinimumWidgetSize(
case StyleAppearance::Tabpanels:
case StyleAppearance::Tabpanel:
case StyleAppearance::Listbox:
case StyleAppearance::Treeview:
return {}; // Don't worry about it.
default:
break;
@ -1453,7 +1435,6 @@ bool nsNativeThemeWin::ClassicThemeSupportsWidget(nsIFrame* aFrame,
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::Listbox:
case StyleAppearance::Treeview:
case StyleAppearance::ProgressBar:
case StyleAppearance::Progresschunk:
case StyleAppearance::Tab:
@ -1473,7 +1454,6 @@ LayoutDeviceIntMargin nsNativeThemeWin::ClassicGetWidgetBorder(
result.top = result.left = result.bottom = result.right = 2;
break;
case StyleAppearance::Listbox:
case StyleAppearance::Treeview:
case StyleAppearance::Menulist:
case StyleAppearance::MenulistButton:
case StyleAppearance::Tab:
@ -1525,7 +1505,6 @@ LayoutDeviceIntSize nsNativeThemeWin::ClassicGetMinimumWidgetSize(
case StyleAppearance::MenulistButton:
case StyleAppearance::Button:
case StyleAppearance::Listbox:
case StyleAppearance::Treeview:
case StyleAppearance::NumberInput:
case StyleAppearance::PasswordInput:
case StyleAppearance::Textfield:
@ -1584,7 +1563,6 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(
return NS_OK;
}
case StyleAppearance::Listbox:
case StyleAppearance::Treeview:
case StyleAppearance::NumberInput:
case StyleAppearance::PasswordInput:
case StyleAppearance::Textfield:
@ -1799,15 +1777,6 @@ RENDER_AGAIN:
break;
}
case StyleAppearance::Treeview: {
// Draw inset edge
::DrawEdge(hdc, &widgetRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
// Fill in window color background
::FillRect(hdc, &widgetRect, (HBRUSH)(COLOR_WINDOW + 1));
break;
}
// Draw 3D face background controls
case StyleAppearance::ProgressBar:
// Draw 3D border

View File

@ -72,8 +72,6 @@ const wchar_t* nsUXThemeData::GetClassName(nsUXThemeClass cls) {
return L"Trackbar";
case eUXCombobox:
return L"Combobox";
case eUXHeader:
return L"Header";
case eUXListview:
return L"Listview";
case eUXMenu:

View File

@ -24,7 +24,6 @@ enum nsUXThemeClass {
eUXTab,
eUXTrackbar,
eUXCombobox,
eUXHeader,
eUXListview,
eUXMenu,
eUXNumClasses

View File

@ -450,6 +450,7 @@ STATIC_ATOMS = [
Atom("figcaption", "figcaption"),
Atom("figure", "figure"),
Atom("findbar", "findbar"),
Atom("firstColumn", "first-column"),
Atom("firstInput", "first-input"),
Atom("fixed", "fixed"),
Atom("flags", "flags"),
@ -971,6 +972,7 @@ STATIC_ATOMS = [
Atom("option", "option"),
Atom("_or", "or"),
Atom("order", "order"),
Atom("ordinal", "ordinal"),
Atom("orient", "orient"),
Atom("orientation", "orientation"),
Atom("origin_trial", "origin-trial"),