зеркало из https://github.com/mozilla/gecko-dev.git
Bug 557087 (4/6) - Make widget aware of the new disabled state rule. r=roc a=sicking
--HG-- extra : rebase_source : 920e50fd3343a72acf805aae5ab5f6050944eb19
This commit is contained in:
Родитель
80505c82b2
Коммит
f4ea17b1f1
|
@ -103,8 +103,7 @@ protected:
|
|||
|
||||
// HITheme drawing routines
|
||||
void DrawFrame(CGContextRef context, HIThemeFrameKind inKind,
|
||||
const HIRect& inBoxRect, PRBool inIsDisabled,
|
||||
PRInt32 inState);
|
||||
const HIRect& inBoxRect, PRBool inReadOnly, PRInt32 inState);
|
||||
void DrawProgress(CGContextRef context, const HIRect& inBoxRect,
|
||||
PRBool inIsIndeterminate, PRBool inIsHorizontal,
|
||||
PRInt32 inValue, PRInt32 inMaxValue, nsIFrame* aFrame);
|
||||
|
@ -112,26 +111,25 @@ protected:
|
|||
nsIFrame* aFrame);
|
||||
void DrawTabPanel(CGContextRef context, const HIRect& inBoxRect, nsIFrame* aFrame);
|
||||
void DrawScale(CGContextRef context, const HIRect& inBoxRect,
|
||||
PRBool inIsDisabled, PRInt32 inState,
|
||||
PRBool inDirection, PRBool inIsReverse,
|
||||
PRInt32 inCurrentValue,
|
||||
PRInt32 inMinValue, PRInt32 inMaxValue,
|
||||
PRInt32 inState, PRBool inDirection, PRBool inIsReverse,
|
||||
PRInt32 inCurrentValue, PRInt32 inMinValue, PRInt32 inMaxValue,
|
||||
nsIFrame* aFrame);
|
||||
void DrawCheckboxOrRadio(CGContextRef cgContext, PRBool inCheckbox,
|
||||
const HIRect& inBoxRect, PRBool inSelected,
|
||||
PRBool inDisabled, PRInt32 inState, nsIFrame* aFrame);
|
||||
void DrawSearchField(CGContextRef cgContext, const HIRect& inBoxRect, nsIFrame* aFrame);
|
||||
PRInt32 inState, nsIFrame* aFrame);
|
||||
void DrawSearchField(CGContextRef cgContext, const HIRect& inBoxRect,
|
||||
nsIFrame* aFrame, PRInt32 inState);
|
||||
void DrawPushButton(CGContextRef cgContext, const HIRect& inBoxRect,
|
||||
PRBool inDisabled, PRInt32 inState, nsIFrame* aFrame);
|
||||
PRInt32 inState, nsIFrame* aFrame);
|
||||
void DrawButton(CGContextRef context, ThemeButtonKind inKind,
|
||||
const HIRect& inBoxRect, PRBool inIsDefault,
|
||||
PRBool inDisabled, ThemeButtonValue inValue,
|
||||
ThemeButtonAdornment inAdornment, PRInt32 inState, nsIFrame* aFrame);
|
||||
ThemeButtonValue inValue, ThemeButtonAdornment inAdornment,
|
||||
PRInt32 inState, nsIFrame* aFrame);
|
||||
void DrawDropdown(CGContextRef context, const HIRect& inBoxRect, PRInt32 inState,
|
||||
PRUint8 aWidgetType, nsIFrame* aFrame);
|
||||
void DrawSpinButtons(CGContextRef context, ThemeButtonKind inKind,
|
||||
const HIRect& inBoxRect,
|
||||
PRBool inDisabled, ThemeDrawState inDrawState,
|
||||
ThemeDrawState inDrawState,
|
||||
ThemeButtonAdornment inAdornment, PRInt32 inState,
|
||||
nsIFrame* aFrame);
|
||||
void DrawUnifiedToolbar(CGContextRef cgContext, const HIRect& inBoxRect,
|
||||
|
|
|
@ -573,8 +573,7 @@ static const CellRenderSettings checkboxSettings = {
|
|||
void
|
||||
nsNativeThemeCocoa::DrawCheckboxOrRadio(CGContextRef cgContext, PRBool inCheckbox,
|
||||
const HIRect& inBoxRect, PRBool inSelected,
|
||||
PRBool inDisabled, PRInt32 inState,
|
||||
nsIFrame* aFrame)
|
||||
PRInt32 inState, nsIFrame* aFrame)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
|
@ -585,7 +584,7 @@ nsNativeThemeCocoa::DrawCheckboxOrRadio(CGContextRef cgContext, PRBool inCheckbo
|
|||
if (inCheckbox && GetIndeterminate(aFrame))
|
||||
state = NSMixedState;
|
||||
|
||||
[cell setEnabled:!inDisabled];
|
||||
[cell setEnabled:!(inState & NS_EVENT_STATE_DISABLED)];
|
||||
[cell setShowsFirstResponder:(inState & NS_EVENT_STATE_FOCUS)];
|
||||
[cell setState:state];
|
||||
[cell setHighlighted:((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER))];
|
||||
|
@ -631,12 +630,13 @@ static const CellRenderSettings searchFieldSettings = {
|
|||
|
||||
void
|
||||
nsNativeThemeCocoa::DrawSearchField(CGContextRef cgContext, const HIRect& inBoxRect,
|
||||
nsIFrame* aFrame)
|
||||
nsIFrame* aFrame, PRInt32 inState)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
NSSearchFieldCell* cell = mSearchFieldCell;
|
||||
[cell setEnabled:!IsDisabled(aFrame)];
|
||||
[cell setEnabled:!(inState & NS_EVENT_STATE_DISABLED)];
|
||||
// NOTE: this could probably use inState
|
||||
[cell setShowsFirstResponder:IsFocused(aFrame)];
|
||||
|
||||
DrawCellWithSnapping(cell, cgContext, inBoxRect, searchFieldSettings,
|
||||
|
@ -678,17 +678,18 @@ static const CellRenderSettings pushButtonSettings = {
|
|||
|
||||
void
|
||||
nsNativeThemeCocoa::DrawPushButton(CGContextRef cgContext, const HIRect& inBoxRect,
|
||||
PRBool inDisabled, PRInt32 inState, nsIFrame* aFrame)
|
||||
PRInt32 inState, nsIFrame* aFrame)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
BOOL isActive = FrameIsInActiveWindow(aFrame);
|
||||
BOOL isDisabled = inState & NS_EVENT_STATE_DISABLED;
|
||||
|
||||
[mPushButtonCell setEnabled:!inDisabled];
|
||||
[mPushButtonCell setEnabled:!isDisabled];
|
||||
[mPushButtonCell setHighlighted:((inState & NS_EVENT_STATE_ACTIVE) &&
|
||||
(inState & NS_EVENT_STATE_HOVER) &&
|
||||
isActive)];
|
||||
[mPushButtonCell setShowsFirstResponder:(inState & NS_EVENT_STATE_FOCUS) && !inDisabled && isActive];
|
||||
[mPushButtonCell setShowsFirstResponder:(inState & NS_EVENT_STATE_FOCUS) && !isDisabled && isActive];
|
||||
|
||||
// If the button is tall enough, draw the square button style so that buttons with
|
||||
// non-standard content look good. Otherwise draw normal rounded aqua buttons.
|
||||
|
@ -791,7 +792,7 @@ RenderButton(CGContextRef cgContext, const HIRect& aRenderRect, void* aData)
|
|||
|
||||
void
|
||||
nsNativeThemeCocoa::DrawButton(CGContextRef cgContext, ThemeButtonKind inKind,
|
||||
const HIRect& inBoxRect, PRBool inIsDefault, PRBool inDisabled,
|
||||
const HIRect& inBoxRect, PRBool inIsDefault,
|
||||
ThemeButtonValue inValue, ThemeButtonAdornment inAdornment,
|
||||
PRInt32 inState, nsIFrame* aFrame)
|
||||
{
|
||||
|
@ -805,7 +806,7 @@ nsNativeThemeCocoa::DrawButton(CGContextRef cgContext, ThemeButtonKind inKind,
|
|||
bdi.value = inValue;
|
||||
bdi.adornment = inAdornment;
|
||||
|
||||
if (inDisabled) {
|
||||
if (inState & NS_EVENT_STATE_DISABLED) {
|
||||
bdi.state = kThemeStateUnavailable;
|
||||
}
|
||||
else if ((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER)) {
|
||||
|
@ -823,7 +824,8 @@ nsNativeThemeCocoa::DrawButton(CGContextRef cgContext, ThemeButtonKind inKind,
|
|||
if (inState & NS_EVENT_STATE_FOCUS && isActive)
|
||||
bdi.adornment |= kThemeAdornmentFocus;
|
||||
|
||||
if (inIsDefault && !inDisabled && isActive && !(inState & NS_EVENT_STATE_ACTIVE)) {
|
||||
if (inIsDefault && !(inState & NS_EVENT_STATE_DISABLED) && isActive &&
|
||||
!(inState & NS_EVENT_STATE_ACTIVE)) {
|
||||
bdi.adornment |= kThemeAdornmentDefault;
|
||||
bdi.animation.time.start = 0;
|
||||
bdi.animation.time.current = CFAbsoluteTimeGetCurrent();
|
||||
|
@ -929,7 +931,7 @@ nsNativeThemeCocoa::DrawDropdown(CGContextRef cgContext, const HIRect& inBoxRect
|
|||
BOOL isEditable = (aWidgetType == NS_THEME_DROPDOWN_TEXTFIELD);
|
||||
NSCell* cell = isEditable ? (NSCell*)mComboBoxCell : (NSCell*)mDropdownCell;
|
||||
|
||||
[cell setEnabled:!IsDisabled(aFrame)];
|
||||
[cell setEnabled:!(inState & NS_EVENT_STATE_DISABLED)];
|
||||
[cell setShowsFirstResponder:(IsFocused(aFrame) || (inState & NS_EVENT_STATE_FOCUS))];
|
||||
[cell setHighlighted:IsOpenButton(aFrame)];
|
||||
[cell setControlTint:(FrameIsInActiveWindow(aFrame) ? [NSColor currentControlTint] : NSClearControlTint)];
|
||||
|
@ -943,8 +945,7 @@ nsNativeThemeCocoa::DrawDropdown(CGContextRef cgContext, const HIRect& inBoxRect
|
|||
|
||||
void
|
||||
nsNativeThemeCocoa::DrawSpinButtons(CGContextRef cgContext, ThemeButtonKind inKind,
|
||||
const HIRect& inBoxRect, PRBool inDisabled,
|
||||
ThemeDrawState inDrawState,
|
||||
const HIRect& inBoxRect, ThemeDrawState inDrawState,
|
||||
ThemeButtonAdornment inAdornment,
|
||||
PRInt32 inState, nsIFrame* aFrame)
|
||||
{
|
||||
|
@ -956,7 +957,7 @@ nsNativeThemeCocoa::DrawSpinButtons(CGContextRef cgContext, ThemeButtonKind inKi
|
|||
bdi.value = kThemeButtonOff;
|
||||
bdi.adornment = inAdornment;
|
||||
|
||||
if (inDisabled)
|
||||
if (inState & NS_EVENT_STATE_DISABLED)
|
||||
bdi.state = kThemeStateUnavailable;
|
||||
else
|
||||
bdi.state = FrameIsInActiveWindow(aFrame) ? inDrawState : kThemeStateActive;
|
||||
|
@ -968,7 +969,7 @@ nsNativeThemeCocoa::DrawSpinButtons(CGContextRef cgContext, ThemeButtonKind inKi
|
|||
|
||||
void
|
||||
nsNativeThemeCocoa::DrawFrame(CGContextRef cgContext, HIThemeFrameKind inKind,
|
||||
const HIRect& inBoxRect, PRBool inIsDisabled, PRInt32 inState)
|
||||
const HIRect& inBoxRect, PRBool inReadOnly, PRInt32 inState)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
|
@ -978,7 +979,8 @@ 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 = inIsDisabled ? kThemeStateUnavailable : kThemeStateActive;
|
||||
fdi.state = ((inState & NS_EVENT_STATE_DISABLED) || inReadOnly) ? kThemeStateUnavailable
|
||||
: kThemeStateActive;
|
||||
|
||||
// for some reason focus rings on listboxes draw incorrectly
|
||||
if (inKind == kHIThemeFrameListBox)
|
||||
|
@ -1076,10 +1078,10 @@ nsNativeThemeCocoa::DrawTabPanel(CGContextRef cgContext, const HIRect& inBoxRect
|
|||
|
||||
void
|
||||
nsNativeThemeCocoa::DrawScale(CGContextRef cgContext, const HIRect& inBoxRect,
|
||||
PRBool inIsDisabled, PRInt32 inState,
|
||||
PRBool inIsVertical, PRBool inIsReverse,
|
||||
PRInt32 inCurrentValue, PRInt32 inMinValue,
|
||||
PRInt32 inMaxValue, nsIFrame* aFrame)
|
||||
PRInt32 inState, PRBool inIsVertical,
|
||||
PRBool inIsReverse, PRInt32 inCurrentValue,
|
||||
PRInt32 inMinValue, PRInt32 inMaxValue,
|
||||
nsIFrame* aFrame)
|
||||
{
|
||||
NS_OBJC_BEGIN_TRY_ABORT_BLOCK;
|
||||
|
||||
|
@ -1098,7 +1100,7 @@ nsNativeThemeCocoa::DrawScale(CGContextRef cgContext, const HIRect& inBoxRect,
|
|||
tdi.attributes |= kThemeTrackRightToLeft;
|
||||
if (inState & NS_EVENT_STATE_FOCUS)
|
||||
tdi.attributes |= kThemeTrackHasFocus;
|
||||
if (inIsDisabled)
|
||||
if (inState & NS_EVENT_STATE_DISABLED)
|
||||
tdi.enableState = kThemeTrackDisabled;
|
||||
else
|
||||
tdi.enableState = FrameIsInActiveWindow(aFrame) ? kThemeTrackActive : kThemeTrackInactive;
|
||||
|
@ -1125,14 +1127,13 @@ nsNativeThemeCocoa::DrawTab(CGContextRef cgContext, HIRect inBoxRect,
|
|||
tdi.kind = kHIThemeTabKindNormal;
|
||||
|
||||
PRBool isSelected = IsSelectedTab(aFrame);
|
||||
PRBool isDisabled = IsDisabled(aFrame);
|
||||
if (isSelected) {
|
||||
if (isDisabled)
|
||||
if (inState & NS_EVENT_STATE_DISABLED)
|
||||
tdi.style = kThemeTabFrontUnavailable;
|
||||
else
|
||||
tdi.style = FrameIsInActiveWindow(aFrame) ? kThemeTabFront : kThemeTabFrontInactive;
|
||||
} else {
|
||||
if (isDisabled)
|
||||
if (inState & NS_EVENT_STATE_DISABLED)
|
||||
tdi.style = kThemeTabNonFrontUnavailable;
|
||||
else if ((inState & NS_EVENT_STATE_ACTIVE) && (inState & NS_EVENT_STATE_HOVER))
|
||||
tdi.style = kThemeTabNonFrontPressed;
|
||||
|
@ -1573,7 +1574,8 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
|
|||
case NS_THEME_MENUPOPUP: {
|
||||
HIThemeMenuDrawInfo mdi = {
|
||||
version: 0,
|
||||
menuType: IsDisabled(aFrame) ? kThemeMenuTypeInactive : kThemeMenuTypePopUp
|
||||
menuType: (eventState & NS_EVENT_STATE_DISABLED) ? kThemeMenuTypeInactive
|
||||
: kThemeMenuTypePopUp
|
||||
};
|
||||
|
||||
PRBool isLeftOfParent = PR_FALSE;
|
||||
|
@ -1596,9 +1598,9 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
|
|||
HIThemeMenuItemDrawInfo drawInfo = {
|
||||
version: 0,
|
||||
itemType: kThemeMenuItemPlain,
|
||||
state: (IsDisabled(aFrame) ? kThemeMenuDisabled :
|
||||
CheckBooleanAttr(aFrame, nsWidgetAtoms::mozmenuactive) ? kThemeMenuSelected :
|
||||
kThemeMenuActive)
|
||||
state: ((eventState & NS_EVENT_STATE_DISABLED) ? kThemeMenuDisabled :
|
||||
CheckBooleanAttr(aFrame, nsWidgetAtoms::mozmenuactive) ? kThemeMenuSelected :
|
||||
kThemeMenuActive)
|
||||
};
|
||||
|
||||
// XXX pass in the menu rect instead of always using the item rect
|
||||
|
@ -1609,7 +1611,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
|
|||
|
||||
case NS_THEME_MENUSEPARATOR: {
|
||||
ThemeMenuState menuState;
|
||||
if (IsDisabled(aFrame)) {
|
||||
if (eventState & NS_EVENT_STATE_DISABLED) {
|
||||
menuState = kThemeMenuDisabled;
|
||||
}
|
||||
else {
|
||||
|
@ -1631,25 +1633,25 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
|
|||
case NS_THEME_RADIO: {
|
||||
PRBool isCheckbox = (aWidgetType == NS_THEME_CHECKBOX);
|
||||
DrawCheckboxOrRadio(cgContext, isCheckbox, macRect, GetCheckedOrSelected(aFrame, !isCheckbox),
|
||||
IsDisabled(aFrame), eventState, aFrame);
|
||||
eventState, aFrame);
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_THEME_BUTTON:
|
||||
if (IsDefaultButton(aFrame)) {
|
||||
DrawButton(cgContext, kThemePushButton, macRect, true, IsDisabled(aFrame),
|
||||
DrawButton(cgContext, kThemePushButton, macRect, true,
|
||||
kThemeButtonOff, kThemeAdornmentNone, eventState, aFrame);
|
||||
} else if (IsButtonTypeMenu(aFrame)) {
|
||||
DrawDropdown(cgContext, macRect, eventState, aWidgetType, aFrame);
|
||||
} else {
|
||||
DrawPushButton(cgContext, macRect, IsDisabled(aFrame), eventState, aFrame);
|
||||
DrawPushButton(cgContext, macRect, eventState, aFrame);
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_THEME_BUTTON_BEVEL:
|
||||
DrawButton(cgContext, kThemeMediumBevelButton, macRect,
|
||||
IsDefaultButton(aFrame), IsDisabled(aFrame),
|
||||
kThemeButtonOff, kThemeAdornmentNone, eventState, aFrame);
|
||||
IsDefaultButton(aFrame), kThemeButtonOff, kThemeAdornmentNone,
|
||||
eventState, aFrame);
|
||||
break;
|
||||
|
||||
case NS_THEME_SPINNER: {
|
||||
|
@ -1664,15 +1666,15 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
|
|||
state = kThemeStatePressedDown;
|
||||
}
|
||||
|
||||
DrawSpinButtons(cgContext, kThemeIncDecButton, macRect, IsDisabled(aFrame),
|
||||
state, kThemeAdornmentNone, eventState, aFrame);
|
||||
DrawSpinButtons(cgContext, kThemeIncDecButton, macRect, state,
|
||||
kThemeAdornmentNone, eventState, aFrame);
|
||||
}
|
||||
break;
|
||||
|
||||
case NS_THEME_TOOLBAR_BUTTON:
|
||||
DrawButton(cgContext, kThemePushButton, macRect,
|
||||
IsDefaultButton(aFrame), IsDisabled(aFrame),
|
||||
kThemeButtonOn, kThemeAdornmentNone, eventState, aFrame);
|
||||
IsDefaultButton(aFrame), kThemeButtonOn, kThemeAdornmentNone,
|
||||
eventState, aFrame);
|
||||
break;
|
||||
|
||||
case NS_THEME_TOOLBAR_SEPARATOR: {
|
||||
|
@ -1723,8 +1725,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
|
|||
break;
|
||||
|
||||
case NS_THEME_DROPDOWN_BUTTON:
|
||||
DrawButton(cgContext, kThemeArrowButton, macRect, PR_FALSE,
|
||||
IsDisabled(aFrame), kThemeButtonOn,
|
||||
DrawButton(cgContext, kThemeArrowButton, macRect, PR_FALSE, kThemeButtonOn,
|
||||
kThemeAdornmentArrowDownArrow, eventState, aFrame);
|
||||
break;
|
||||
|
||||
|
@ -1748,12 +1749,11 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
|
|||
eventState |= NS_EVENT_STATE_FOCUS;
|
||||
}
|
||||
|
||||
DrawFrame(cgContext, kHIThemeFrameTextFieldSquare,
|
||||
macRect, (IsDisabled(aFrame) || IsReadOnly(aFrame)), eventState);
|
||||
DrawFrame(cgContext, kHIThemeFrameTextFieldSquare, macRect, IsReadOnly(aFrame), eventState);
|
||||
break;
|
||||
|
||||
case NS_THEME_SEARCHFIELD:
|
||||
DrawSearchField(cgContext, macRect, aFrame);
|
||||
DrawSearchField(cgContext, macRect, aFrame, eventState);
|
||||
break;
|
||||
|
||||
case NS_THEME_PROGRESSBAR:
|
||||
|
@ -1774,21 +1774,21 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
|
|||
break;
|
||||
|
||||
case NS_THEME_TREEVIEW_TWISTY:
|
||||
DrawButton(cgContext, kThemeDisclosureButton, macRect, PR_FALSE, IsDisabled(aFrame),
|
||||
DrawButton(cgContext, kThemeDisclosureButton, macRect, PR_FALSE,
|
||||
kThemeDisclosureRight, kThemeAdornmentNone, eventState, aFrame);
|
||||
break;
|
||||
|
||||
case NS_THEME_TREEVIEW_TWISTY_OPEN:
|
||||
DrawButton(cgContext, kThemeDisclosureButton, macRect, PR_FALSE, IsDisabled(aFrame),
|
||||
DrawButton(cgContext, kThemeDisclosureButton, macRect, PR_FALSE,
|
||||
kThemeDisclosureDown, kThemeAdornmentNone, eventState, aFrame);
|
||||
break;
|
||||
|
||||
case NS_THEME_TREEVIEW_HEADER_CELL: {
|
||||
TreeSortDirection sortDirection = GetTreeSortDirection(aFrame);
|
||||
DrawButton(cgContext, kThemeListHeaderButton, macRect, PR_FALSE, IsDisabled(aFrame),
|
||||
DrawButton(cgContext, kThemeListHeaderButton, macRect, PR_FALSE,
|
||||
sortDirection == eTreeSortDirection_Natural ? kThemeButtonOff : kThemeButtonOn,
|
||||
sortDirection == eTreeSortDirection_Ascending ?
|
||||
kThemeAdornmentHeaderButtonSortUp : kThemeAdornmentNone, eventState, aFrame);
|
||||
kThemeAdornmentHeaderButtonSortUp : kThemeAdornmentNone, eventState, aFrame);
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1819,7 +1819,7 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
|
|||
PRBool reverse = aFrame->GetContent()->
|
||||
AttrValueIs(kNameSpaceID_None, nsWidgetAtoms::dir,
|
||||
NS_LITERAL_STRING("reverse"), eCaseMatters);
|
||||
DrawScale(cgContext, macRect, IsDisabled(aFrame), eventState,
|
||||
DrawScale(cgContext, macRect, eventState,
|
||||
(aWidgetType == NS_THEME_SCALE_VERTICAL), reverse,
|
||||
curpos, minpos, maxpos, aFrame);
|
||||
}
|
||||
|
|
|
@ -257,7 +257,8 @@ nsNativeThemeGTK::GetGtkWidgetAndState(PRUint8 aWidgetType, nsIFrame* aFrame,
|
|||
|
||||
PRInt32 eventState = GetContentState(stateFrame, aWidgetType);
|
||||
|
||||
aState->disabled = (IsDisabled(aFrame) || IsReadOnly(aFrame));
|
||||
aState->disabled = ((eventState & NS_EVENT_STATE_DISABLED) == NS_EVENT_STATE_DISABLED ||
|
||||
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;
|
||||
|
|
|
@ -312,8 +312,9 @@ nsNativeThemeQt::DrawWidgetBackground(QPainter *qPainter,
|
|||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
case NS_THEME_LISTBOX: {
|
||||
QStyleOptionFrameV2 frameOpt;
|
||||
|
||||
if (!IsDisabled(aFrame))
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
if (!(eventState & NS_EVENT_STATE_DISABLED))
|
||||
frameOpt.state |= QStyle::State_Enabled;
|
||||
|
||||
frameOpt.rect = r;
|
||||
|
@ -640,15 +641,13 @@ nsNativeThemeQt::InitButtonStyle(PRUint8 aWidgetType,
|
|||
opt.rect = rect;
|
||||
opt.palette = mNoBackgroundPalette;
|
||||
|
||||
PRBool disabled = IsDisabled(aFrame);
|
||||
|
||||
if (!disabled)
|
||||
if (!(eventState & NS_EVENT_STATE_DISABLED))
|
||||
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 (!disabled && eventState & NS_EVENT_STATE_ACTIVE)
|
||||
if (!(eventState & NS_EVENT_STATE_DISABLED) && (eventState & NS_EVENT_STATE_ACTIVE))
|
||||
// Don't allow sunken when disabled
|
||||
opt.state |= QStyle::State_Sunken;
|
||||
|
||||
|
@ -679,7 +678,7 @@ nsNativeThemeQt::InitPlainStyle(PRUint8 aWidgetType,
|
|||
|
||||
opt.rect = rect;
|
||||
|
||||
if (!IsDisabled(aFrame))
|
||||
if (!(eventState & NS_EVENT_STATE_DISABLED))
|
||||
opt.state |= QStyle::State_Enabled;
|
||||
if (eventState & NS_EVENT_STATE_HOVER)
|
||||
opt.state |= QStyle::State_MouseOver;
|
||||
|
@ -697,9 +696,7 @@ nsNativeThemeQt::InitComboStyle(PRUint8 aWidgetType,
|
|||
{
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
PRBool disabled = IsDisabled(aFrame);
|
||||
|
||||
if (!disabled)
|
||||
if (!(eventState & NS_EVENT_STATE_DISABLED))
|
||||
opt.state |= QStyle::State_Enabled;
|
||||
if (eventState & NS_EVENT_STATE_HOVER)
|
||||
opt.state |= QStyle::State_MouseOver;
|
||||
|
@ -707,7 +704,7 @@ nsNativeThemeQt::InitComboStyle(PRUint8 aWidgetType,
|
|||
opt.state |= QStyle::State_HasFocus;
|
||||
if (!(eventState & NS_EVENT_STATE_ACTIVE))
|
||||
opt.state |= QStyle::State_Raised;
|
||||
if (!disabled && eventState & NS_EVENT_STATE_ACTIVE)
|
||||
if (!(eventState & NS_EVENT_STATE_DISABLED) && (eventState & NS_EVENT_STATE_ACTIVE))
|
||||
// Don't allow sunken when disabled
|
||||
opt.state |= QStyle::State_Sunken;
|
||||
|
||||
|
|
|
@ -485,7 +485,8 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if (IsDisabled(aFrame)) {
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (eventState & NS_EVENT_STATE_DISABLED) {
|
||||
aState = TS_DISABLED;
|
||||
return NS_OK;
|
||||
} else if (IsOpenButton(aFrame) ||
|
||||
|
@ -522,7 +523,10 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
inputState = INDETERMINATE;
|
||||
}
|
||||
|
||||
if (IsDisabled(isXULCheckboxRadio ? aFrame->GetParent() : aFrame)) {
|
||||
PRInt32 eventState = GetContentState(isXULCheckboxRadio ? aFrame->GetParent()
|
||||
: aFrame,
|
||||
aWidgetType);
|
||||
if (eventState & NS_EVENT_STATE_DISABLED) {
|
||||
aState = TS_DISABLED;
|
||||
} else {
|
||||
aState = StandardGetState(aFrame, aWidgetType, PR_FALSE);
|
||||
|
@ -542,6 +546,8 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
}
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE: {
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
if (nsUXThemeData::sIsVistaOrLater) {
|
||||
/* Note: the NOSCROLL type has a rounded corner in each
|
||||
* corner. The more specific HSCROLL, VSCROLL, HVSCROLL types
|
||||
|
@ -555,13 +561,12 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
|
||||
if (!aFrame) {
|
||||
aState = TFS_EDITBORDER_NORMAL;
|
||||
} else if (IsDisabled(aFrame)) {
|
||||
} else if (eventState & NS_EVENT_STATE_DISABLED) {
|
||||
aState = TFS_EDITBORDER_DISABLED;
|
||||
} else if (IsReadOnly(aFrame)) {
|
||||
/* no special read-only state */
|
||||
aState = TFS_EDITBORDER_NORMAL;
|
||||
} else {
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
|
||||
/* XUL textboxes don't get focused themselves, because they have child
|
||||
|
@ -581,7 +586,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
|
||||
if (!aFrame)
|
||||
aState = TS_NORMAL;
|
||||
else if (IsDisabled(aFrame))
|
||||
else if (eventState & NS_EVENT_STATE_DISABLED)
|
||||
aState = TS_DISABLED;
|
||||
else if (IsReadOnly(aFrame))
|
||||
aState = TFS_READONLY;
|
||||
|
@ -623,7 +628,8 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
if (IsDisabled(aFrame)) {
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (eventState & NS_EVENT_STATE_DISABLED) {
|
||||
aState = TS_DISABLED;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -631,7 +637,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
aState = TS_ACTIVE;
|
||||
return NS_OK;
|
||||
}
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
if (eventState & NS_EVENT_STATE_HOVER && eventState & NS_EVENT_STATE_ACTIVE)
|
||||
aState = TS_ACTIVE;
|
||||
else if (eventState & NS_EVENT_STATE_HOVER) {
|
||||
|
@ -660,12 +666,12 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
case NS_THEME_SCROLLBAR_BUTTON_RIGHT: {
|
||||
aPart = SP_BUTTON;
|
||||
aState = (aWidgetType - NS_THEME_SCROLLBAR_BUTTON_UP)*4;
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (!aFrame)
|
||||
aState += TS_NORMAL;
|
||||
else if (IsDisabled(aFrame))
|
||||
else if (eventState & NS_EVENT_STATE_DISABLED)
|
||||
aState += TS_DISABLED;
|
||||
else {
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
nsIFrame *parent = aFrame->GetParent();
|
||||
PRInt32 parentState = GetContentState(parent, parent->GetStyleDisplay()->mAppearance);
|
||||
if (eventState & NS_EVENT_STATE_HOVER && eventState & NS_EVENT_STATE_ACTIVE)
|
||||
|
@ -690,12 +696,12 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
case NS_THEME_SCROLLBAR_THUMB_VERTICAL: {
|
||||
aPart = (aWidgetType == NS_THEME_SCROLLBAR_THUMB_HORIZONTAL) ?
|
||||
SP_THUMBHOR : SP_THUMBVERT;
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (!aFrame)
|
||||
aState = TS_NORMAL;
|
||||
else if (IsDisabled(aFrame))
|
||||
else if (eventState & NS_EVENT_STATE_DISABLED)
|
||||
aState = TS_DISABLED;
|
||||
else {
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (eventState & NS_EVENT_STATE_ACTIVE) // Hover is not also a requirement for
|
||||
// the thumb, since the drag is not canceled
|
||||
// when you move outside the thumb.
|
||||
|
@ -719,13 +725,13 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
case NS_THEME_SCALE_THUMB_VERTICAL: {
|
||||
aPart = (aWidgetType == NS_THEME_SCALE_THUMB_HORIZONTAL) ?
|
||||
TKP_THUMB : TKP_THUMBVERT;
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (!aFrame)
|
||||
aState = TS_NORMAL;
|
||||
else if (IsDisabled(aFrame)) {
|
||||
else if (eventState & NS_EVENT_STATE_DISABLED) {
|
||||
aState = TKP_DISABLED;
|
||||
}
|
||||
else {
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (eventState & NS_EVENT_STATE_ACTIVE) // Hover is not also a requirement for
|
||||
// the thumb, since the drag is not canceled
|
||||
// when you move outside the thumb.
|
||||
|
@ -743,9 +749,10 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
case NS_THEME_SPINNER_DOWN_BUTTON: {
|
||||
aPart = (aWidgetType == NS_THEME_SPINNER_UP_BUTTON) ?
|
||||
SPNP_UP : SPNP_DOWN;
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (!aFrame)
|
||||
aState = TS_NORMAL;
|
||||
else if (IsDisabled(aFrame))
|
||||
else if (eventState & NS_EVENT_STATE_DISABLED)
|
||||
aState = TS_DISABLED;
|
||||
else
|
||||
aState = StandardGetState(aFrame, aWidgetType, PR_FALSE);
|
||||
|
@ -814,8 +821,9 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
aState = TS_NORMAL;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (IsDisabled(aFrame)) {
|
||||
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (eventState & NS_EVENT_STATE_DISABLED) {
|
||||
aState = TS_DISABLED;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -849,6 +857,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
case NS_THEME_DROPDOWN: {
|
||||
nsIContent* content = aFrame->GetContent();
|
||||
PRBool isHTML = content && content->IsHTML();
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
/* On vista, in HTML, we use CBP_DROPBORDER instead of DROPFRAME for HTML content;
|
||||
* this gives us the thin outline in HTML content, instead of the gradient-filled
|
||||
|
@ -858,14 +867,13 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
else
|
||||
aPart = CBP_DROPFRAME;
|
||||
|
||||
if (IsDisabled(aFrame)) {
|
||||
if (eventState & NS_EVENT_STATE_DISABLED) {
|
||||
aState = TS_DISABLED;
|
||||
} else if (IsReadOnly(aFrame)) {
|
||||
aState = TS_NORMAL;
|
||||
} else if (IsOpenButton(aFrame)) {
|
||||
aState = TS_ACTIVE;
|
||||
} else {
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
if (isHTML && eventState & NS_EVENT_STATE_FOCUS)
|
||||
aState = TS_ACTIVE;
|
||||
else if (eventState & NS_EVENT_STATE_HOVER && eventState & NS_EVENT_STATE_ACTIVE)
|
||||
|
@ -888,6 +896,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
if (isHTML || isMenulist)
|
||||
aFrame = parentFrame;
|
||||
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
aPart = nsUXThemeData::sIsVistaOrLater ? CBP_DROPMARKER_VISTA : CBP_DROPMARKER;
|
||||
|
||||
// For HTML controls with author styling, we should fall
|
||||
|
@ -896,7 +905,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
if (isHTML && IsWidgetStyled(aFrame->PresContext(), aFrame, NS_THEME_DROPDOWN))
|
||||
aPart = CBP_DROPMARKER;
|
||||
|
||||
if (IsDisabled(aFrame)) {
|
||||
if (eventState & NS_EVENT_STATE_DISABLED) {
|
||||
aState = TS_DISABLED;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -933,7 +942,6 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
}
|
||||
|
||||
aState = TS_NORMAL;
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
// Dropdown button active state doesn't need :hover.
|
||||
if (eventState & NS_EVENT_STATE_ACTIVE) {
|
||||
|
@ -968,6 +976,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
PRBool isOpen = PR_FALSE;
|
||||
PRBool isHover = PR_FALSE;
|
||||
nsIMenuFrame *menuFrame = do_QueryFrame(aFrame);
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
isTopLevel = IsTopLevelMenu(aFrame);
|
||||
|
||||
|
@ -987,7 +996,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
aState = MBI_NORMAL;
|
||||
|
||||
// the disabled states are offset by 3
|
||||
if (IsDisabled(aFrame))
|
||||
if (eventState & NS_EVENT_STATE_DISABLED)
|
||||
aState += 3;
|
||||
} else {
|
||||
aPart = MENU_POPUPITEM;
|
||||
|
@ -998,7 +1007,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
aState = MPI_NORMAL;
|
||||
|
||||
// the disabled states are offset by 2
|
||||
if (IsDisabled(aFrame))
|
||||
if (eventState & NS_EVENT_STATE_DISABLED)
|
||||
aState += 2;
|
||||
}
|
||||
|
||||
|
@ -1009,17 +1018,20 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
aState = 0;
|
||||
return NS_OK;
|
||||
case NS_THEME_MENUARROW:
|
||||
aPart = MENU_POPUPSUBMENU;
|
||||
aState = IsDisabled(aFrame) ? MSM_DISABLED : MSM_NORMAL;
|
||||
return NS_OK;
|
||||
{
|
||||
aPart = MENU_POPUPSUBMENU;
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
aState = (eventState & NS_EVENT_STATE_DISABLED) ? MSM_DISABLED : MSM_NORMAL;
|
||||
return NS_OK;
|
||||
}
|
||||
case NS_THEME_MENUCHECKBOX:
|
||||
case NS_THEME_MENURADIO:
|
||||
{
|
||||
PRBool isChecked;
|
||||
PRBool isDisabled;
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
// NOTE: we can probably use NS_EVENT_STATE_CHECKED
|
||||
isChecked = CheckBooleanAttr(aFrame, nsWidgetAtoms::checked);
|
||||
isDisabled = CheckBooleanAttr(aFrame, nsWidgetAtoms::disabled);
|
||||
|
||||
aPart = MENU_POPUPCHECK;
|
||||
aState = MC_CHECKMARKNORMAL;
|
||||
|
@ -1029,7 +1041,7 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType,
|
|||
aState += 2;
|
||||
|
||||
// the disabled states are offset by 1
|
||||
if (isDisabled)
|
||||
if (eventState & NS_EVENT_STATE_DISABLED)
|
||||
aState += 1;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -1237,10 +1249,10 @@ RENDER_AGAIN:
|
|||
if (isChecked)
|
||||
{
|
||||
int bgState = MCB_NORMAL;
|
||||
PRBool isDisabled = IsDisabled(aFrame);
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
// the disabled states are offset by 1
|
||||
if (isDisabled)
|
||||
if (eventState & NS_EVENT_STATE_DISABLED)
|
||||
bgState += 1;
|
||||
|
||||
SIZE checkboxBGSize(GetCheckboxBGSize(theme, hdc));
|
||||
|
@ -2418,7 +2430,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
|||
aFocused = PR_FALSE;
|
||||
|
||||
contentState = GetContentState(aFrame, aWidgetType);
|
||||
if (IsDisabled(aFrame))
|
||||
if (contentState & NS_EVENT_STATE_DISABLED)
|
||||
aState |= DFCS_INACTIVE;
|
||||
else if (IsOpenButton(aFrame))
|
||||
aState |= DFCS_PUSHED;
|
||||
|
@ -2478,7 +2490,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
|||
aFocused = PR_TRUE;
|
||||
}
|
||||
|
||||
if (IsDisabled(aFrame)) {
|
||||
if (contentState & NS_EVENT_STATE_DISABLED) {
|
||||
aState |= DFCS_INACTIVE;
|
||||
} else if (contentState & NS_EVENT_STATE_ACTIVE &&
|
||||
contentState & NS_EVENT_STATE_HOVER) {
|
||||
|
@ -2494,6 +2506,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
|||
PRBool isOpen = PR_FALSE;
|
||||
PRBool isContainer = PR_FALSE;
|
||||
nsIMenuFrame *menuFrame = do_QueryFrame(aFrame);
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
// We indicate top-level-ness using aPart. 0 is a normal menu item,
|
||||
// 1 is a top-level menu item. The state of the item is composed of
|
||||
|
@ -2510,7 +2523,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
|||
isContainer = menuFrame->IsMenu();
|
||||
}
|
||||
|
||||
if (IsDisabled(aFrame))
|
||||
if (eventState & NS_EVENT_STATE_DISABLED)
|
||||
aState |= DFCS_INACTIVE;
|
||||
|
||||
if (isTopLevel) {
|
||||
|
@ -2528,7 +2541,9 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
|||
case NS_THEME_MENURADIO:
|
||||
case NS_THEME_MENUARROW: {
|
||||
aState = 0;
|
||||
if (IsDisabled(aFrame))
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
if (eventState & NS_EVENT_STATE_DISABLED)
|
||||
aState |= DFCS_INACTIVE;
|
||||
if (IsMenuActive(aFrame, aWidgetType))
|
||||
aState |= DFCS_HOT;
|
||||
|
@ -2585,7 +2600,9 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
|||
if (isHTML || isMenulist)
|
||||
aFrame = parentFrame;
|
||||
|
||||
if (IsDisabled(aFrame)) {
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
if (eventState & NS_EVENT_STATE_DISABLED) {
|
||||
aState |= DFCS_INACTIVE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2603,8 +2620,6 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
|||
if (isOpen && (isHTML || isMenulist))
|
||||
return NS_OK;
|
||||
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
// Dropdown button active state doesn't need :hover.
|
||||
if (eventState & NS_EVENT_STATE_ACTIVE)
|
||||
aState |= DFCS_PUSHED | DFCS_FLAT;
|
||||
|
@ -2616,7 +2631,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
|||
case NS_THEME_SCROLLBAR_BUTTON_DOWN:
|
||||
case NS_THEME_SCROLLBAR_BUTTON_LEFT:
|
||||
case NS_THEME_SCROLLBAR_BUTTON_RIGHT: {
|
||||
PRInt32 contentState;
|
||||
PRInt32 contentState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
aPart = DFC_SCROLL;
|
||||
switch (aWidgetType) {
|
||||
|
@ -2632,12 +2647,11 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
|||
case NS_THEME_SCROLLBAR_BUTTON_RIGHT:
|
||||
aState = DFCS_SCROLLRIGHT;
|
||||
break;
|
||||
}
|
||||
|
||||
if (IsDisabled(aFrame))
|
||||
}
|
||||
|
||||
if (contentState & NS_EVENT_STATE_DISABLED)
|
||||
aState |= DFCS_INACTIVE;
|
||||
else {
|
||||
contentState = GetContentState(aFrame, aWidgetType);
|
||||
#ifndef WINCE
|
||||
if (contentState & NS_EVENT_STATE_HOVER && contentState & NS_EVENT_STATE_ACTIVE)
|
||||
aState |= DFCS_PUSHED | DFCS_FLAT;
|
||||
|
@ -2648,7 +2662,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
|||
}
|
||||
case NS_THEME_SPINNER_UP_BUTTON:
|
||||
case NS_THEME_SPINNER_DOWN_BUTTON: {
|
||||
PRInt32 contentState;
|
||||
PRInt32 contentState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
aPart = DFC_SCROLL;
|
||||
switch (aWidgetType) {
|
||||
|
@ -2658,12 +2672,11 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
|
|||
case NS_THEME_SPINNER_DOWN_BUTTON:
|
||||
aState = DFCS_SCROLLDOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
if (IsDisabled(aFrame))
|
||||
}
|
||||
|
||||
if (contentState & NS_EVENT_STATE_DISABLED)
|
||||
aState |= DFCS_INACTIVE;
|
||||
else {
|
||||
contentState = GetContentState(aFrame, aWidgetType);
|
||||
if (contentState & NS_EVENT_STATE_HOVER && contentState & NS_EVENT_STATE_ACTIVE)
|
||||
aState |= DFCS_PUSHED;
|
||||
}
|
||||
|
@ -2993,9 +3006,10 @@ RENDER_AGAIN:
|
|||
case NS_THEME_DROPDOWN_TEXTFIELD: {
|
||||
// Draw inset edge
|
||||
::DrawEdge(hdc, &widgetRect, EDGE_SUNKEN, BF_RECT | BF_ADJUST);
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
// Fill in background
|
||||
if (IsDisabled(aFrame) ||
|
||||
if ((eventState & NS_EVENT_STATE_DISABLED) ||
|
||||
(aFrame->GetContent()->IsXUL() &&
|
||||
IsReadOnly(aFrame)))
|
||||
::FillRect(hdc, &widgetRect, (HBRUSH) (COLOR_BTNFACE+1));
|
||||
|
@ -3054,14 +3068,17 @@ RENDER_AGAIN:
|
|||
|
||||
break;
|
||||
case NS_THEME_SCALE_THUMB_VERTICAL:
|
||||
case NS_THEME_SCALE_THUMB_HORIZONTAL:
|
||||
case NS_THEME_SCALE_THUMB_HORIZONTAL: {
|
||||
PRInt32 eventState = GetContentState(aFrame, aWidgetType);
|
||||
|
||||
::DrawEdge(hdc, &widgetRect, EDGE_RAISED, BF_RECT | BF_SOFT | BF_MIDDLE | BF_ADJUST);
|
||||
if (IsDisabled(aFrame)) {
|
||||
if (NS_EVENT_STATE_DISABLED) {
|
||||
DrawCheckedRect(hdc, widgetRect, COLOR_3DFACE, COLOR_3DHILIGHT,
|
||||
(HBRUSH) COLOR_3DHILIGHT);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
// Draw scrollbar track background
|
||||
case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
|
||||
case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL: {
|
||||
|
|
|
@ -80,11 +80,6 @@ class nsNativeTheme
|
|||
|
||||
// Accessors to widget-specific state information
|
||||
|
||||
// all widgets:
|
||||
PRBool IsDisabled(nsIFrame* aFrame) {
|
||||
return CheckBooleanAttr(aFrame, nsWidgetAtoms::disabled);
|
||||
}
|
||||
|
||||
// RTL chrome direction
|
||||
PRBool IsFrameRTL(nsIFrame* aFrame);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче