зеркало из https://github.com/mozilla/gecko-dev.git
Bug 427928 - part 5, Add NS_THEME_FOCUS_OUTLINE support for Windows widgets. r=roc
This commit is contained in:
Родитель
811ebd88de
Коммит
217a8aebfe
|
@ -735,6 +735,7 @@ nsNativeThemeWin::GetTheme(uint8_t aWidgetType)
|
|||
case NS_THEME_NUMBER_INPUT:
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
case NS_THEME_FOCUS_OUTLINE:
|
||||
return nsUXThemeData::GetTheme(eUXEdit);
|
||||
case NS_THEME_TOOLTIP:
|
||||
// XP/2K3 should force a classic treatment of tooltips
|
||||
|
@ -992,6 +993,17 @@ nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType,
|
|||
|
||||
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: {
|
||||
aPart = TTP_STANDARD;
|
||||
aState = TS_NORMAL;
|
||||
|
@ -1835,6 +1847,24 @@ RENDER_AGAIN:
|
|||
DrawThemedProgressMeter(aFrame, aWidgetType, theme, hdc, part, state,
|
||||
&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
|
||||
// background, instead opting to be drawn specially below.
|
||||
else if (part >= 0) {
|
||||
|
@ -2161,8 +2191,8 @@ nsNativeThemeWin::GetWidgetPadding(nsDeviceContext* aContext,
|
|||
bool
|
||||
nsNativeThemeWin::GetWidgetOverflow(nsDeviceContext* aContext,
|
||||
nsIFrame* aFrame,
|
||||
uint8_t aOverflowRect,
|
||||
nsRect* aResult)
|
||||
uint8_t aWidgetType,
|
||||
nsRect* aOverflowRect)
|
||||
{
|
||||
/* This is disabled for now, because it causes invalidation problems --
|
||||
* see bug 420381. The effect of not updating the overflow area is that
|
||||
|
@ -2192,6 +2222,20 @@ nsNativeThemeWin::GetWidgetOverflow(nsDeviceContext* aContext,
|
|||
}
|
||||
#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;
|
||||
}
|
||||
|
||||
|
@ -2545,6 +2589,10 @@ nsNativeThemeWin::ThemeSupportsWidget(nsPresContext* aPresContext,
|
|||
if (aPresContext && !aPresContext->PresShell()->IsThemeSupportEnabled())
|
||||
return false;
|
||||
|
||||
if (aWidgetType == NS_THEME_FOCUS_OUTLINE) {
|
||||
return true;
|
||||
}
|
||||
|
||||
HANDLE theme = nullptr;
|
||||
if (aWidgetType == NS_THEME_CHECKBOX_CONTAINER)
|
||||
theme = GetTheme(NS_THEME_CHECKBOX);
|
||||
|
@ -2766,6 +2814,7 @@ nsNativeThemeWin::ClassicGetWidgetBorder(nsDeviceContext* aContext,
|
|||
case NS_THEME_NUMBER_INPUT:
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
case NS_THEME_FOCUS_OUTLINE:
|
||||
(*aResult).top = (*aResult).left = (*aResult).bottom = (*aResult).right = 2;
|
||||
break;
|
||||
case NS_THEME_STATUSBAR_PANEL:
|
||||
|
@ -3157,6 +3206,7 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, uint8_t
|
|||
case NS_THEME_LISTBOX:
|
||||
case NS_THEME_TREEVIEW:
|
||||
case NS_THEME_NUMBER_INPUT:
|
||||
case NS_THEME_FOCUS_OUTLINE:
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
case NS_THEME_DROPDOWN:
|
||||
|
@ -3957,6 +4007,7 @@ nsNativeThemeWin::GetWidgetNativeDrawingFlags(uint8_t aWidgetType)
|
|||
switch (aWidgetType) {
|
||||
case NS_THEME_BUTTON:
|
||||
case NS_THEME_NUMBER_INPUT:
|
||||
case NS_THEME_FOCUS_OUTLINE:
|
||||
case NS_THEME_TEXTFIELD:
|
||||
case NS_THEME_TEXTFIELD_MULTILINE:
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче