forked from mirrors/gecko-dev
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:
parent
ea9db1a2ff
commit
fb06f366ae
22 changed files with 200 additions and 622 deletions
|
|
@ -184,15 +184,21 @@
|
||||||
#placeContent {
|
#placeContent {
|
||||||
appearance: none;
|
appearance: none;
|
||||||
border: none;
|
border: none;
|
||||||
}
|
|
||||||
|
|
||||||
#placeContent > treechildren::-moz-tree-cell,
|
> treechildren::-moz-tree-cell,
|
||||||
#placeContent > treechildren::-moz-tree-column {
|
> treechildren::-moz-tree-column {
|
||||||
border-inline-end: 1px solid color-mix(in srgb, FieldText 30%, transparent);
|
border-inline-start: 1px solid color-mix(in srgb, FieldText 30%, transparent);
|
||||||
}
|
}
|
||||||
|
|
||||||
#placeContent > treechildren::-moz-tree-cell(separator) {
|
> treechildren::-moz-tree-column(first-column),
|
||||||
border-color: transparent;
|
> 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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -47,13 +47,11 @@
|
||||||
#include "nsContainerFrame.h"
|
#include "nsContainerFrame.h"
|
||||||
#include "nsView.h"
|
#include "nsView.h"
|
||||||
#include "nsViewManager.h"
|
#include "nsViewManager.h"
|
||||||
#include "nsVariant.h"
|
|
||||||
#include "nsWidgetsCID.h"
|
#include "nsWidgetsCID.h"
|
||||||
#include "nsIFrameInlines.h"
|
#include "nsIFrameInlines.h"
|
||||||
#include "nsTreeContentView.h"
|
#include "nsTreeContentView.h"
|
||||||
#include "nsTreeUtils.h"
|
#include "nsTreeUtils.h"
|
||||||
#include "nsStyleConsts.h"
|
#include "nsStyleConsts.h"
|
||||||
#include "nsITheme.h"
|
|
||||||
#include "imgIRequest.h"
|
#include "imgIRequest.h"
|
||||||
#include "imgIContainer.h"
|
#include "imgIContainer.h"
|
||||||
#include "mozilla/dom/NodeInfo.h"
|
#include "mozilla/dom/NodeInfo.h"
|
||||||
|
|
@ -1711,115 +1709,133 @@ void nsTreeBodyFrame::PrefillPropertyArray(int32_t aRowIndex,
|
||||||
mScratchArray.Clear();
|
mScratchArray.Clear();
|
||||||
|
|
||||||
// focus
|
// focus
|
||||||
if (mFocused)
|
if (mFocused) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::focus);
|
mScratchArray.AppendElement(nsGkAtoms::focus);
|
||||||
else
|
} else {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::blur);
|
mScratchArray.AppendElement(nsGkAtoms::blur);
|
||||||
|
}
|
||||||
|
|
||||||
// sort
|
// sort
|
||||||
bool sorted = false;
|
bool sorted = false;
|
||||||
mView->IsSorted(&sorted);
|
mView->IsSorted(&sorted);
|
||||||
if (sorted) mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::sorted);
|
if (sorted) {
|
||||||
|
mScratchArray.AppendElement(nsGkAtoms::sorted);
|
||||||
|
}
|
||||||
|
|
||||||
// drag session
|
// drag session
|
||||||
if (mSlots && mSlots->mIsDragging)
|
if (mSlots && mSlots->mIsDragging) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::dragSession);
|
mScratchArray.AppendElement(nsGkAtoms::dragSession);
|
||||||
|
}
|
||||||
|
|
||||||
if (aRowIndex != -1) {
|
if (aRowIndex != -1) {
|
||||||
if (aRowIndex == mMouseOverRow)
|
if (aRowIndex == mMouseOverRow) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::hover);
|
mScratchArray.AppendElement(nsGkAtoms::hover);
|
||||||
|
}
|
||||||
|
|
||||||
nsCOMPtr<nsITreeSelection> selection = GetSelection();
|
nsCOMPtr<nsITreeSelection> selection = GetSelection();
|
||||||
if (selection) {
|
if (selection) {
|
||||||
// selected
|
// selected
|
||||||
bool isSelected;
|
bool isSelected;
|
||||||
selection->IsSelected(aRowIndex, &isSelected);
|
selection->IsSelected(aRowIndex, &isSelected);
|
||||||
if (isSelected)
|
if (isSelected) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::selected);
|
mScratchArray.AppendElement(nsGkAtoms::selected);
|
||||||
|
}
|
||||||
|
|
||||||
// current
|
// current
|
||||||
int32_t currentIndex;
|
int32_t currentIndex;
|
||||||
selection->GetCurrentIndex(¤tIndex);
|
selection->GetCurrentIndex(¤tIndex);
|
||||||
if (aRowIndex == currentIndex)
|
if (aRowIndex == currentIndex) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::current);
|
mScratchArray.AppendElement(nsGkAtoms::current);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// container or leaf
|
// container or leaf
|
||||||
bool isContainer = false;
|
bool isContainer = false;
|
||||||
mView->IsContainer(aRowIndex, &isContainer);
|
mView->IsContainer(aRowIndex, &isContainer);
|
||||||
if (isContainer) {
|
if (isContainer) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::container);
|
mScratchArray.AppendElement(nsGkAtoms::container);
|
||||||
|
|
||||||
// open or closed
|
// open or closed
|
||||||
bool isOpen = false;
|
bool isOpen = false;
|
||||||
mView->IsContainerOpen(aRowIndex, &isOpen);
|
mView->IsContainerOpen(aRowIndex, &isOpen);
|
||||||
if (isOpen)
|
if (isOpen) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::open);
|
mScratchArray.AppendElement(nsGkAtoms::open);
|
||||||
else
|
} else {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::closed);
|
mScratchArray.AppendElement(nsGkAtoms::closed);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::leaf);
|
mScratchArray.AppendElement(nsGkAtoms::leaf);
|
||||||
}
|
}
|
||||||
|
|
||||||
// drop orientation
|
// drop orientation
|
||||||
if (mSlots && mSlots->mDropAllowed && mSlots->mDropRow == aRowIndex) {
|
if (mSlots && mSlots->mDropAllowed && mSlots->mDropRow == aRowIndex) {
|
||||||
if (mSlots->mDropOrient == nsITreeView::DROP_BEFORE)
|
if (mSlots->mDropOrient == nsITreeView::DROP_BEFORE) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::dropBefore);
|
mScratchArray.AppendElement(nsGkAtoms::dropBefore);
|
||||||
else if (mSlots->mDropOrient == nsITreeView::DROP_ON)
|
} else if (mSlots->mDropOrient == nsITreeView::DROP_ON) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::dropOn);
|
mScratchArray.AppendElement(nsGkAtoms::dropOn);
|
||||||
else if (mSlots->mDropOrient == nsITreeView::DROP_AFTER)
|
} else if (mSlots->mDropOrient == nsITreeView::DROP_AFTER) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::dropAfter);
|
mScratchArray.AppendElement(nsGkAtoms::dropAfter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// odd or even
|
// odd or even
|
||||||
if (aRowIndex % 2)
|
if (aRowIndex % 2) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::odd);
|
mScratchArray.AppendElement(nsGkAtoms::odd);
|
||||||
else
|
} else {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::even);
|
mScratchArray.AppendElement(nsGkAtoms::even);
|
||||||
|
}
|
||||||
|
|
||||||
XULTreeElement* tree = GetBaseElement();
|
XULTreeElement* tree = GetBaseElement();
|
||||||
if (tree && tree->HasAttr(nsGkAtoms::editing)) {
|
if (tree && tree->HasAttr(nsGkAtoms::editing)) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::editing);
|
mScratchArray.AppendElement(nsGkAtoms::editing);
|
||||||
}
|
}
|
||||||
|
|
||||||
// multiple columns
|
// multiple columns
|
||||||
if (mColumns->GetColumnAt(1))
|
if (mColumns->GetColumnAt(1)) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::multicol);
|
mScratchArray.AppendElement(nsGkAtoms::multicol);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aCol) {
|
if (aCol) {
|
||||||
mScratchArray.AppendElement(aCol->GetAtom());
|
mScratchArray.AppendElement(aCol->GetAtom());
|
||||||
|
|
||||||
if (aCol->IsPrimary())
|
if (aCol->IsPrimary()) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::primary);
|
mScratchArray.AppendElement(nsGkAtoms::primary);
|
||||||
|
}
|
||||||
|
|
||||||
if (aCol->GetType() == TreeColumn_Binding::TYPE_CHECKBOX) {
|
if (aCol->GetType() == TreeColumn_Binding::TYPE_CHECKBOX) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::checkbox);
|
mScratchArray.AppendElement(nsGkAtoms::checkbox);
|
||||||
|
|
||||||
if (aRowIndex != -1) {
|
if (aRowIndex != -1) {
|
||||||
nsAutoString value;
|
nsAutoString value;
|
||||||
mView->GetCellValue(aRowIndex, aCol, value);
|
mView->GetCellValue(aRowIndex, aCol, value);
|
||||||
if (value.EqualsLiteral("true"))
|
if (value.EqualsLiteral("true")) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::checked);
|
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
|
// Read special properties from attributes on the column content node
|
||||||
if (aCol->mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::insertbefore,
|
if (aCol->mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::insertbefore,
|
||||||
nsGkAtoms::_true, eCaseMatters))
|
nsGkAtoms::_true, eCaseMatters)) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::insertbefore);
|
mScratchArray.AppendElement(nsGkAtoms::insertbefore);
|
||||||
|
}
|
||||||
if (aCol->mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::insertafter,
|
if (aCol->mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::insertafter,
|
||||||
nsGkAtoms::_true, eCaseMatters))
|
nsGkAtoms::_true, eCaseMatters)) {
|
||||||
mScratchArray.AppendElement((nsStaticAtom*)nsGkAtoms::insertafter);
|
mScratchArray.AppendElement(nsGkAtoms::insertafter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nsITheme* nsTreeBodyFrame::GetTwistyRect(int32_t aRowIndex,
|
void nsTreeBodyFrame::GetTwistyRect(int32_t aRowIndex, nsTreeColumn* aColumn,
|
||||||
nsTreeColumn* aColumn,
|
nsRect& aImageRect, nsRect& aTwistyRect,
|
||||||
nsRect& aImageRect,
|
nsPresContext* aPresContext,
|
||||||
nsRect& aTwistyRect,
|
ComputedStyle* aTwistyContext) {
|
||||||
nsPresContext* aPresContext,
|
|
||||||
ComputedStyle* aTwistyContext) {
|
|
||||||
// The twisty rect extends all the way to the end of the cell. This is
|
// 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
|
// 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
|
// 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
|
// a -moz-appearance involved, adjust the rect by the minimum widget size
|
||||||
// provided by the theme implementation.
|
// provided by the theme implementation.
|
||||||
aImageRect = GetImageSize(aRowIndex, aColumn, true, aTwistyContext);
|
aImageRect = GetImageSize(aRowIndex, aColumn, true, aTwistyContext);
|
||||||
if (aImageRect.height > aTwistyRect.height)
|
if (aImageRect.height > aTwistyRect.height) {
|
||||||
aImageRect.height = aTwistyRect.height;
|
aImageRect.height = aTwistyRect.height;
|
||||||
if (aImageRect.width > aTwistyRect.width)
|
}
|
||||||
|
if (aImageRect.width > aTwistyRect.width) {
|
||||||
aImageRect.width = aTwistyRect.width;
|
aImageRect.width = aTwistyRect.width;
|
||||||
else
|
} else {
|
||||||
aTwistyRect.width = aImageRect.width;
|
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,
|
nsresult nsTreeBodyFrame::GetImage(int32_t aRowIndex, nsTreeColumn* aCol,
|
||||||
|
|
@ -2693,21 +2683,8 @@ ImgDrawResult nsTreeBodyFrame::PaintRow(int32_t aRowIndex,
|
||||||
ImgDrawResult result = ImgDrawResult::SUCCESS;
|
ImgDrawResult result = ImgDrawResult::SUCCESS;
|
||||||
|
|
||||||
// Paint our borders and background for our row rect.
|
// Paint our borders and background for our row rect.
|
||||||
nsITheme* theme = nullptr;
|
result &= PaintBackgroundLayer(rowContext, aPresContext, aRenderingContext,
|
||||||
auto appearance = rowContext->StyleDisplay()->EffectiveAppearance();
|
rowRect, aDirtyRect);
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adjust the rect for its border and padding.
|
// Adjust the rect for its border and padding.
|
||||||
nsRect originalRowRect = rowRect;
|
nsRect originalRowRect = rowRect;
|
||||||
|
|
@ -2820,54 +2797,32 @@ ImgDrawResult nsTreeBodyFrame::PaintSeparator(int32_t aRowIndex,
|
||||||
// Resolve style for the separator.
|
// Resolve style for the separator.
|
||||||
ComputedStyle* separatorContext =
|
ComputedStyle* separatorContext =
|
||||||
GetPseudoComputedStyle(nsCSSAnonBoxes::mozTreeSeparator());
|
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.
|
// Obtain the height for the separator or use the default value.
|
||||||
if (useTheme) {
|
nscoord height;
|
||||||
nsRect dirty;
|
if (stylePosition->mHeight.ConvertsToLength()) {
|
||||||
dirty.IntersectRect(aSeparatorRect, aDirtyRect);
|
height = stylePosition->mHeight.ToLength();
|
||||||
theme->DrawWidgetBackground(&aRenderingContext, this, appearance,
|
|
||||||
aSeparatorRect, dirty);
|
|
||||||
} else {
|
} else {
|
||||||
const nsStylePosition* stylePosition = separatorContext->StylePosition();
|
// Use default height 2px.
|
||||||
|
height = nsPresContext::CSSPixelsToAppUnits(2);
|
||||||
// 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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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(
|
ImgDrawResult nsTreeBodyFrame::PaintCell(
|
||||||
|
|
@ -3084,68 +3039,57 @@ ImgDrawResult nsTreeBodyFrame::PaintTwisty(
|
||||||
twistyRect.Deflate(twistyMargin);
|
twistyRect.Deflate(twistyMargin);
|
||||||
|
|
||||||
nsRect imageSize;
|
nsRect imageSize;
|
||||||
nsITheme* theme = GetTwistyRect(aRowIndex, aColumn, imageSize, twistyRect,
|
GetTwistyRect(aRowIndex, aColumn, imageSize, twistyRect, aPresContext,
|
||||||
aPresContext, twistyContext);
|
twistyContext);
|
||||||
|
|
||||||
// Subtract out the remaining width. This is done even when we don't actually
|
// 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.
|
// paint a twisty in this cell, so that cells in different rows still line up.
|
||||||
nsRect copyRect(twistyRect);
|
nsRect copyRect(twistyRect);
|
||||||
copyRect.Inflate(twistyMargin);
|
copyRect.Inflate(twistyMargin);
|
||||||
aRemainingWidth -= copyRect.width;
|
aRemainingWidth -= copyRect.width;
|
||||||
if (!isRTL) aCurrX += 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -295,10 +295,10 @@ class nsTreeBodyFrame final : public mozilla::SimpleXULLeafFrame,
|
||||||
nsCSSAnonBoxPseudoStaticAtom** aChildElt);
|
nsCSSAnonBoxPseudoStaticAtom** aChildElt);
|
||||||
|
|
||||||
// Retrieve the area for the twisty for a cell.
|
// Retrieve the area for the twisty for a cell.
|
||||||
nsITheme* GetTwistyRect(int32_t aRowIndex, nsTreeColumn* aColumn,
|
void GetTwistyRect(int32_t aRowIndex, nsTreeColumn* aColumn,
|
||||||
nsRect& aImageRect, nsRect& aTwistyRect,
|
nsRect& aImageRect, nsRect& aTwistyRect,
|
||||||
nsPresContext* aPresContext,
|
nsPresContext* aPresContext,
|
||||||
ComputedStyle* aTwistyContext);
|
ComputedStyle* aTwistyContext);
|
||||||
|
|
||||||
// Fetch an image from the image cache.
|
// Fetch an image from the image cache.
|
||||||
nsresult GetImage(int32_t aRowIndex, nsTreeColumn* aCol, bool aUseContext,
|
nsresult GetImage(int32_t aRowIndex, nsTreeColumn* aCol, bool aUseContext,
|
||||||
|
|
|
||||||
|
|
@ -1579,27 +1579,6 @@ pub enum Appearance {
|
||||||
/// A tooltip.
|
/// A tooltip.
|
||||||
#[parse(condition = "ParserContext::chrome_rules_enabled")]
|
#[parse(condition = "ParserContext::chrome_rules_enabled")]
|
||||||
Tooltip,
|
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.
|
/// Mac help button.
|
||||||
#[parse(condition = "ParserContext::chrome_rules_enabled")]
|
#[parse(condition = "ParserContext::chrome_rules_enabled")]
|
||||||
|
|
|
||||||
|
|
@ -22,4 +22,4 @@
|
||||||
@import url("chrome://global/skin/tabbox.css");
|
@import url("chrome://global/skin/tabbox.css");
|
||||||
@import url("chrome://global/skin/toolbar.css");
|
@import url("chrome://global/skin/toolbar.css");
|
||||||
@import url("chrome://global/skin/toolbarbutton.css");
|
@import url("chrome://global/skin/toolbarbutton.css");
|
||||||
@import url("chrome://global/skin/tree.css");
|
@import url("chrome://global/skin/tree/tree.css");
|
||||||
|
|
|
||||||
|
|
@ -600,20 +600,6 @@ menulist[popuponly] {
|
||||||
padding: 0 !important;
|
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 ********/
|
/******** scrollbar ********/
|
||||||
|
|
||||||
slider {
|
slider {
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
skin/classic/global/popupnotification.css (../../shared/popupnotification.css)
|
skin/classic/global/popupnotification.css (../../shared/popupnotification.css)
|
||||||
skin/classic/global/splitter.css (../../shared/splitter.css)
|
skin/classic/global/splitter.css (../../shared/splitter.css)
|
||||||
skin/classic/global/toolbarbutton.css (../../shared/toolbarbutton.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)
|
skin/classic/global/dirListing/dirListing.css (../../shared/dirListing/dirListing.css)
|
||||||
#ifdef XP_MACOSX
|
#ifdef XP_MACOSX
|
||||||
skin/classic/global/dirListing/folder.png (../../shared/dirListing/folder-osx.png)
|
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/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/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/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)
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,4 @@
|
||||||
skin/classic/mozapps/downloads/unknownContentType.css (../../windows/mozapps/downloads/unknownContentType.css)
|
skin/classic/mozapps/downloads/unknownContentType.css (../../windows/mozapps/downloads/unknownContentType.css)
|
||||||
skin/classic/mozapps/handling/handling.css (../../windows/mozapps/handling/handling.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
|
% override chrome://mozapps/skin/xpinstall/xpinstallItemGeneric.png chrome://mozapps/skin/extensions/extensionGeneric.svg
|
||||||
|
|
|
||||||
|
Before Width: | Height: | Size: 447 B After Width: | Height: | Size: 447 B |
|
Before Width: | Height: | Size: 448 B After Width: | Height: | Size: 448 B |
|
|
@ -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 ::::: */
|
/* ::::: tree rows ::::: */
|
||||||
|
|
||||||
treechildren::-moz-tree-row {
|
treechildren::-moz-tree-row {
|
||||||
|
|
@ -123,20 +138,15 @@ treechildren::-moz-tree-drop-feedback {
|
||||||
|
|
||||||
treecol,
|
treecol,
|
||||||
.tree-columnpicker-button {
|
.tree-columnpicker-button {
|
||||||
appearance: auto;
|
|
||||||
-moz-default-appearance: treeheadercell;
|
|
||||||
background-color: -moz-ColHeader;
|
background-color: -moz-ColHeader;
|
||||||
color: -moz-ColHeaderText;
|
color: -moz-ColHeaderText;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding: 0 4px;
|
padding: 0 4px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
border-inline-start: 1px solid ThreeDLightShadow;
|
|
||||||
|
|
||||||
@media (-moz-platform: linux) or ((-moz-platform: windows) and (prefers-color-scheme: dark)) {
|
border-inline-start: 1px solid ThreeDLightShadow;
|
||||||
appearance: none;
|
box-shadow: inset 0 -1px ThreeDLightShadow;
|
||||||
box-shadow: inset 0 -1px ThreeDLightShadow;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:where(:hover) {
|
&:where(:hover) {
|
||||||
background-color: -moz-ColHeaderHover;
|
background-color: -moz-ColHeaderHover;
|
||||||
|
|
@ -250,22 +260,20 @@ html|input.tree-input {
|
||||||
z-index: 2147483647;
|
z-index: 2147483647;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media not (-moz-platform: macos) {
|
/* ::::: sort direction indicator ::::: */
|
||||||
/* ::::: sort direction indicator ::::: */
|
.treecol-sortdirection {
|
||||||
.treecol-sortdirection {
|
list-style-image: url("chrome://global/skin/tree/sort-asc.svg");
|
||||||
list-style-image: url("chrome://global/skin/tree/sort-asc.svg");
|
-moz-context-properties: fill;
|
||||||
-moz-context-properties: fill;
|
fill: currentColor;
|
||||||
fill: currentColor;
|
visibility: hidden;
|
||||||
visibility: hidden;
|
|
||||||
|
|
||||||
treecol[sortDirection="ascending"]:not([hideheader="true"]) > & {
|
treecol[sortDirection="ascending"]:not([hideheader="true"]) > & {
|
||||||
visibility: inherit;
|
visibility: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
treecol[sortDirection="descending"]:not([hideheader="true"]) > & {
|
treecol[sortDirection="descending"]:not([hideheader="true"]) > & {
|
||||||
visibility: inherit;
|
visibility: inherit;
|
||||||
list-style-image: url("chrome://global/skin/tree/sort-dsc.svg");
|
list-style-image: url("chrome://global/skin/tree/sort-dsc.svg");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -238,9 +238,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
|
||||||
case ColorID::MozButtonhoverface:
|
case ColorID::MozButtonhoverface:
|
||||||
case ColorID::MozButtonactiveface:
|
case ColorID::MozButtonactiveface:
|
||||||
case ColorID::MozButtondisabledface:
|
case ColorID::MozButtondisabledface:
|
||||||
case ColorID::MozColheader:
|
|
||||||
case ColorID::MozColheaderhover:
|
|
||||||
case ColorID::MozColheaderactive:
|
|
||||||
color = GetColorFromNSColor(NSColor.controlColor);
|
color = GetColorFromNSColor(NSColor.controlColor);
|
||||||
if (!NS_GET_A(color)) {
|
if (!NS_GET_A(color)) {
|
||||||
color = GetColorFromNSColor(NSColor.controlBackgroundColor);
|
color = GetColorFromNSColor(NSColor.controlBackgroundColor);
|
||||||
|
|
@ -300,9 +297,6 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
|
||||||
case ColorID::Menutext:
|
case ColorID::Menutext:
|
||||||
case ColorID::Infotext:
|
case ColorID::Infotext:
|
||||||
case ColorID::MozCellhighlighttext:
|
case ColorID::MozCellhighlighttext:
|
||||||
case ColorID::MozColheadertext:
|
|
||||||
case ColorID::MozColheaderhovertext:
|
|
||||||
case ColorID::MozColheaderactivetext:
|
|
||||||
case ColorID::MozSidebartext:
|
case ColorID::MozSidebartext:
|
||||||
color = GetColorFromNSColor(NSColor.controlTextColor);
|
color = GetColorFromNSColor(NSColor.controlTextColor);
|
||||||
break;
|
break;
|
||||||
|
|
@ -318,6 +312,17 @@ nsresult nsLookAndFeel::NativeGetColor(ColorID aID, ColorScheme aScheme,
|
||||||
// For inactive list selection
|
// For inactive list selection
|
||||||
color = GetColorFromNSColor(NSColor.secondarySelectedControlColor);
|
color = GetColorFromNSColor(NSColor.secondarySelectedControlColor);
|
||||||
break;
|
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:
|
case ColorID::MozEventreerow:
|
||||||
// Background color of even list rows.
|
// Background color of even list rows.
|
||||||
color =
|
color =
|
||||||
|
|
|
||||||
|
|
@ -40,8 +40,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
|
||||||
eSquareBezelPushButton,
|
eSquareBezelPushButton,
|
||||||
eArrowButton,
|
eArrowButton,
|
||||||
eHelpButton,
|
eHelpButton,
|
||||||
eTreeTwistyPointingRight,
|
|
||||||
eTreeTwistyPointingDown,
|
|
||||||
eDisclosureButtonClosed,
|
eDisclosureButtonClosed,
|
||||||
eDisclosureButtonOpen
|
eDisclosureButtonOpen
|
||||||
};
|
};
|
||||||
|
|
@ -131,12 +129,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
|
||||||
bool rtl = false;
|
bool rtl = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TreeHeaderCellParams {
|
|
||||||
ControlParams controlParams;
|
|
||||||
TreeSortDirection sortDirection = eTreeSortDirection_Natural;
|
|
||||||
bool lastTreeHeaderCell = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct ScaleParams {
|
struct ScaleParams {
|
||||||
int32_t value = 0;
|
int32_t value = 0;
|
||||||
int32_t min = 0;
|
int32_t min = 0;
|
||||||
|
|
@ -165,7 +157,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
|
||||||
eSearchField, // TextFieldParams
|
eSearchField, // TextFieldParams
|
||||||
eProgressBar, // ProgressParams
|
eProgressBar, // ProgressParams
|
||||||
eMeter, // MeterParams
|
eMeter, // MeterParams
|
||||||
eTreeHeaderCell, // TreeHeaderCellParams
|
|
||||||
eScale, // ScaleParams
|
eScale, // ScaleParams
|
||||||
eMultilineTextField, // bool
|
eMultilineTextField, // bool
|
||||||
eListBox,
|
eListBox,
|
||||||
|
|
@ -221,9 +212,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
|
||||||
static WidgetInfo Meter(const MeterParams& aParams) {
|
static WidgetInfo Meter(const MeterParams& aParams) {
|
||||||
return WidgetInfo(Widget::eMeter, aParams);
|
return WidgetInfo(Widget::eMeter, aParams);
|
||||||
}
|
}
|
||||||
static WidgetInfo TreeHeaderCell(const TreeHeaderCellParams& aParams) {
|
|
||||||
return WidgetInfo(Widget::eTreeHeaderCell, aParams);
|
|
||||||
}
|
|
||||||
static WidgetInfo Scale(const ScaleParams& aParams) {
|
static WidgetInfo Scale(const ScaleParams& aParams) {
|
||||||
return WidgetInfo(Widget::eScale, aParams);
|
return WidgetInfo(Widget::eScale, aParams);
|
||||||
}
|
}
|
||||||
|
|
@ -251,7 +239,7 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
|
||||||
mozilla::Variant<mozilla::gfx::sRGBColor, CheckboxOrRadioParams,
|
mozilla::Variant<mozilla::gfx::sRGBColor, CheckboxOrRadioParams,
|
||||||
ButtonParams, DropdownParams, SpinButtonParams,
|
ButtonParams, DropdownParams, SpinButtonParams,
|
||||||
SegmentParams, TextFieldParams, ProgressParams,
|
SegmentParams, TextFieldParams, ProgressParams,
|
||||||
MeterParams, TreeHeaderCellParams, ScaleParams, bool>
|
MeterParams, ScaleParams, bool>
|
||||||
mVariant;
|
mVariant;
|
||||||
|
|
||||||
enum Widget mWidget;
|
enum Widget mWidget;
|
||||||
|
|
@ -315,8 +303,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
|
||||||
ProgressParams ComputeProgressParams(nsIFrame*, mozilla::dom::ElementState,
|
ProgressParams ComputeProgressParams(nsIFrame*, mozilla::dom::ElementState,
|
||||||
bool aIsHorizontal);
|
bool aIsHorizontal);
|
||||||
MeterParams ComputeMeterParams(nsIFrame*);
|
MeterParams ComputeMeterParams(nsIFrame*);
|
||||||
TreeHeaderCellParams ComputeTreeHeaderCellParams(nsIFrame*,
|
|
||||||
mozilla::dom::ElementState);
|
|
||||||
mozilla::Maybe<ScaleParams> ComputeHTMLScaleParams(
|
mozilla::Maybe<ScaleParams> ComputeHTMLScaleParams(
|
||||||
nsIFrame*, mozilla::dom::ElementState);
|
nsIFrame*, mozilla::dom::ElementState);
|
||||||
|
|
||||||
|
|
@ -354,8 +340,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
|
||||||
const ControlParams& aParams);
|
const ControlParams& aParams);
|
||||||
void DrawButton(CGContextRef context, const HIRect& inBoxRect,
|
void DrawButton(CGContextRef context, const HIRect& inBoxRect,
|
||||||
const ButtonParams& aParams);
|
const ButtonParams& aParams);
|
||||||
void DrawTreeHeaderCell(CGContextRef context, const HIRect& inBoxRect,
|
|
||||||
const TreeHeaderCellParams& aParams);
|
|
||||||
void DrawDropdown(CGContextRef context, const HIRect& inBoxRect,
|
void DrawDropdown(CGContextRef context, const HIRect& inBoxRect,
|
||||||
const DropdownParams& aParams);
|
const DropdownParams& aParams);
|
||||||
HIThemeButtonDrawInfo SpinButtonDrawInfo(ThemeButtonKind aKind,
|
HIThemeButtonDrawInfo SpinButtonDrawInfo(ThemeButtonKind aKind,
|
||||||
|
|
@ -387,7 +371,6 @@ class nsNativeThemeCocoa : public mozilla::widget::ThemeCocoa {
|
||||||
NSComboBoxCell* mComboBoxCell;
|
NSComboBoxCell* mComboBoxCell;
|
||||||
NSProgressBarCell* mProgressBarCell;
|
NSProgressBarCell* mProgressBarCell;
|
||||||
NSLevelIndicatorCell* mMeterBarCell;
|
NSLevelIndicatorCell* mMeterBarCell;
|
||||||
NSTableHeaderCell* mTreeHeaderCell;
|
|
||||||
MOZCellDrawWindow* mCellDrawWindow = nil;
|
MOZCellDrawWindow* mCellDrawWindow = nil;
|
||||||
MOZCellDrawView* mCellDrawView;
|
MOZCellDrawView* mCellDrawView;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -458,8 +458,6 @@ nsNativeThemeCocoa::nsNativeThemeCocoa() : ThemeCocoa(ScrollbarStyle()) {
|
||||||
mMeterBarCell = [[NSLevelIndicatorCell alloc]
|
mMeterBarCell = [[NSLevelIndicatorCell alloc]
|
||||||
initWithLevelIndicatorStyle:NSLevelIndicatorStyleContinuousCapacity];
|
initWithLevelIndicatorStyle:NSLevelIndicatorStyleContinuousCapacity];
|
||||||
|
|
||||||
mTreeHeaderCell = [[NSTableHeaderCell alloc] init];
|
|
||||||
|
|
||||||
mCellDrawView = [[MOZCellDrawView alloc] init];
|
mCellDrawView = [[MOZCellDrawView alloc] init];
|
||||||
|
|
||||||
if (XRE_IsParentProcess()) {
|
if (XRE_IsParentProcess()) {
|
||||||
|
|
@ -498,7 +496,6 @@ nsNativeThemeCocoa::~nsNativeThemeCocoa() {
|
||||||
[mSearchFieldCell release];
|
[mSearchFieldCell release];
|
||||||
[mDropdownCell release];
|
[mDropdownCell release];
|
||||||
[mComboBoxCell release];
|
[mComboBoxCell release];
|
||||||
[mTreeHeaderCell release];
|
|
||||||
[mCellDrawWindow release];
|
[mCellDrawWindow release];
|
||||||
[mCellDrawView release];
|
[mCellDrawView release];
|
||||||
|
|
||||||
|
|
@ -1317,17 +1314,6 @@ static void RenderButton(CGContextRef cgContext, const HIRect& aRenderRect,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ThemeDrawState ToThemeDrawState(
|
|
||||||
const nsNativeThemeCocoa::ControlParams& aParams) {
|
|
||||||
if (aParams.disabled) {
|
|
||||||
return kThemeStateUnavailable;
|
|
||||||
}
|
|
||||||
if (aParams.pressed) {
|
|
||||||
return kThemeStatePressed;
|
|
||||||
}
|
|
||||||
return kThemeStateActive;
|
|
||||||
}
|
|
||||||
|
|
||||||
void nsNativeThemeCocoa::DrawHIThemeButton(
|
void nsNativeThemeCocoa::DrawHIThemeButton(
|
||||||
CGContextRef cgContext, const HIRect& aRect, ThemeButtonKind aKind,
|
CGContextRef cgContext, const HIRect& aRect, ThemeButtonKind aKind,
|
||||||
ThemeButtonValue aValue, ThemeDrawState aState,
|
ThemeButtonValue aValue, ThemeDrawState aState,
|
||||||
|
|
@ -1377,16 +1363,6 @@ void nsNativeThemeCocoa::DrawButton(CGContextRef cgContext,
|
||||||
case ButtonType::eHelpButton:
|
case ButtonType::eHelpButton:
|
||||||
DrawHelpButton(cgContext, inBoxRect, controlParams);
|
DrawHelpButton(cgContext, inBoxRect, controlParams);
|
||||||
return;
|
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:
|
case ButtonType::eDisclosureButtonClosed:
|
||||||
DrawDisclosureButton(cgContext, inBoxRect, controlParams,
|
DrawDisclosureButton(cgContext, inBoxRect, controlParams,
|
||||||
NSControlStateValueOff);
|
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 = {
|
static const CellRenderSettings dropdownSettings = {
|
||||||
{
|
{
|
||||||
NSMakeSize(0, 16), // mini
|
NSMakeSize(0, 16), // mini
|
||||||
|
|
@ -2348,30 +2243,6 @@ Maybe<nsNativeThemeCocoa::WidgetInfo> nsNativeThemeCocoa::ComputeWidgetInfo(
|
||||||
// Do nothing: progress and meter bars cases will draw chunks.
|
// Do nothing: progress and meter bars cases will draw chunks.
|
||||||
break;
|
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: {
|
case StyleAppearance::Range: {
|
||||||
Maybe<ScaleParams> params = ComputeHTMLScaleParams(aFrame, elementState);
|
Maybe<ScaleParams> params = ComputeHTMLScaleParams(aFrame, elementState);
|
||||||
if (params) {
|
if (params) {
|
||||||
|
|
@ -2581,12 +2452,6 @@ void nsNativeThemeCocoa::RenderWidget(const WidgetInfo& aWidgetInfo,
|
||||||
DrawMeter(cgContext, macRect, params);
|
DrawMeter(cgContext, macRect, params);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Widget::eTreeHeaderCell: {
|
|
||||||
TreeHeaderCellParams params =
|
|
||||||
aWidgetInfo.Params<TreeHeaderCellParams>();
|
|
||||||
DrawTreeHeaderCell(cgContext, macRect, params);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case Widget::eScale: {
|
case Widget::eScale: {
|
||||||
ScaleParams params = aWidgetInfo.Params<ScaleParams>();
|
ScaleParams params = aWidgetInfo.Params<ScaleParams>();
|
||||||
DrawScale(cgContext, macRect, params);
|
DrawScale(cgContext, macRect, params);
|
||||||
|
|
@ -2672,11 +2537,6 @@ bool nsNativeThemeCocoa::CreateWebRenderCommandsForWidget(
|
||||||
case StyleAppearance::Searchfield:
|
case StyleAppearance::Searchfield:
|
||||||
case StyleAppearance::ProgressBar:
|
case StyleAppearance::ProgressBar:
|
||||||
case StyleAppearance::Meter:
|
case StyleAppearance::Meter:
|
||||||
case StyleAppearance::Treeheadercell:
|
|
||||||
case StyleAppearance::Treetwisty:
|
|
||||||
case StyleAppearance::Treetwistyopen:
|
|
||||||
case StyleAppearance::Treeitem:
|
|
||||||
case StyleAppearance::Treeview:
|
|
||||||
case StyleAppearance::Range:
|
case StyleAppearance::Range:
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|
@ -2989,23 +2849,6 @@ LayoutDeviceIntSize nsNativeThemeCocoa::GetMinimumWidgetSize(
|
||||||
break;
|
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: {
|
case StyleAppearance::Tab: {
|
||||||
result.SizeTo(0, tabHeights[miniControlSize]);
|
result.SizeTo(0, tabHeights[miniControlSize]);
|
||||||
break;
|
break;
|
||||||
|
|
@ -3145,14 +2988,6 @@ bool nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||||
case StyleAppearance::Tabpanels:
|
case StyleAppearance::Tabpanels:
|
||||||
case StyleAppearance::Tab:
|
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:
|
case StyleAppearance::Range:
|
||||||
return !IsWidgetStyled(aPresContext, aFrame, aAppearance);
|
return !IsWidgetStyled(aPresContext, aFrame, aAppearance);
|
||||||
|
|
||||||
|
|
@ -3220,8 +3055,6 @@ bool nsNativeThemeCocoa::WidgetAppearanceDependsOnWindowFocus(
|
||||||
case StyleAppearance::NumberInput:
|
case StyleAppearance::NumberInput:
|
||||||
case StyleAppearance::PasswordInput:
|
case StyleAppearance::PasswordInput:
|
||||||
case StyleAppearance::Textfield:
|
case StyleAppearance::Textfield:
|
||||||
case StyleAppearance::Treeview:
|
|
||||||
case StyleAppearance::Treeline:
|
|
||||||
case StyleAppearance::Textarea:
|
case StyleAppearance::Textarea:
|
||||||
case StyleAppearance::Listbox:
|
case StyleAppearance::Listbox:
|
||||||
return false;
|
return false;
|
||||||
|
|
|
||||||
|
|
@ -1079,11 +1079,6 @@ static GtkStyleContext* GetCssNodeStyleInternal(WidgetNodeType aNodeType) {
|
||||||
// TODO - create from CSS node
|
// TODO - create from CSS node
|
||||||
style = CreateSubStyleWithClass(MOZ_GTK_TREEVIEW, GTK_STYLE_CLASS_VIEW);
|
style = CreateSubStyleWithClass(MOZ_GTK_TREEVIEW, GTK_STYLE_CLASS_VIEW);
|
||||||
break;
|
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:
|
case MOZ_GTK_SPLITTER_SEPARATOR_HORIZONTAL:
|
||||||
style = CreateChildCSSNode("separator", MOZ_GTK_SPLITTER_HORIZONTAL);
|
style = CreateChildCSSNode("separator", MOZ_GTK_SPLITTER_HORIZONTAL);
|
||||||
break;
|
break;
|
||||||
|
|
@ -1218,10 +1213,6 @@ static GtkStyleContext* GetWidgetStyleInternal(WidgetNodeType aNodeType) {
|
||||||
case MOZ_GTK_TREEVIEW_VIEW:
|
case MOZ_GTK_TREEVIEW_VIEW:
|
||||||
style = CreateSubStyleWithClass(MOZ_GTK_TREEVIEW, GTK_STYLE_CLASS_VIEW);
|
style = CreateSubStyleWithClass(MOZ_GTK_TREEVIEW, GTK_STYLE_CLASS_VIEW);
|
||||||
break;
|
break;
|
||||||
case MOZ_GTK_TREEVIEW_EXPANDER:
|
|
||||||
style =
|
|
||||||
CreateSubStyleWithClass(MOZ_GTK_TREEVIEW, GTK_STYLE_CLASS_EXPANDER);
|
|
||||||
break;
|
|
||||||
case MOZ_GTK_SPLITTER_SEPARATOR_HORIZONTAL:
|
case MOZ_GTK_SPLITTER_SEPARATOR_HORIZONTAL:
|
||||||
style = CreateSubStyleWithClass(MOZ_GTK_SPLITTER_HORIZONTAL,
|
style = CreateSubStyleWithClass(MOZ_GTK_SPLITTER_HORIZONTAL,
|
||||||
GTK_STYLE_CLASS_PANE_SEPARATOR);
|
GTK_STYLE_CLASS_PANE_SEPARATOR);
|
||||||
|
|
|
||||||
|
|
@ -953,54 +953,7 @@ static gint moz_gtk_treeview_paint(cairo_t* cr, GdkRectangle* rect,
|
||||||
return MOZ_GTK_SUCCESS;
|
return MOZ_GTK_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gint moz_gtk_tree_header_cell_paint(cairo_t* cr,
|
/* See gtk_separator_draw() for reference. */
|
||||||
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.
|
|
||||||
*/
|
|
||||||
static gint moz_gtk_combo_box_paint(cairo_t* cr, const GdkRectangle* aRect,
|
static gint moz_gtk_combo_box_paint(cairo_t* cr, const GdkRectangle* aRect,
|
||||||
GtkWidgetState* state,
|
GtkWidgetState* state,
|
||||||
GtkTextDirection direction) {
|
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);
|
moz_gtk_add_style_border(style, left, top, right, bottom);
|
||||||
return MOZ_GTK_SUCCESS;
|
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: {
|
case MOZ_GTK_DROPDOWN: {
|
||||||
/* We need to account for the arrow on the dropdown, so text
|
/* 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
|
* 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:
|
||||||
case MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE:
|
case MOZ_GTK_PROGRESS_CHUNK_INDETERMINATE:
|
||||||
case MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE:
|
case MOZ_GTK_PROGRESS_CHUNK_VERTICAL_INDETERMINATE:
|
||||||
case MOZ_GTK_TREEVIEW_EXPANDER:
|
|
||||||
case MOZ_GTK_HEADER_BAR:
|
case MOZ_GTK_HEADER_BAR:
|
||||||
case MOZ_GTK_HEADER_BAR_MAXIMIZED:
|
case MOZ_GTK_HEADER_BAR_MAXIMIZED:
|
||||||
case MOZ_GTK_HEADER_BAR_BUTTON_CLOSE:
|
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,
|
void moz_gtk_get_entry_min_height(gint* min_content_height,
|
||||||
gint* border_padding_height) {
|
gint* border_padding_height) {
|
||||||
GtkStyleContext* style = GetStyleContext(MOZ_GTK_ENTRY);
|
GtkStyleContext* style = GetStyleContext(MOZ_GTK_ENTRY);
|
||||||
|
|
@ -2073,11 +2001,6 @@ gint moz_gtk_widget_paint(WidgetNodeType widget, cairo_t* cr,
|
||||||
}
|
}
|
||||||
case MOZ_GTK_TREEVIEW:
|
case MOZ_GTK_TREEVIEW:
|
||||||
return moz_gtk_treeview_paint(cr, rect, state, direction);
|
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_ENTRY:
|
||||||
case MOZ_GTK_DROPDOWN_ENTRY: {
|
case MOZ_GTK_DROPDOWN_ENTRY: {
|
||||||
GtkStyleContext* style =
|
GtkStyleContext* style =
|
||||||
|
|
|
||||||
|
|
@ -212,8 +212,6 @@ enum WidgetNodeType : int {
|
||||||
MOZ_GTK_TREEVIEW_VIEW,
|
MOZ_GTK_TREEVIEW_VIEW,
|
||||||
/* Paints treeheader cells */
|
/* Paints treeheader cells */
|
||||||
MOZ_GTK_TREE_HEADER_CELL,
|
MOZ_GTK_TREE_HEADER_CELL,
|
||||||
/* Paints an expander for a GtkTreeView */
|
|
||||||
MOZ_GTK_TREEVIEW_EXPANDER,
|
|
||||||
/* Paints the background of menus, context menus. */
|
/* Paints the background of menus, context menus. */
|
||||||
MOZ_GTK_MENUPOPUP,
|
MOZ_GTK_MENUPOPUP,
|
||||||
/* Menubar for -moz-headerbar colors */
|
/* 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);
|
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
|
* Get the desired size of a splitter
|
||||||
* orientation: [IN] GTK_ORIENTATION_HORIZONTAL or GTK_ORIENTATION_VERTICAL
|
* orientation: [IN] GTK_ORIENTATION_HORIZONTAL or GTK_ORIENTATION_VERTICAL
|
||||||
|
|
|
||||||
|
|
@ -195,14 +195,6 @@ bool nsNativeThemeGTK::GetGtkWidgetAndState(StyleAppearance aAppearance,
|
||||||
aAppearance == StyleAppearance::Menulist ||
|
aAppearance == StyleAppearance::Menulist ||
|
||||||
aAppearance == StyleAppearance::MenulistButton) {
|
aAppearance == StyleAppearance::MenulistButton) {
|
||||||
aState->active &= aState->inHover;
|
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)) {
|
if (IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XUL)) {
|
||||||
|
|
@ -300,17 +292,8 @@ bool nsNativeThemeGTK::GetGtkWidgetAndState(StyleAppearance aAppearance,
|
||||||
aGtkWidgetType = MOZ_GTK_TEXT_VIEW;
|
aGtkWidgetType = MOZ_GTK_TEXT_VIEW;
|
||||||
break;
|
break;
|
||||||
case StyleAppearance::Listbox:
|
case StyleAppearance::Listbox:
|
||||||
case StyleAppearance::Treeview:
|
|
||||||
aGtkWidgetType = MOZ_GTK_TREEVIEW;
|
aGtkWidgetType = MOZ_GTK_TREEVIEW;
|
||||||
break;
|
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::MenulistButton:
|
||||||
case StyleAppearance::Menulist:
|
case StyleAppearance::Menulist:
|
||||||
aGtkWidgetType = MOZ_GTK_DROPDOWN;
|
aGtkWidgetType = MOZ_GTK_DROPDOWN;
|
||||||
|
|
@ -1137,12 +1120,6 @@ LayoutDeviceIntSize nsNativeThemeGTK::GetMinimumWidgetSize(
|
||||||
result.width = 14;
|
result.width = 14;
|
||||||
result.height = 13;
|
result.height = 13;
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1245,12 +1222,6 @@ nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
|
||||||
case StyleAppearance::ButtonArrowNext:
|
case StyleAppearance::ButtonArrowNext:
|
||||||
case StyleAppearance::ButtonArrowPrevious:
|
case StyleAppearance::ButtonArrowPrevious:
|
||||||
case StyleAppearance::Listbox:
|
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::ProgressBar:
|
||||||
case StyleAppearance::Progresschunk:
|
case StyleAppearance::Progresschunk:
|
||||||
case StyleAppearance::Tab:
|
case StyleAppearance::Tab:
|
||||||
|
|
|
||||||
|
|
@ -501,12 +501,7 @@ mozilla::Maybe<nsUXThemeClass> nsNativeThemeWin::GetThemeClass(
|
||||||
case StyleAppearance::Menulist:
|
case StyleAppearance::Menulist:
|
||||||
case StyleAppearance::MenulistButton:
|
case StyleAppearance::MenulistButton:
|
||||||
return Some(eUXCombobox);
|
return Some(eUXCombobox);
|
||||||
case StyleAppearance::Treeheadercell:
|
|
||||||
return Some(eUXHeader);
|
|
||||||
case StyleAppearance::Listbox:
|
case StyleAppearance::Listbox:
|
||||||
case StyleAppearance::Treeview:
|
|
||||||
case StyleAppearance::Treetwistyopen:
|
|
||||||
case StyleAppearance::Treeitem:
|
|
||||||
return Some(eUXListview);
|
return Some(eUXListview);
|
||||||
default:
|
default:
|
||||||
return Nothing();
|
return Nothing();
|
||||||
|
|
@ -718,7 +713,6 @@ nsresult nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame,
|
||||||
}
|
}
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
case StyleAppearance::Treeview:
|
|
||||||
case StyleAppearance::Listbox: {
|
case StyleAppearance::Listbox: {
|
||||||
aPart = TREEVIEW_BODY;
|
aPart = TREEVIEW_BODY;
|
||||||
aState = TS_NORMAL;
|
aState = TS_NORMAL;
|
||||||
|
|
@ -755,17 +749,6 @@ nsresult nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame,
|
||||||
|
|
||||||
return NS_OK;
|
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::MenulistButton:
|
||||||
case StyleAppearance::Menulist: {
|
case StyleAppearance::Menulist: {
|
||||||
nsIContent* content = aFrame->GetContent();
|
nsIContent* content = aFrame->GetContent();
|
||||||
|
|
@ -1247,7 +1230,6 @@ LayoutDeviceIntSize nsNativeThemeWin::GetMinimumWidgetSize(
|
||||||
case StyleAppearance::Tabpanels:
|
case StyleAppearance::Tabpanels:
|
||||||
case StyleAppearance::Tabpanel:
|
case StyleAppearance::Tabpanel:
|
||||||
case StyleAppearance::Listbox:
|
case StyleAppearance::Listbox:
|
||||||
case StyleAppearance::Treeview:
|
|
||||||
return {}; // Don't worry about it.
|
return {}; // Don't worry about it.
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -1453,7 +1435,6 @@ bool nsNativeThemeWin::ClassicThemeSupportsWidget(nsIFrame* aFrame,
|
||||||
case StyleAppearance::Menulist:
|
case StyleAppearance::Menulist:
|
||||||
case StyleAppearance::MenulistButton:
|
case StyleAppearance::MenulistButton:
|
||||||
case StyleAppearance::Listbox:
|
case StyleAppearance::Listbox:
|
||||||
case StyleAppearance::Treeview:
|
|
||||||
case StyleAppearance::ProgressBar:
|
case StyleAppearance::ProgressBar:
|
||||||
case StyleAppearance::Progresschunk:
|
case StyleAppearance::Progresschunk:
|
||||||
case StyleAppearance::Tab:
|
case StyleAppearance::Tab:
|
||||||
|
|
@ -1473,7 +1454,6 @@ LayoutDeviceIntMargin nsNativeThemeWin::ClassicGetWidgetBorder(
|
||||||
result.top = result.left = result.bottom = result.right = 2;
|
result.top = result.left = result.bottom = result.right = 2;
|
||||||
break;
|
break;
|
||||||
case StyleAppearance::Listbox:
|
case StyleAppearance::Listbox:
|
||||||
case StyleAppearance::Treeview:
|
|
||||||
case StyleAppearance::Menulist:
|
case StyleAppearance::Menulist:
|
||||||
case StyleAppearance::MenulistButton:
|
case StyleAppearance::MenulistButton:
|
||||||
case StyleAppearance::Tab:
|
case StyleAppearance::Tab:
|
||||||
|
|
@ -1525,7 +1505,6 @@ LayoutDeviceIntSize nsNativeThemeWin::ClassicGetMinimumWidgetSize(
|
||||||
case StyleAppearance::MenulistButton:
|
case StyleAppearance::MenulistButton:
|
||||||
case StyleAppearance::Button:
|
case StyleAppearance::Button:
|
||||||
case StyleAppearance::Listbox:
|
case StyleAppearance::Listbox:
|
||||||
case StyleAppearance::Treeview:
|
|
||||||
case StyleAppearance::NumberInput:
|
case StyleAppearance::NumberInput:
|
||||||
case StyleAppearance::PasswordInput:
|
case StyleAppearance::PasswordInput:
|
||||||
case StyleAppearance::Textfield:
|
case StyleAppearance::Textfield:
|
||||||
|
|
@ -1584,7 +1563,6 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
case StyleAppearance::Listbox:
|
case StyleAppearance::Listbox:
|
||||||
case StyleAppearance::Treeview:
|
|
||||||
case StyleAppearance::NumberInput:
|
case StyleAppearance::NumberInput:
|
||||||
case StyleAppearance::PasswordInput:
|
case StyleAppearance::PasswordInput:
|
||||||
case StyleAppearance::Textfield:
|
case StyleAppearance::Textfield:
|
||||||
|
|
@ -1799,15 +1777,6 @@ RENDER_AGAIN:
|
||||||
|
|
||||||
break;
|
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
|
// Draw 3D face background controls
|
||||||
case StyleAppearance::ProgressBar:
|
case StyleAppearance::ProgressBar:
|
||||||
// Draw 3D border
|
// Draw 3D border
|
||||||
|
|
|
||||||
|
|
@ -72,8 +72,6 @@ const wchar_t* nsUXThemeData::GetClassName(nsUXThemeClass cls) {
|
||||||
return L"Trackbar";
|
return L"Trackbar";
|
||||||
case eUXCombobox:
|
case eUXCombobox:
|
||||||
return L"Combobox";
|
return L"Combobox";
|
||||||
case eUXHeader:
|
|
||||||
return L"Header";
|
|
||||||
case eUXListview:
|
case eUXListview:
|
||||||
return L"Listview";
|
return L"Listview";
|
||||||
case eUXMenu:
|
case eUXMenu:
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,6 @@ enum nsUXThemeClass {
|
||||||
eUXTab,
|
eUXTab,
|
||||||
eUXTrackbar,
|
eUXTrackbar,
|
||||||
eUXCombobox,
|
eUXCombobox,
|
||||||
eUXHeader,
|
|
||||||
eUXListview,
|
eUXListview,
|
||||||
eUXMenu,
|
eUXMenu,
|
||||||
eUXNumClasses
|
eUXNumClasses
|
||||||
|
|
|
||||||
|
|
@ -450,6 +450,7 @@ STATIC_ATOMS = [
|
||||||
Atom("figcaption", "figcaption"),
|
Atom("figcaption", "figcaption"),
|
||||||
Atom("figure", "figure"),
|
Atom("figure", "figure"),
|
||||||
Atom("findbar", "findbar"),
|
Atom("findbar", "findbar"),
|
||||||
|
Atom("firstColumn", "first-column"),
|
||||||
Atom("firstInput", "first-input"),
|
Atom("firstInput", "first-input"),
|
||||||
Atom("fixed", "fixed"),
|
Atom("fixed", "fixed"),
|
||||||
Atom("flags", "flags"),
|
Atom("flags", "flags"),
|
||||||
|
|
@ -971,6 +972,7 @@ STATIC_ATOMS = [
|
||||||
Atom("option", "option"),
|
Atom("option", "option"),
|
||||||
Atom("_or", "or"),
|
Atom("_or", "or"),
|
||||||
Atom("order", "order"),
|
Atom("order", "order"),
|
||||||
|
Atom("ordinal", "ordinal"),
|
||||||
Atom("orient", "orient"),
|
Atom("orient", "orient"),
|
||||||
Atom("orientation", "orientation"),
|
Atom("orientation", "orientation"),
|
||||||
Atom("origin_trial", "origin-trial"),
|
Atom("origin_trial", "origin-trial"),
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue