Merge to tip for mstrange's bugs

This commit is contained in:
Shawn Wilsher 2008-11-27 18:28:30 -08:00
commit f061f023fb
14 changed files with 368 additions and 181 deletions

View File

@ -1015,23 +1015,23 @@ richlistitem[selected="true"][current="true"] > hbox > .ac-result-type-bookmark,
#editBookmarkPanel {
-moz-appearance: none;
background-color: rgba(68,68,68,0.9);
border: 1px solid rgba(255,255,255,0.15);
-moz-border-radius: 8px;
-moz-border-radius-topright: 0px ;
padding: 10px 8px 6px 8px;
margin-top: 4px;
-moz-window-shadow: none;
-moz-border-image: url(chrome://browser/skin/hud-panel.png) 26 50 22 18 / 26px 50px 22px 18px repeat;
margin-right: 27px;
margin-top: 1px;
padding-top: 8px;
color: #ffffff;
}
#editBookmarkPanelTitle {
font-size: 130%;
font-weight: bold;
margin: 8px 12px 0px 9px;
margin: 2px 12px 0px 9px;
}
#editBookmarkPanel > hbox {
-moz-padding-end: 1px;
#editBookmarkPanel > hbox,
#editBookmarkPanel > vbox {
margin-right: -30px;
}
/**** HUD style buttons ****/
@ -1519,6 +1519,10 @@ toolbarbutton.chevron > .toolbarbutton-menu-dropmarker {
/* ::::: tabbrowser ::::: */
tabbrowser > tabbox {
margin: 0;
}
.tab-icon-image {
width: 16px;
height: 16px;
@ -2089,22 +2093,24 @@ tabpanels.plain {
/* Popup Bounding Box */
#identity-popup {
-moz-appearance: none;
background-color: rgba(68,68,68,0.9);
border: 1px solid rgba(255,255,255,0.15);
-moz-border-radius: 8px;
-moz-border-radius-topleft: 0px;
padding: 10px 8px 6px 8px;
margin-top: -3px;
-moz-margin-start: 11px;
color: #ffffff;
-moz-window-shadow: none;
background-color: transparent;
margin-top: -4px;
margin-left: -13px;
min-width: 280px;
-moz-border-image: url(chrome://browser/skin/hud-panel.png) 26 18 22 50 / 26px 18px 22px 50px repeat;
}
#identity-popup-container {
-moz-appearance: none;
margin: 4px 3px 2px -30px;
color: #ffffff;
}
#identity-popup-content-box {
margin-top: 4px;
}
/* Popup Buttons */
#identity-popup-more-info-button {
-moz-appearance: none;
@ -2116,7 +2122,7 @@ tabpanels.plain {
-moz-border-left-colors: rgba(0,0,0,0.35) rgba(26,26,26,0.5) rgba(255,255,255,0.4);
-moz-border-radius: 20px;
padding: 1px 9px;
margin: 6px;
margin: 10px 0 0;
min-height: 0px;
color: #ffffff;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -16,6 +16,7 @@ classic.jar:
skin/classic/browser/find-bar-background.png
skin/classic/browser/Go-arrow.png
skin/classic/browser/home.png
skin/classic/browser/hud-panel.png
skin/classic/browser/hud-style-button-middle-background.png
skin/classic/browser/hud-style-check-box-checked.png
skin/classic/browser/hud-style-check-box-empty.png

View File

@ -218,6 +218,10 @@ prefpane .groupbox-title {
margin-bottom: 4px;
}
tabpanels {
padding: 20px 7px 7px;
}
caption {
border-bottom: 1px solid #ECECEC;
padding: 4px 4px 0px 0px !important;

View File

@ -297,6 +297,23 @@ description {
-moz-user-focus: ignore !important;
}
notification > button {
-moz-appearance: none;
background: url("chrome://global/skin/icons/white-gray-gradient.gif") transparent repeat-x center center;
-moz-background-clip: padding;
border: 1px solid rgba(0, 0, 0, 0.5);
-moz-border-radius: 10px;
-moz-box-shadow: rgba(255, 255, 255, 0.4) 0 1px 0;
padding: 0 5px;
margin: 0 3px;
min-width: 79px;
min-height: 16px;
}
notification > button:hover:active {
background-image: url("chrome://global/skin/icons/white-gray-gradient-active.gif");
}
/* ::::: XXX - stuff that should live elsewhere ::::: */
/* embedding/components/ui/progressDlg/nsProgressDialog.xul */

View File

@ -1,7 +1,7 @@
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
notification {
min-height: 24px;
padding: 4px 3px 5px;
}
notification[type="info"] {
@ -28,7 +28,7 @@ notification[type="critical"] {
.messageImage {
width: 16px;
height: 16px;
margin: 0px 1px 0px 6px;
margin: 0 4px;
}
/* Default icons for notifications */
@ -45,39 +45,20 @@ notification[type="critical"] .messageImage {
list-style-image: url("chrome://global/skin/icons/error-16.png");
}
.messageText {
margin-top: 2px;
font-weight: bold;
-moz-margin-start: 5px;
}
button {
-moz-appearance: none;
background: url("chrome://global/skin/icons/white-gray-gradient.gif") transparent repeat-x center center;
-moz-background-clip: padding;
border: 1px solid;
border-bottom-width: 2px;
-moz-border-radius: 10px;
-moz-border-top-colors: rgba(0,0,0,0.5);
-moz-border-right-colors: rgba(0,0,0,0.5);
-moz-border-bottom-colors: rgba(255,255,255,0.35) rgba(0,0,0,0.5);
-moz-border-left-colors: rgba(0,0,0,0.5);
padding: 0 5px;
min-width: 79px;
min-height: 17px;
}
button:hover:active {
background-image: url("chrome://global/skin/icons/white-gray-gradient-active.gif");
}
.notification-inner {
border: 0 !important;
}
.messageText {
margin: 0 3px !important;
padding: 0;
font-weight: bold;
}
.messageCloseButton {
-moz-appearance: none;
-moz-padding-end: 4px;
padding: 0;
margin: 0 2px;
list-style-image: url("chrome://global/skin/icons/closetab.png") !important;
border: none;
}
@ -86,6 +67,10 @@ button:hover:active {
display: none;
}
.messageCloseButton > .toolbarbutton-icon {
padding: 0;
}
.messageCloseButton:hover {
list-style-image: url("chrome://global/skin/icons/closetab-hover.png") !important;
}

View File

@ -1,109 +1,136 @@
/********** Tab widget *********/
/*******************************/
/* This Mac-specific CSS styles tabs that are located on the top of their content,
* as Macintosh tabs generally are. An example of using bottom tab images can be
* found in EditorToolbar.css in classic/editor/.
*******************************/
/* ===== tabbox.css =====================================================
== Styles used by the XUL tabbox element
The default style of these tabs is that of an NSTabView with tabs at
the top in the "regular" size. These tabs can be used with or without
a tabbox element.
For bottom tabs you should use the "tabs-bottom" class on the tabbox
or the tabs element. Bottom tabs use a style that's similar to the
one used in Adium.
======================================================================= */
@namespace url("http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");
/*** TAB: TOP <tab> ***/
tab {
-moz-appearance: tab;
-moz-box-align: stretch;
color : #000000;
padding: 3px;
}
.tab-text {
font : menu;
}
tabs {
padding : 0px;
margin-bottom: -2px;
}
tabs.tabs-bottom {
padding-left: 6px;
padding-right: 6px;
}
.tabs-left, .tabs-right {
-moz-box-flex: 1 !important;
}
/*** TAB: BOTTOM <tab class="tab-bottom"> ***/
/* Found in editor.xul & editorOverlay.xul
* SMALL TABS FOR NOW */
.tab-bottom {
margin-bottom: 2px;
margin-top: 2px;
-moz-box-align: center;
}
.tab-bottom > .tab-middle {
padding: 0 6px 0 6px;
margin-bottom: 2px;
}
.tab-bottom > .tab-middle > .tab-text {
font: message-box;
font-weight: bold !important;
margin: 0 0 -1px 0 !important;
padding: 0 !important;
}
/* top tabs */
tabbox[orient="vertical"] tabs[orient="horizontal"] tab {
padding: 0px;
margin: 0px;
}
/* bottom tabs */
tabbox[orient="vertical"] tabpanels + tabs[orient="horizontal"] tab {
border-top: none;
border-bottom: 1px solid #666666;
border-left: 1px solid white;
border-right: 1px solid #666666;
-moz-border-radius: 0px 0px 8px 8px;
padding: 1px 5px 3px 5px;
margin: 1px 2px 1px 2px;
}
/* left tabs */
tabbox[orient="horizontal"] tabs[orient="vertical"] tab {
border-right: none;
-moz-border-radius: 8px 0px 0px 8px;
padding-right: 1px;
margin: 2px 1px 2px 1px;
}
/* right tabs */
tabbox[orient="horizontal"] tabpanels + tabs[orient="vertical"] tab {
border-top: 1px solid white;
border-bottom: 1px solid #666666;
border-left: none;
border-right: 1px solid #666666;
-moz-border-radius: 0px 8px 8px 0px;
padding: 3px 5px 1px 5px;
margin: 2px 1px 2px 1px;
}
tabbox {
border: none;
tabbox {
margin: 0 5px;
}
tabpanels {
-moz-appearance: tabpanels;
border-top: 0px;
border-bottom: 2px ridge #000000;
border-left: 2px groove #000000;
border-right: 2px ridge #000000;
padding: 15px 5px 5px 5px;
background-color : #EEEEEE;
margin-bottom: 10px;
padding: 33px 15px 15px;
}
tabs {
-moz-box-align: center;
font: menu;
}
tabbox > tabs {
padding: 0 10px;
margin-bottom: -12px;
position: relative;
}
tab {
-moz-appearance: tab;
-moz-box-align: stretch;
}
tab > .tab-middle {
padding: 2px 6px;
}
tab[first-tab=true] {
-moz-padding-start: 2px;
}
tab[last-tab=true] {
-moz-padding-end: 2px;
}
.tabs-left,
.tabs-right {
-moz-box-flex: 1;
}
/* Tabs at the bottom
* These tabs are smaller, left aligned and don't extend into the tabpanel.
*/
tabbox.tabs-bottom > tabpanels {
padding: 10px;
}
tabbox.tabs-bottom > tabs,
tabs.tabs-bottom {
background-color: rgba(0, 0, 0, 0.1);
padding: 0;
margin: 0;
border-top: 2px solid;
-moz-border-top-colors: #888 rgba(0, 0, 0, 0.08);
-moz-box-align: start;
font: message-box;
}
tabbox.tabs-bottom > tabs > .tabs-left,
tabs.tabs-bottom > .tabs-left {
-moz-box-flex: 0;
}
tabbox.tabs-bottom > tabs > tab,
tabs.tabs-bottom > tab {
-moz-appearance: none;
margin: -1px 0 0;
padding: 0 0 2px 0;
position: relative;
-moz-border-end: 1px solid rgba(0, 0, 0, 0.19);
}
tabbox.tabs-bottom > tabs > tab > .tab-middle,
tabs.tabs-bottom > tab > .tab-middle {
-moz-box-align: stretch;
padding: 1px 2px 0 2px;
}
tabbox.tabs-bottom > tabs > tab:not([selected=true]):hover,
tabs.tabs-bottom > tab:not([selected=true]):hover {
background-color: rgba(0, 0, 0, 0.1);
-moz-border-end-color: rgba(0, 0, 0, 0.1);
}
tabbox.tabs-bottom > tabs > tab[selected=true],
tabs.tabs-bottom > tab[selected=true] {
border: solid #888;
border-width: 0 2px 2px;
-moz-border-radius: 2px;
-moz-border-left-colors: rgba(0, 0, 0, 0.08) #888;
-moz-border-right-colors: rgba(0, 0, 0, 0.08) #888;
-moz-border-bottom-colors: rgba(0, 0, 0, 0.08) #888;
-moz-margin-end: -1px;
margin-top: -2px;
margin-bottom: 1px;
padding: 0;
}
tabbox.tabs-bottom > tabs > tab[beforeselected=true],
tabs.tabs-bottom > tab[beforeselected=true] {
-moz-border-end-color: transparent;
-moz-margin-end: -2px;
}
tabbox.tabs-bottom > tabs > tab:not([selected=true])[first-tab=true],
tabs.tabs-bottom > tab:not([selected=true])[first-tab=true] {
-moz-border-start: 4px solid transparent;
}
tabbox.tabs-bottom > tabs > tab[selected=true][first-tab=true],
tabs.tabs-bottom > tab[selected=true][first-tab=true] {
-moz-margin-start: 2px;
}
tabbox.tabs-bottom,
tabbox.tabs-bottom > tabpanels,
tabbox.tabs-bottom > tabs > tab[selected=true] > .tab-middle,
tabs.tabs-bottom > tab[selected=true] > .tab-middle {
-moz-appearance: dialog;
}

View File

@ -53,6 +53,14 @@ nsLookAndFeel::~nsLookAndFeel()
{
}
static nscolor GetColorFromNSColor(NSColor* aColor)
{
NSColor* deviceColor = [aColor colorUsingColorSpaceName:NSDeviceRGBColorSpace];
return NS_RGB((unsigned int)([deviceColor redComponent] * 255.0),
(unsigned int)([deviceColor greenComponent] * 255.0),
(unsigned int)([deviceColor blueComponent] * 255.0));
}
nsresult nsLookAndFeel::NativeGetColor(const nsColorID aID, nscolor &aColor)
{
nsresult res = NS_OK;
@ -209,7 +217,7 @@ nsresult nsLookAndFeel::NativeGetColor(const nsColorID aID, nscolor &aColor)
res = GetMacBrushColor(kThemeBrushButtonActiveDarkShadow, aColor, NS_RGB(0x77,0x77,0x77));
break;
case eColor_graytext:
res = GetMacTextColor(kThemeTextColorDialogInactive, aColor, NS_RGB(0x77,0x77,0x77));
aColor = GetColorFromNSColor([NSColor disabledControlTextColor]);
break;
case eColor_inactiveborder:
//ScrollBar DelimiterInactive looks like an odd constant to use, but gives the right colour in most themes,

View File

@ -101,10 +101,8 @@ protected:
void DrawProgress(CGContextRef context, const HIRect& inBoxRect,
PRBool inIsIndeterminate, PRBool inIsHorizontal,
PRInt32 inValue, PRInt32 inMaxValue, nsIFrame* aFrame);
void DrawTab(CGContextRef context, const HIRect& inBoxRect,
PRBool inIsDisabled, PRBool inIsFrontmost,
PRBool inIsHorizontal, PRBool inTabBottom,
PRInt32 inState, nsIFrame* aFrame);
void DrawTab(CGContextRef context, HIRect inBoxRect, PRInt32 inState,
nsIFrame* aFrame);
void DrawTabPanel(CGContextRef context, const HIRect& inBoxRect, nsIFrame* aFrame);
void DrawScale(CGContextRef context, const HIRect& inBoxRect,
PRBool inIsDisabled, PRInt32 inState,

View File

@ -157,7 +157,11 @@ static BOOL FrameIsInActiveWindow(nsIFrame* aFrame)
// but controls in these windows should still get the active look.
nsWindowType windowType;
topLevelWidget->GetWindowType(windowType);
return [win isKeyWindow] || (windowType == eWindowType_popup);
if (windowType == eWindowType_popup)
return YES;
if ([win isSheet])
return [win isKeyWindow];
return [win isMainWindow] && ![win attachedSheet];
}
NS_IMPL_ISUPPORTS1(nsNativeThemeCocoa, nsITheme)
@ -719,6 +723,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) {
@ -888,10 +904,11 @@ nsNativeThemeCocoa::DrawTabPanel(CGContextRef cgContext, const HIRect& inBoxRect
HIThemeTabPaneDrawInfo tpdi;
tpdi.version = 0;
tpdi.version = 1;
tpdi.state = FrameIsInActiveWindow(aFrame) ? kThemeStateActive : kThemeStateInactive;
tpdi.direction = kThemeTabNorth;
tpdi.size = kHIThemeTabSizeNormal;
tpdi.kind = kHIThemeTabKindNormal;
HIThemeDrawTabPane(&inBoxRect, &tpdi, cgContext, HITHEME_ORIENTATION);
@ -936,25 +953,29 @@ nsNativeThemeCocoa::DrawScale(CGContextRef cgContext, const HIRect& inBoxRect,
}
#define NATURAL_MINI_TAB_BUTTON_HEIGHT 17
#define NATURAL_SMALL_TAB_BUTTON_HEIGHT 20
#define NATURAL_REGULAR_TAB_BUTTON_HEIGHT 23
void
nsNativeThemeCocoa::DrawTab(CGContextRef cgContext, const HIRect& inBoxRect,
PRBool inIsDisabled, PRBool inIsFrontmost,
PRBool inIsHorizontal, PRBool inTabBottom,
nsNativeThemeCocoa::DrawTab(CGContextRef cgContext, HIRect inBoxRect,
PRInt32 inState, nsIFrame* aFrame)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
HIThemeTabDrawInfo tdi;
tdi.version = 1;
tdi.version = 0;
if (inIsFrontmost) {
if (inIsDisabled)
PRBool isSelected = IsSelectedTab(aFrame);
PRBool isDisabled = IsDisabled(aFrame);
if (isSelected) {
if (isDisabled)
tdi.style = kThemeTabFrontUnavailable;
else
tdi.style = FrameIsInActiveWindow(aFrame) ? kThemeTabFront : kThemeTabFrontInactive;
} else {
if (inIsDisabled)
if (isDisabled)
tdi.style = kThemeTabNonFrontUnavailable;
else if ((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER))
tdi.style = kThemeTabNonFrontPressed;
@ -962,10 +983,55 @@ nsNativeThemeCocoa::DrawTab(CGContextRef cgContext, const HIRect& inBoxRect,
tdi.style = FrameIsInActiveWindow(aFrame) ? kThemeTabNonFront : kThemeTabNonFrontInactive;
}
// don't yet support vertical tabs
tdi.direction = inTabBottom ? kThemeTabSouth : kThemeTabNorth;
tdi.direction = kThemeTabNorth;
tdi.size = kHIThemeTabSizeNormal;
tdi.adornment = kThemeAdornmentNone;
if (inBoxRect.size.height < NATURAL_REGULAR_TAB_BUTTON_HEIGHT)
tdi.size = kHIThemeTabSizeSmall;
if (inBoxRect.size.height < NATURAL_SMALL_TAB_BUTTON_HEIGHT)
tdi.size = kHIThemeTabSizeMini;
PRBool isRTL = IsFrameRTL(aFrame);
PRBool isFirst = isRTL ? IsLastTab(aFrame) : IsFirstTab(aFrame);
PRBool isLast = isRTL ? IsFirstTab(aFrame) : IsLastTab(aFrame);
if (isFirst && isLast)
tdi.position = kHIThemeTabPositionOnly;
else if (isFirst)
tdi.position = kHIThemeTabPositionFirst;
else if (isLast)
tdi.position = kHIThemeTabPositionLast;
else
tdi.position = kHIThemeTabPositionMiddle;
// Tab separator management:
// Normal tabs only draw their left separator, in the leftmost pixel row of
// their frame. Selected tabs additionally draw their right separator, outside
// of their frame. To prevent overlapping, the tab to the right of the
// selected tab shouldn't draw its left separator.
tdi.adornment = kHIThemeTabAdornmentNone;
if (isRTL ? IsBeforeSelectedTab(aFrame) : IsAfterSelectedTab(aFrame)) {
if (nsToolkit::OnLeopardOrLater()) {
// On Leopard, the tab's left edge must be shifted 1px to the right.
// On Tiger, this happens automatically when no leading separator is drawn.
inBoxRect.origin.x += 1;
inBoxRect.size.width -= 1;
}
}
else {
tdi.adornment = kHIThemeTabAdornmentLeadingSeparator;
}
if (isSelected && !isLast) {
tdi.adornment |= kHIThemeTabAdornmentTrailingSeparator;
if (nsToolkit::OnLeopardOrLater()) {
// On Tiger, the right separator is drawn outside of the frame.
// On Leopard, the right edge must be shifted 1px to the right.
inBoxRect.size.width += 1;
}
}
if (inState & NS_EVENT_STATE_FOCUS)
tdi.adornment |= kThemeAdornmentFocus;
HIThemeDrawTab(&inBoxRect, &tdi, cgContext, HITHEME_ORIENTATION, NULL);
@ -1461,7 +1527,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;
@ -1580,12 +1646,8 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
(IsDisabled(aFrame) || IsReadOnly(aFrame)), eventState);
break;
case NS_THEME_TAB: {
DrawTab(cgContext, macRect,
IsDisabled(aFrame), IsSelectedTab(aFrame),
PR_TRUE, IsBottomTab(aFrame),
eventState, aFrame);
}
case NS_THEME_TAB:
DrawTab(cgContext, macRect, eventState, aFrame);
break;
case NS_THEME_TAB_PANELS:
@ -1727,6 +1789,7 @@ nsNativeThemeCocoa::GetWidgetOverflow(nsIDeviceContext* aContext, nsIFrame* aFra
case NS_THEME_DROPDOWN_BUTTON:
case NS_THEME_CHECKBOX:
case NS_THEME_RADIO:
case NS_THEME_TAB:
{
// We assume that the above widgets can draw a focus ring that will be less than
// or equal to 4 pixels thick.
@ -1817,7 +1880,13 @@ 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;
}
case NS_THEME_TAB:
{
aResult->SizeTo(0, NATURAL_MINI_TAB_BUTTON_HEIGHT);
break;
}
@ -2060,8 +2129,6 @@ nsNativeThemeCocoa::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* a
case NS_THEME_TAB_PANELS:
case NS_THEME_TAB:
case NS_THEME_TAB_LEFT_EDGE:
case NS_THEME_TAB_RIGHT_EDGE:
case NS_THEME_TREEVIEW_TWISTY:
case NS_THEME_TREEVIEW_TWISTY_OPEN:

View File

@ -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)

View File

@ -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)
@ -253,6 +287,34 @@ nsNativeTheme::IsHorizontal(nsIFrame* aFrame)
eCaseMatters);
}
PRBool
nsNativeTheme::IsNextToSelectedTab(nsIFrame* aFrame, PRInt32 aOffset)
{
if (!aFrame)
return PR_FALSE;
if (aOffset == 0)
return IsSelectedTab(aFrame);
PRInt32 thisTabIndex = -1, selectedTabIndex = -1;
nsIFrame* currentTab = aFrame->GetParent()->GetFirstChild(NULL);
for (PRInt32 i = 0; currentTab; currentTab = currentTab->GetNextSibling()) {
if (currentTab->GetRect().width == 0)
continue;
if (aFrame == currentTab)
thisTabIndex = i;
if (IsSelectedTab(currentTab))
selectedTabIndex = i;
++i;
}
if (thisTabIndex == -1 || selectedTabIndex == -1)
return PR_FALSE;
return (thisTabIndex - selectedTabIndex == aOffset);
}
// progressbar:
PRBool
nsNativeTheme::IsIndeterminateProgress(nsIFrame* aFrame)

View File

@ -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);
@ -111,6 +114,16 @@ class nsNativeTheme
PRBool IsSelectedTab(nsIFrame* aFrame) {
return CheckBooleanAttr(aFrame, nsWidgetAtoms::selected);
}
PRBool IsNextToSelectedTab(nsIFrame* aFrame, PRInt32 aOffset);
PRBool IsBeforeSelectedTab(nsIFrame* aFrame) {
return IsNextToSelectedTab(aFrame, -1);
}
PRBool IsAfterSelectedTab(nsIFrame* aFrame) {
return IsNextToSelectedTab(aFrame, 1);
}
// toolbarbutton:
PRBool IsCheckedButton(nsIFrame* aFrame) {
@ -119,6 +132,7 @@ class nsNativeTheme
// treeheadercell:
TreeSortDirection GetTreeSortDirection(nsIFrame* aFrame);
PRBool IsLastTreeHeaderCell(nsIFrame* aFrame);
// tab:
PRBool IsBottomTab(nsIFrame* aFrame);

View File

@ -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")