mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-27 21:00:50 +00:00
Bug 427928 - part 5, Add NS_THEME_FOCUS_OUTLINE support for Windows widgets. r=roc
This commit is contained in:
parent
811ebd88de
commit
217a8aebfe
@ -735,6 +735,7 @@ nsNativeThemeWin::GetTheme(uint8_t aWidgetType)
|
|||||||
case NS_THEME_NUMBER_INPUT:
|
case NS_THEME_NUMBER_INPUT:
|
||||||
case NS_THEME_TEXTFIELD:
|
case NS_THEME_TEXTFIELD:
|
||||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||||
|
case NS_THEME_FOCUS_OUTLINE:
|
||||||
return nsUXThemeData::GetTheme(eUXEdit);
|
return nsUXThemeData::GetTheme(eUXEdit);
|
||||||
case NS_THEME_TOOLTIP:
|
case NS_THEME_TOOLTIP:
|
||||||
// XP/2K3 should force a classic treatment of tooltips
|
// XP/2K3 should force a classic treatment of tooltips
|
||||||
@ -992,6 +993,17 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
|
|||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
case NS_THEME_FOCUS_OUTLINE: {
|
||||||
|
if (IsVistaOrLater()) {
|
||||||
|
// XXX the EDITBORDER values don't respect DTBG_OMITCONTENT
|
||||||
|
aPart = TFP_TEXTFIELD; //TFP_EDITBORDER_NOSCROLL;
|
||||||
|
aState = TS_FOCUSED; //TFS_EDITBORDER_FOCUSED;
|
||||||
|
} else {
|
||||||
|
aPart = TFP_TEXTFIELD;
|
||||||
|
aState = TS_FOCUSED;
|
||||||
|
}
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
case NS_THEME_TOOLTIP: {
|
case NS_THEME_TOOLTIP: {
|
||||||
aPart = TTP_STANDARD;
|
aPart = TTP_STANDARD;
|
||||||
aState = TS_NORMAL;
|
aState = TS_NORMAL;
|
||||||
@ -1835,6 +1847,24 @@ RENDER_AGAIN:
|
|||||||
DrawThemedProgressMeter(aFrame, aWidgetType, theme, hdc, part, state,
|
DrawThemedProgressMeter(aFrame, aWidgetType, theme, hdc, part, state,
|
||||||
&widgetRect, &clipRect, p2a);
|
&widgetRect, &clipRect, p2a);
|
||||||
}
|
}
|
||||||
|
else if (aWidgetType == NS_THEME_FOCUS_OUTLINE) {
|
||||||
|
// Inflate 'widgetRect' with the focus outline size.
|
||||||
|
nsIntMargin border;
|
||||||
|
if (NS_SUCCEEDED(GetWidgetBorder(aFrame->PresContext()->DeviceContext(),
|
||||||
|
aFrame, aWidgetType, &border))) {
|
||||||
|
widgetRect.left -= border.left;
|
||||||
|
widgetRect.right += border.right;
|
||||||
|
widgetRect.top -= border.top;
|
||||||
|
widgetRect.bottom += border.bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
DTBGOPTS opts = {
|
||||||
|
sizeof(DTBGOPTS),
|
||||||
|
DTBG_OMITCONTENT | DTBG_CLIPRECT,
|
||||||
|
clipRect
|
||||||
|
};
|
||||||
|
DrawThemeBackgroundEx(theme, hdc, part, state, &widgetRect, &opts);
|
||||||
|
}
|
||||||
// If part is negative, the element wishes us to not render a themed
|
// If part is negative, the element wishes us to not render a themed
|
||||||
// background, instead opting to be drawn specially below.
|
// background, instead opting to be drawn specially below.
|
||||||
else if (part >= 0) {
|
else if (part >= 0) {
|
||||||
@ -2161,8 +2191,8 @@ nsNativeThemeWin::GetWidgetPadding(nsDeviceContext* aContext,
|
|||||||
bool
|
bool
|
||||||
nsNativeThemeWin::GetWidgetOverflow(nsDeviceContext* aContext,
|
nsNativeThemeWin::GetWidgetOverflow(nsDeviceContext* aContext,
|
||||||
nsIFrame* aFrame,
|
nsIFrame* aFrame,
|
||||||
uint8_t aOverflowRect,
|
uint8_t aWidgetType,
|
||||||
nsRect* aResult)
|
nsRect* aOverflowRect)
|
||||||
{
|
{
|
||||||
/* This is disabled for now, because it causes invalidation problems --
|
/* This is disabled for now, because it causes invalidation problems --
|
||||||
* see bug 420381. The effect of not updating the overflow area is that
|
* see bug 420381. The effect of not updating the overflow area is that
|
||||||
@ -2192,6 +2222,20 @@ nsNativeThemeWin::GetWidgetOverflow(nsDeviceContext* aContext,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (aWidgetType == NS_THEME_FOCUS_OUTLINE) {
|
||||||
|
nsIntMargin border;
|
||||||
|
nsresult rv = GetWidgetBorder(aContext, aFrame, aWidgetType, &border);
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
int32_t p2a = aContext->AppUnitsPerDevPixel();
|
||||||
|
nsMargin m(NSIntPixelsToAppUnits(border.top, p2a),
|
||||||
|
NSIntPixelsToAppUnits(border.right, p2a),
|
||||||
|
NSIntPixelsToAppUnits(border.bottom, p2a),
|
||||||
|
NSIntPixelsToAppUnits(border.left, p2a));
|
||||||
|
aOverflowRect->Inflate(m);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2545,6 +2589,10 @@ nsNativeThemeWin::ThemeSupportsWidget(nsPresContext* aPresContext,
|
|||||||
if (aPresContext && !aPresContext->PresShell()->IsThemeSupportEnabled())
|
if (aPresContext && !aPresContext->PresShell()->IsThemeSupportEnabled())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (aWidgetType == NS_THEME_FOCUS_OUTLINE) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
HANDLE theme = nullptr;
|
HANDLE theme = nullptr;
|
||||||
if (aWidgetType == NS_THEME_CHECKBOX_CONTAINER)
|
if (aWidgetType == NS_THEME_CHECKBOX_CONTAINER)
|
||||||
theme = GetTheme(NS_THEME_CHECKBOX);
|
theme = GetTheme(NS_THEME_CHECKBOX);
|
||||||
@ -2766,6 +2814,7 @@ nsNativeThemeWin::ClassicGetWidgetBorder(nsDeviceContext* aContext,
|
|||||||
case NS_THEME_NUMBER_INPUT:
|
case NS_THEME_NUMBER_INPUT:
|
||||||
case NS_THEME_TEXTFIELD:
|
case NS_THEME_TEXTFIELD:
|
||||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||||
|
case NS_THEME_FOCUS_OUTLINE:
|
||||||
(*aResult).top = (*aResult).left = (*aResult).bottom = (*aResult).right = 2;
|
(*aResult).top = (*aResult).left = (*aResult).bottom = (*aResult).right = 2;
|
||||||
break;
|
break;
|
||||||
case NS_THEME_STATUSBAR_PANEL:
|
case NS_THEME_STATUSBAR_PANEL:
|
||||||
@ -3157,6 +3206,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, uint8_t
|
|||||||
case NS_THEME_LISTBOX:
|
case NS_THEME_LISTBOX:
|
||||||
case NS_THEME_TREEVIEW:
|
case NS_THEME_TREEVIEW:
|
||||||
case NS_THEME_NUMBER_INPUT:
|
case NS_THEME_NUMBER_INPUT:
|
||||||
|
case NS_THEME_FOCUS_OUTLINE:
|
||||||
case NS_THEME_TEXTFIELD:
|
case NS_THEME_TEXTFIELD:
|
||||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||||
case NS_THEME_DROPDOWN:
|
case NS_THEME_DROPDOWN:
|
||||||
@ -3957,6 +4007,7 @@ nsNativeThemeWin::GetWidgetNativeDrawingFlags(uint8_t aWidgetType)
|
|||||||
switch (aWidgetType) {
|
switch (aWidgetType) {
|
||||||
case NS_THEME_BUTTON:
|
case NS_THEME_BUTTON:
|
||||||
case NS_THEME_NUMBER_INPUT:
|
case NS_THEME_NUMBER_INPUT:
|
||||||
|
case NS_THEME_FOCUS_OUTLINE:
|
||||||
case NS_THEME_TEXTFIELD:
|
case NS_THEME_TEXTFIELD:
|
||||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user