Clean up API (and its callers) for getting style data: remove unneeded null checks and switch to new inline member functions (one for each struct) that return values. b=197205 r+sr=roc a=brendan

This commit is contained in:
dbaron%dbaron.org 2005-08-20 07:13:26 +00:00
Родитель 84df32af79
Коммит acee7d0eba
2 изменённых файлов: 8 добавлений и 14 удалений

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

@ -1128,8 +1128,7 @@ PRBool nsNativeThemeWin::IsWidgetStyled(nsIPresContext* aPresContext, nsIFrame*
}
// Check whether background differs from default
const nsStyleBackground* ourBG;
::GetStyleData(aFrame, &ourBG);
const nsStyleBackground* ourBG = aFrame->GetStyleBackground();
if (ourBG->mBackgroundColor != defaultBGColor ||
ourBG->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT ||
@ -1137,8 +1136,7 @@ PRBool nsNativeThemeWin::IsWidgetStyled(nsIPresContext* aPresContext, nsIFrame*
return PR_TRUE;
// Check whether border style or color differs from default
const nsStyleBorder* ourBorder;
::GetStyleData(aFrame, &ourBorder);
const nsStyleBorder* ourBorder = aFrame->GetStyleBorder();
for (PRInt32 i = 0; i < 4; i++) {
if (ourBorder->GetBorderStyle(i) != defaultBorderStyle)
@ -1259,9 +1257,8 @@ nsNativeThemeWin::ClassicGetWidgetBorder(nsIDeviceContext* aContext,
{
switch (aWidgetType) {
case NS_THEME_BUTTON: {
const nsStyleUserInterface *uiData = nsnull;
::GetStyleData(aFrame, &uiData);
if (uiData && uiData->mUserFocus == NS_STYLE_USER_FOCUS_IGNORE) {
const nsStyleUserInterface *uiData = aFrame->GetStyleUserInterface();
if (uiData->mUserFocus == NS_STYLE_USER_FOCUS_IGNORE) {
// use different padding for non-focusable buttons
(*aResult).top = (*aResult).left = 1;
(*aResult).bottom = (*aResult).right = 2;
@ -1415,10 +1412,9 @@ nsresult nsNativeThemeWin::ClassicGetThemePartAndState(nsIFrame* aFrame, PRUint8
else {
if (contentState & NS_EVENT_STATE_ACTIVE && contentState & NS_EVENT_STATE_HOVER) {
aState |= DFCS_PUSHED;
const nsStyleUserInterface *uiData = nsnull;
::GetStyleData(aFrame, &uiData);
const nsStyleUserInterface *uiData = aFrame->GetStyleUserInterface();
// The down state is flat if the button is focusable
if (uiData && uiData->mUserFocus == NS_STYLE_USER_FOCUS_NORMAL) {
if (uiData->mUserFocus == NS_STYLE_USER_FOCUS_NORMAL) {
nsCOMPtr<nsIContent> content;
aFrame->GetContent(getter_AddRefs(content));
if (!content->IsContentOfType(nsIContent::eHTML))

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

@ -281,8 +281,7 @@ nsNativeTheme::IsWidgetStyled(nsIPresContext* aPresContext, nsIFrame* aFrame,
}
// Check whether background differs from default
const nsStyleBackground* ourBG;
::GetStyleData(aFrame, &ourBG);
const nsStyleBackground* ourBG = aFrame->GetStyleBackground();
if (defaultBGTransparent) {
if (!(ourBG->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT))
@ -295,8 +294,7 @@ nsNativeTheme::IsWidgetStyled(nsIPresContext* aPresContext, nsIFrame* aFrame,
return PR_TRUE;
// Check whether border style or color differs from default
const nsStyleBorder* ourBorder;
::GetStyleData(aFrame, &ourBorder);
const nsStyleBorder* ourBorder = aFrame->GetStyleBorder();
for (PRInt32 i = 0; i < 4; ++i) {
if (ourBorder->GetBorderStyle(i) != defaultBorderStyle)