bool nsNativeThemeQt::ThemeSupportsWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType) { switch (aWidgetType) { case NS_THEME_SCROLLBAR: case NS_THEME_SCROLLBAR_BUTTON_UP: case NS_THEME_SCROLLBAR_BUTTON_DOWN: case NS_THEME_SCROLLBAR_BUTTON_LEFT: case NS_THEME_SCROLLBAR_BUTTON_RIGHT: case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL: case NS_THEME_SCROLLBAR_THUMB_VERTICAL: //case NS_THEME_SCROLLBAR_GRIPPER_HORIZONTAL: //case NS_THEME_SCROLLBAR_GRIPPER_VERTICAL: case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL: case NS_THEME_SCROLLBAR_TRACK_VERTICAL: case NS_THEME_RADIO: case NS_THEME_CHECKBOX: case NS_THEME_BUTTON_BEVEL: case NS_THEME_BUTTON: case NS_THEME_DROPDOWN: case NS_THEME_DROPDOWN_BUTTON: case NS_THEME_DROPDOWN_TEXT: case NS_THEME_DROPDOWN_TEXTFIELD: case NS_THEME_TEXTFIELD: case NS_THEME_TEXTFIELD_MULTILINE: case NS_THEME_LISTBOX: case NS_THEME_MENUPOPUP: return !IsWidgetStyled(aPresContext, aFrame, aWidgetType); default: break; } return PR_FALSE; }
PRBool nsNativeTheme::IsWidgetStyled(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType) { // Check for specific widgets to see if HTML has overridden the style. if (!aFrame) return PR_FALSE; // Resizers have some special handling, dependent on whether in a scrollable // container or not. If so, use the scrollable container's to determine // whether the style is overriden instead of the resizer. This allows a // non-native transparent resizer to be used instead. Otherwise, we just // fall through and return false. if (aWidgetType == NS_THEME_RESIZER) { nsIFrame* parentFrame = aFrame->GetParent(); if (parentFrame && parentFrame->GetType() == nsWidgetAtoms::scrollFrame) { // if the parent is a scrollframe, the resizer should be native themed // only if the scrollable area doesn't override the widget style. parentFrame = parentFrame->GetParent(); if (parentFrame) { return IsWidgetStyled(aPresContext, parentFrame, parentFrame->GetStyleDisplay()->mAppearance); } } } /** * Progress bar appearance should be the same for the bar and the container * frame. nsProgressFrame owns the logic and will tell us what we should do. */ if (aWidgetType == NS_THEME_PROGRESSBAR_CHUNK || aWidgetType == NS_THEME_PROGRESSBAR) { nsProgressFrame* progressFrame = do_QueryFrame(aWidgetType == NS_THEME_PROGRESSBAR_CHUNK ? aFrame->GetParent() : aFrame); if (progressFrame) { return !progressFrame->ShouldUseNativeStyle(); } } return (aWidgetType == NS_THEME_BUTTON || aWidgetType == NS_THEME_TEXTFIELD || aWidgetType == NS_THEME_TEXTFIELD_MULTILINE || aWidgetType == NS_THEME_LISTBOX || aWidgetType == NS_THEME_DROPDOWN) && aFrame->GetContent()->IsHTML() && aPresContext->HasAuthorSpecifiedRules(aFrame, NS_AUTHOR_SPECIFIED_BORDER | NS_AUTHOR_SPECIFIED_BACKGROUND); }