Bug 598329 - Have XUL elements look disabled when disabled='true' is set. r=roc a=blocking

This commit is contained in:
Mounir Lamouri 2010-09-27 18:25:18 -07:00
Родитель be17922cd0
Коммит d47223e0e3
6 изменённых файлов: 82 добавлений и 52 удалений

Просмотреть файл

@ -584,7 +584,7 @@ nsNativeThemeCocoa::DrawCheckboxOrRadio(CGContextRef cgContext, PRBool inCheckbo
if (inCheckbox && GetIndeterminate(aFrame))
state = NSMixedState;
[cell setEnabled:!(inState & NS_EVENT_STATE_DISABLED)];
[cell setEnabled:!IsDisabled(aFrame, inState)];
[cell setShowsFirstResponder:(inState & NS_EVENT_STATE_FOCUS)];
[cell setState:state];
[cell setHighlighted:((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER))];
@ -635,7 +635,7 @@ nsNativeThemeCocoa::DrawSearchField(CGContextRef cgContext, const HIRect& inBoxR
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
NSSearchFieldCell* cell = mSearchFieldCell;
[cell setEnabled:!(inState & NS_EVENT_STATE_DISABLED)];
[cell setEnabled:!IsDisabled(aFrame, inState)];
// NOTE: this could probably use inState
[cell setShowsFirstResponder:IsFocused(aFrame)];
@ -683,7 +683,7 @@ nsNativeThemeCocoa::DrawPushButton(CGContextRef cgContext, const HIRect& inBoxRe
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
BOOL isActive = FrameIsInActiveWindow(aFrame);
BOOL isDisabled = inState & NS_EVENT_STATE_DISABLED;
BOOL isDisabled = IsDisabled(aFrame, inState);
[mPushButtonCell setEnabled:!isDisabled];
[mPushButtonCell setHighlighted:((inState & NS_EVENT_STATE_ACTIVE) &&
@ -799,6 +799,7 @@ nsNativeThemeCocoa::DrawButton(CGContextRef cgContext, ThemeButtonKind inKind,
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
BOOL isActive = FrameIsInActiveWindow(aFrame);
BOOL isDisabled = IsDisabled(aFrame, inState);
HIThemeButtonDrawInfo bdi;
bdi.version = 0;
@ -806,7 +807,7 @@ nsNativeThemeCocoa::DrawButton(CGContextRef cgContext, ThemeButtonKind inKind,
bdi.value = inValue;
bdi.adornment = inAdornment;
if (inState & NS_EVENT_STATE_DISABLED) {
if (isDisabled) {
bdi.state = kThemeStateUnavailable;
}
else if ((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER)) {
@ -824,7 +825,7 @@ nsNativeThemeCocoa::DrawButton(CGContextRef cgContext, ThemeButtonKind inKind,
if (inState & NS_EVENT_STATE_FOCUS && isActive)
bdi.adornment |= kThemeAdornmentFocus;
if (inIsDefault && !(inState & NS_EVENT_STATE_DISABLED) && isActive &&
if (inIsDefault && !isDisabled && isActive &&
!(inState & NS_EVENT_STATE_ACTIVE)) {
bdi.adornment |= kThemeAdornmentDefault;
bdi.animation.time.start = 0;
@ -931,7 +932,7 @@ nsNativeThemeCocoa::DrawDropdown(CGContextRef cgContext, const HIRect& inBoxRect
BOOL isEditable = (aWidgetType == NS_THEME_DROPDOWN_TEXTFIELD);
NSCell* cell = isEditable ? (NSCell*)mComboBoxCell : (NSCell*)mDropdownCell;
[cell setEnabled:!(inState & NS_EVENT_STATE_DISABLED)];
[cell setEnabled:!IsDisabled(aFrame, inState)];
[cell setShowsFirstResponder:(IsFocused(aFrame) || (inState & NS_EVENT_STATE_FOCUS))];
[cell setHighlighted:IsOpenButton(aFrame)];
[cell setControlTint:(FrameIsInActiveWindow(aFrame) ? [NSColor currentControlTint] : NSClearControlTint)];
@ -957,7 +958,7 @@ nsNativeThemeCocoa::DrawSpinButtons(CGContextRef cgContext, ThemeButtonKind inKi
bdi.value = kThemeButtonOff;
bdi.adornment = inAdornment;
if (inState & NS_EVENT_STATE_DISABLED)
if (IsDisabled(aFrame, inState))
bdi.state = kThemeStateUnavailable;
else
bdi.state = FrameIsInActiveWindow(aFrame) ? inDrawState : kThemeStateActive;
@ -969,7 +970,7 @@ nsNativeThemeCocoa::DrawSpinButtons(CGContextRef cgContext, ThemeButtonKind inKi
void
nsNativeThemeCocoa::DrawFrame(CGContextRef cgContext, HIThemeFrameKind inKind,
const HIRect& inBoxRect, PRBool inReadOnly, PRInt32 inState)
const HIRect& inBoxRect, PRBool inDisabled, PRInt32 inState)
{
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
@ -979,8 +980,7 @@ nsNativeThemeCocoa::DrawFrame(CGContextRef cgContext, HIThemeFrameKind inKind,
// We don't ever set an inactive state for this because it doesn't
// look right (see other apps).
fdi.state = ((inState & NS_EVENT_STATE_DISABLED) || inReadOnly) ? kThemeStateUnavailable
: kThemeStateActive;
fdi.state = inDisabled ? kThemeStateUnavailable : kThemeStateActive;
// for some reason focus rings on listboxes draw incorrectly
if (inKind == kHIThemeFrameListBox)
@ -1100,7 +1100,7 @@ nsNativeThemeCocoa::DrawScale(CGContextRef cgContext, const HIRect& inBoxRect,
tdi.attributes |= kThemeTrackRightToLeft;
if (inState & NS_EVENT_STATE_FOCUS)
tdi.attributes |= kThemeTrackHasFocus;
if (inState & NS_EVENT_STATE_DISABLED)
if (IsDisabled(aFrame, inState))
tdi.enableState = kThemeTrackDisabled;
else
tdi.enableState = FrameIsInActiveWindow(aFrame) ? kThemeTrackActive : kThemeTrackInactive;
@ -1127,13 +1127,15 @@ nsNativeThemeCocoa::DrawTab(CGContextRef cgContext, HIRect inBoxRect,
tdi.kind = kHIThemeTabKindNormal;
PRBool isSelected = IsSelectedTab(aFrame);
PRBool isDisabled = IsDisabled(aFrame, inState);
if (isSelected) {
if (inState & NS_EVENT_STATE_DISABLED)
if (isDisabled)
tdi.style = kThemeTabFrontUnavailable;
else
tdi.style = FrameIsInActiveWindow(aFrame) ? kThemeTabFront : kThemeTabFrontInactive;
} else {
if (inState & NS_EVENT_STATE_DISABLED)
if (isDisabled)
tdi.style = kThemeTabNonFrontUnavailable;
else if ((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER))
tdi.style = kThemeTabNonFrontPressed;
@ -1574,8 +1576,8 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
case NS_THEME_MENUPOPUP: {
HIThemeMenuDrawInfo mdi = {
version: 0,
menuType: (eventState & NS_EVENT_STATE_DISABLED) ? kThemeMenuTypeInactive
: kThemeMenuTypePopUp
menuType: IsDisabled(aFrame, eventState) ? kThemeMenuTypeInactive
: kThemeMenuTypePopUp
};
PRBool isLeftOfParent = PR_FALSE;
@ -1598,7 +1600,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
HIThemeMenuItemDrawInfo drawInfo = {
version: 0,
itemType: kThemeMenuItemPlain,
state: ((eventState & NS_EVENT_STATE_DISABLED) ? kThemeMenuDisabled :
state: (IsDisabled(aFrame, eventState) ? kThemeMenuDisabled :
CheckBooleanAttr(aFrame, nsWidgetAtoms::mozmenuactive) ? kThemeMenuSelected :
kThemeMenuActive)
};
@ -1611,7 +1613,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
case NS_THEME_MENUSEPARATOR: {
ThemeMenuState menuState;
if (eventState & NS_EVENT_STATE_DISABLED) {
if (IsDisabled(aFrame, eventState)) {
menuState = kThemeMenuDisabled;
}
else {
@ -1749,7 +1751,8 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
eventState |= NS_EVENT_STATE_FOCUS;
}
DrawFrame(cgContext, kHIThemeFrameTextFieldSquare, macRect, IsReadOnly(aFrame), eventState);
DrawFrame(cgContext, kHIThemeFrameTextFieldSquare, macRect,
IsDisabled(aFrame, eventState) || IsReadOnly(aFrame), eventState);
break;
case NS_THEME_SEARCHFIELD:

Просмотреть файл

@ -257,8 +257,7 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
PRInt32 eventState = GetContentState(stateFrame, aWidgetType);
aState->disabled = ((eventState & NS_EVENT_STATE_DISABLED) == NS_EVENT_STATE_DISABLED ||
IsReadOnly(aFrame));
aState->disabled = IsDisabled(aFrame, eventState) || IsReadOnly(aFrame);
aState->active = (eventState & NS_EVENT_STATE_ACTIVE) == NS_EVENT_STATE_ACTIVE;
aState->focused = (eventState & NS_EVENT_STATE_FOCUS) == NS_EVENT_STATE_FOCUS;
aState->inHover = (eventState & NS_EVENT_STATE_HOVER) == NS_EVENT_STATE_HOVER;

Просмотреть файл

@ -314,7 +314,7 @@ nsNativeThemeQt::DrawWidgetBackground(QPainter *qPainter,
QStyleOptionFrameV2 frameOpt;
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
if (!(eventState & NS_EVENT_STATE_DISABLED))
if (!IsDisabled(aFrame, eventState))
frameOpt.state |= QStyle::State_Enabled;
frameOpt.rect = r;
@ -641,13 +641,15 @@ nsNativeThemeQt::InitButtonStyle(PRUint8 aWidgetType,
opt.rect = rect;
opt.palette = mNoBackgroundPalette;
if (!(eventState & NS_EVENT_STATE_DISABLED))
PRBool isDisabled = IsDisabled(aFrame, eventState);
if (!isDisabled)
opt.state |= QStyle::State_Enabled;
if (eventState & NS_EVENT_STATE_HOVER)
opt.state |= QStyle::State_MouseOver;
if (eventState & NS_EVENT_STATE_FOCUS)
opt.state |= QStyle::State_HasFocus;
if (!(eventState & NS_EVENT_STATE_DISABLED) && (eventState & NS_EVENT_STATE_ACTIVE))
if (!isDisabled && (eventState & NS_EVENT_STATE_ACTIVE))
// Don't allow sunken when disabled
opt.state |= QStyle::State_Sunken;
@ -678,7 +680,7 @@ nsNativeThemeQt::InitPlainStyle(PRUint8 aWidgetType,
opt.rect = rect;
if (!(eventState & NS_EVENT_STATE_DISABLED))
if (!IsDisabled(aFrame, eventState))
opt.state |= QStyle::State_Enabled;
if (eventState & NS_EVENT_STATE_HOVER)
opt.state |= QStyle::State_MouseOver;
@ -695,8 +697,9 @@ nsNativeThemeQt::InitComboStyle(PRUint8 aWidgetType,
QStyleOptionComboBox &opt)
{
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
PRBool isDisabled = IsDisabled(aFrame, eventState);
if (!(eventState & NS_EVENT_STATE_DISABLED))
if (!isDisabled)
opt.state |= QStyle::State_Enabled;
if (eventState & NS_EVENT_STATE_HOVER)
opt.state |= QStyle::State_MouseOver;
@ -704,7 +707,7 @@ nsNativeThemeQt::InitComboStyle(PRUint8 aWidgetType,
opt.state |= QStyle::State_HasFocus;
if (!(eventState & NS_EVENT_STATE_ACTIVE))
opt.state |= QStyle::State_Raised;
if (!(eventState & NS_EVENT_STATE_DISABLED) && (eventState & NS_EVENT_STATE_ACTIVE))
if (!isDisabled && (eventState & NS_EVENT_STATE_ACTIVE))
// Don't allow sunken when disabled
opt.state |= QStyle::State_Sunken;

Просмотреть файл

@ -486,7 +486,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
}
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
if (eventState & NS_EVENT_STATE_DISABLED) {
if (IsDisabled(aFrame, eventState)) {
aState = TS_DISABLED;
return NS_OK;
} else if (IsOpenButton(aFrame) ||
@ -526,7 +526,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
PRInt32 eventState = GetContentState(isXULCheckboxRadio ? aFrame->GetParent()
: aFrame,
aWidgetType);
if (eventState & NS_EVENT_STATE_DISABLED) {
if (IsDisabled(aFrame, eventState)) {
aState = TS_DISABLED;
} else {
aState = StandardGetState(aFrame, aWidgetType, PR_FALSE);
@ -561,7 +561,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
if (!aFrame) {
aState = TFS_EDITBORDER_NORMAL;
} else if (eventState & NS_EVENT_STATE_DISABLED) {
} else if (IsDisabled(aFrame, eventState)) {
aState = TFS_EDITBORDER_DISABLED;
} else if (IsReadOnly(aFrame)) {
/* no special read-only state */
@ -586,7 +586,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
if (!aFrame)
aState = TS_NORMAL;
else if (eventState & NS_EVENT_STATE_DISABLED)
else if (IsDisabled(aFrame, eventState))
aState = TS_DISABLED;
else if (IsReadOnly(aFrame))
aState = TFS_READONLY;
@ -629,7 +629,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
}
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
if (eventState & NS_EVENT_STATE_DISABLED) {
if (IsDisabled(aFrame, eventState)) {
aState = TS_DISABLED;
return NS_OK;
}
@ -669,7 +669,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
if (!aFrame)
aState += TS_NORMAL;
else if (eventState & NS_EVENT_STATE_DISABLED)
else if (IsDisabled(aFrame, eventState))
aState += TS_DISABLED;
else {
nsIFrame *parent = aFrame->GetParent();
@ -699,7 +699,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
if (!aFrame)
aState = TS_NORMAL;
else if (eventState & NS_EVENT_STATE_DISABLED)
else if (IsDisabled(aFrame, eventState))
aState = TS_DISABLED;
else {
if (eventState & NS_EVENT_STATE_ACTIVE) // Hover is not also a requirement for
@ -728,7 +728,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
if (!aFrame)
aState = TS_NORMAL;
else if (eventState & NS_EVENT_STATE_DISABLED) {
else if (IsDisabled(aFrame, eventState)) {
aState = TKP_DISABLED;
}
else {
@ -752,7 +752,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
if (!aFrame)
aState = TS_NORMAL;
else if (eventState & NS_EVENT_STATE_DISABLED)
else if (IsDisabled(aFrame, eventState))
aState = TS_DISABLED;
else
aState = StandardGetState(aFrame, aWidgetType, PR_FALSE);
@ -823,7 +823,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
}
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
if (eventState & NS_EVENT_STATE_DISABLED) {
if (IsDisabled(aFrame, eventState)) {
aState = TS_DISABLED;
return NS_OK;
}
@ -867,7 +867,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
else
aPart = CBP_DROPFRAME;
if (eventState & NS_EVENT_STATE_DISABLED) {
if (IsDisabled(aFrame, eventState)) {
aState = TS_DISABLED;
} else if (IsReadOnly(aFrame)) {
aState = TS_NORMAL;
@ -905,7 +905,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
if (isHTML && IsWidgetStyled(aFrame->PresContext(), aFrame, NS_THEME_DROPDOWN))
aPart = CBP_DROPMARKER;
if (eventState & NS_EVENT_STATE_DISABLED) {
if (IsDisabled(aFrame, eventState)) {
aState = TS_DISABLED;
return NS_OK;
}
@ -996,7 +996,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
aState = MBI_NORMAL;
// the disabled states are offset by 3
if (eventState & NS_EVENT_STATE_DISABLED)
if (IsDisabled(aFrame, eventState))
aState += 3;
} else {
aPart = MENU_POPUPITEM;
@ -1007,7 +1007,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
aState = MPI_NORMAL;
// the disabled states are offset by 2
if (eventState & NS_EVENT_STATE_DISABLED)
if (IsDisabled(aFrame, eventState))
aState += 2;
}
@ -1021,7 +1021,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
{
aPart = MENU_POPUPSUBMENU;
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
aState = (eventState & NS_EVENT_STATE_DISABLED) ? MSM_DISABLED : MSM_NORMAL;
aState = IsDisabled(aFrame, eventState) ? MSM_DISABLED : MSM_NORMAL;
return NS_OK;
}
case NS_THEME_MENUCHECKBOX:
@ -1041,7 +1041,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
aState += 2;
// the disabled states are offset by 1
if (eventState & NS_EVENT_STATE_DISABLED)
if (IsDisabled(aFrame, eventState))
aState += 1;
return NS_OK;
@ -1252,7 +1252,7 @@ RENDER_AGAIN:
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
// the disabled states are offset by 1
if (eventState & NS_EVENT_STATE_DISABLED)
if (IsDisabled(aFrame, eventState))
bgState += 1;
SIZE checkboxBGSize(GetCheckboxBGSize(theme, hdc));
@ -2430,7 +2430,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
aFocused = PR_FALSE;
contentState = GetContentState(aFrame, aWidgetType);
if (contentState & NS_EVENT_STATE_DISABLED)
if (IsDisabled(aFrame, contentState))
aState |= DFCS_INACTIVE;
else if (IsOpenButton(aFrame))
aState |= DFCS_PUSHED;
@ -2490,7 +2490,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
aFocused = PR_TRUE;
}
if (contentState & NS_EVENT_STATE_DISABLED) {
if (IsDisabled(aFrame, contentState)) {
aState |= DFCS_INACTIVE;
} else if (contentState & NS_EVENT_STATE_ACTIVE &&
contentState & NS_EVENT_STATE_HOVER) {
@ -2523,7 +2523,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
isContainer = menuFrame->IsMenu();
}
if (eventState & NS_EVENT_STATE_DISABLED)
if (IsDisabled(aFrame, eventState))
aState |= DFCS_INACTIVE;
if (isTopLevel) {
@ -2543,7 +2543,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
aState = 0;
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
if (eventState & NS_EVENT_STATE_DISABLED)
if (IsDisabled(aFrame, eventState))
aState |= DFCS_INACTIVE;
if (IsMenuActive(aFrame, aWidgetType))
aState |= DFCS_HOT;
@ -2602,7 +2602,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
if (eventState & NS_EVENT_STATE_DISABLED) {
if (IsDisabled(aFrame, eventState)) {
aState |= DFCS_INACTIVE;
return NS_OK;
}
@ -2649,7 +2649,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
break;
}
if (contentState & NS_EVENT_STATE_DISABLED)
if (IsDisabled(aFrame, contentState))
aState |= DFCS_INACTIVE;
else {
#ifndef WINCE
@ -2674,7 +2674,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
break;
}
if (contentState & NS_EVENT_STATE_DISABLED)
if (IsDisabled(aFrame, contentState))
aState |= DFCS_INACTIVE;
else {
if (contentState & NS_EVENT_STATE_HOVER && contentState & NS_EVENT_STATE_ACTIVE)
@ -3009,7 +3009,7 @@ RENDER_AGAIN:
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
// Fill in background
if ((eventState & NS_EVENT_STATE_DISABLED) ||
if (IsDisabled(aFrame, eventState) ||
(aFrame->GetContent()->IsXUL() &&
IsReadOnly(aFrame)))
::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_BTNFACE+1));
@ -3072,7 +3072,7 @@ RENDER_AGAIN:
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
::DrawEdge(hdc, &widgetRect, EDGE_RAISED, BF_RECT | BF_SOFT | BF_MIDDLE | BF_ADJUST);
if (NS_EVENT_STATE_DISABLED) {
if (IsDisabled(aFrame, eventState)) {
DrawCheckedRect(hdc, widgetRect, COLOR_3DFACE, COLOR_3DHILIGHT,
(HBRUSH) COLOR_3DHILIGHT);
}

Просмотреть файл

@ -259,6 +259,29 @@ nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext, nsIFrame* aFrame,
NS_AUTHOR_SPECIFIED_BACKGROUND);
}
bool
nsNativeTheme::IsDisabled(nsIFrame* aFrame, PRInt32 aEventStates)
{
if (!aFrame) {
return false;
}
nsIContent* content = aFrame->GetContent();
if (!content) {
return PR_FALSE;
}
if (content->IsHTML()) {
return (aEventStates & NS_EVENT_STATE_DISABLED);
}
// For XML/XUL elements, an attribute must be equal to the literal
// string "true" to be counted as true. An empty string should _not_
// be counted as true.
return content->AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::disabled,
NS_LITERAL_STRING("true"), eCaseMatters);
}
PRBool
nsNativeTheme::IsFrameRTL(nsIFrame* aFrame)
{

Просмотреть файл

@ -80,6 +80,8 @@ class nsNativeTheme
// Accessors to widget-specific state information
bool IsDisabled(nsIFrame* aFrame, PRInt32 aEventStates);
// RTL chrome direction
PRBool IsFrameRTL(nsIFrame* aFrame);