зеркало из https://github.com/mozilla/pjs.git
Bug 465402 - Tree header cells shouldn't draw borders around them, only between each other. r+sr=roc, a191=beltzner
This commit is contained in:
Родитель
73f42535f6
Коммит
7a424bea98
|
@ -719,6 +719,18 @@ nsNativeThemeCocoa::DrawButton(CGContextRef cgContext, ThemeButtonKind inKind,
|
|||
// leave things alone on Tiger
|
||||
drawFrame.size.height -= 1;
|
||||
}
|
||||
} else if (inKind == kThemeListHeaderButton) {
|
||||
CGContextClipToRect(cgContext, inBoxRect);
|
||||
// Always remove the top border.
|
||||
drawFrame.origin.y -= 1;
|
||||
drawFrame.size.height += 1;
|
||||
// Remove the left border in LTR mode and the right border in RTL mode.
|
||||
drawFrame.size.width += 1;
|
||||
PRBool isLast = IsLastTreeHeaderCell(aFrame);
|
||||
if (isLast)
|
||||
drawFrame.size.width += 1; // Also remove the other border.
|
||||
if (!IsFrameRTL(aFrame) || isLast)
|
||||
drawFrame.origin.x -= 1;
|
||||
}
|
||||
|
||||
if (!needsScaling) {
|
||||
|
@ -1461,7 +1473,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
|
|||
TreeSortDirection sortDirection = GetTreeSortDirection(aFrame);
|
||||
DrawButton(cgContext, kThemeListHeaderButton, macRect, PR_FALSE, IsDisabled(aFrame),
|
||||
sortDirection == eTreeSortDirection_Natural ? kThemeButtonOff : kThemeButtonOn,
|
||||
sortDirection == eTreeSortDirection_Descending ?
|
||||
sortDirection == eTreeSortDirection_Ascending ?
|
||||
kThemeAdornmentHeaderButtonSortUp : kThemeAdornmentNone, eventState, aFrame);
|
||||
}
|
||||
break;
|
||||
|
@ -1817,7 +1829,7 @@ nsNativeThemeCocoa::GetMinimumWidgetSize(nsIRenderingContext* aContext,
|
|||
{
|
||||
SInt32 headerHeight = 0;
|
||||
::GetThemeMetric(kThemeMetricListHeaderHeight, &headerHeight);
|
||||
aResult->SizeTo(0, headerHeight);
|
||||
aResult->SizeTo(0, headerHeight - 1); // We don't need the top border.
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -168,11 +168,6 @@ static SIZE GetGutterSize(HANDLE theme, HDC hdc)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static inline PRBool IsFrameRTL(nsIFrame *frame)
|
||||
{
|
||||
return frame->GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
}
|
||||
|
||||
static HRESULT DrawThemeBGRTLAware(HANDLE theme, HDC hdc, int part, int state,
|
||||
const RECT *widgetRect, const RECT *clipRect,
|
||||
PRBool isRTL)
|
||||
|
|
|
@ -169,6 +169,12 @@ nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext, nsIFrame* aFrame,
|
|||
NS_AUTHOR_SPECIFIED_BACKGROUND);
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsNativeTheme::IsFrameRTL(nsIFrame* aFrame)
|
||||
{
|
||||
return aFrame && aFrame->GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_RTL;
|
||||
}
|
||||
|
||||
// scrollbar button:
|
||||
PRInt32
|
||||
nsNativeTheme::GetScrollbarButtonType(nsIFrame* aFrame)
|
||||
|
@ -212,6 +218,34 @@ nsNativeTheme::GetTreeSortDirection(nsIFrame* aFrame)
|
|||
return eTreeSortDirection_Natural;
|
||||
}
|
||||
|
||||
PRBool
|
||||
nsNativeTheme::IsLastTreeHeaderCell(nsIFrame* aFrame)
|
||||
{
|
||||
if (!aFrame)
|
||||
return PR_FALSE;
|
||||
|
||||
// A tree column picker is always the last header cell.
|
||||
if (aFrame->GetContent()->Tag() == nsWidgetAtoms::treecolpicker)
|
||||
return PR_TRUE;
|
||||
|
||||
// Find the parent tree.
|
||||
nsIContent* parent = aFrame->GetContent()->GetParent();
|
||||
while (parent && parent->Tag() != nsWidgetAtoms::tree) {
|
||||
parent = parent->GetParent();
|
||||
}
|
||||
|
||||
// If the column picker is visible, this can't be the last column.
|
||||
if (parent && !parent->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::hidecolumnpicker,
|
||||
NS_LITERAL_STRING("true"), eCaseMatters))
|
||||
return PR_FALSE;
|
||||
|
||||
while ((aFrame = aFrame->GetNextSibling())) {
|
||||
if (aFrame->GetRect().width > 0)
|
||||
return PR_FALSE;
|
||||
}
|
||||
return PR_TRUE;
|
||||
}
|
||||
|
||||
// tab:
|
||||
PRBool
|
||||
nsNativeTheme::IsBottomTab(nsIFrame* aFrame)
|
||||
|
|
|
@ -85,6 +85,9 @@ class nsNativeTheme
|
|||
return CheckBooleanAttr(aFrame, nsWidgetAtoms::disabled);
|
||||
}
|
||||
|
||||
// RTL chrome direction
|
||||
PRBool IsFrameRTL(nsIFrame* aFrame);
|
||||
|
||||
// button:
|
||||
PRBool IsDefaultButton(nsIFrame* aFrame) {
|
||||
return CheckBooleanAttr(aFrame, nsWidgetAtoms::_default);
|
||||
|
@ -119,6 +122,7 @@ class nsNativeTheme
|
|||
|
||||
// treeheadercell:
|
||||
TreeSortDirection GetTreeSortDirection(nsIFrame* aFrame);
|
||||
PRBool IsLastTreeHeaderCell(nsIFrame* aFrame);
|
||||
|
||||
// tab:
|
||||
PRBool IsBottomTab(nsIFrame* aFrame);
|
||||
|
|
|
@ -77,6 +77,7 @@ WIDGET_ATOM(focused, "focused")
|
|||
WIDGET_ATOM(Forward, "Forward")
|
||||
WIDGET_ATOM(Home, "Home")
|
||||
WIDGET_ATOM(hidden, "hidden")
|
||||
WIDGET_ATOM(hidecolumnpicker, "hidecolumnpicker")
|
||||
WIDGET_ATOM(horizontal, "horizontal")
|
||||
WIDGET_ATOM(vertical, "vertical")
|
||||
WIDGET_ATOM(id, "id")
|
||||
|
@ -118,6 +119,8 @@ WIDGET_ATOM(state, "state")
|
|||
WIDGET_ATOM(step, "step")
|
||||
WIDGET_ATOM(Stop, "Stop")
|
||||
WIDGET_ATOM(_true, "true")
|
||||
WIDGET_ATOM(tree, "tree")
|
||||
WIDGET_ATOM(treecolpicker, "treecolpicker")
|
||||
WIDGET_ATOM(type, "type")
|
||||
WIDGET_ATOM(value, "value")
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче