Backout bug 555133 to fix bug 555950.

This commit is contained in:
Jim Mathies 2010-03-31 12:55:41 -05:00
Родитель cdd5b53b4b
Коммит 0b5f0c9191
15 изменённых файлов: 37 добавлений и 50 удалений

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

@ -59,7 +59,8 @@ class nsIAtom;
// IID for the nsITheme interface // IID for the nsITheme interface
// {887e8902-db6b-41b4-8481-a80f49c5a93a} // {887e8902-db6b-41b4-8481-a80f49c5a93a}
#define NS_ITHEME_IID \ #define NS_ITHEME_IID \
{ 0x23db7c13, 0x873d, 0x4fb5, { 0xaf, 0x29, 0xc1, 0xe9, 0xed, 0x91, 0x23, 0xf9 } } { 0x887e8902, 0xdb6b, 0x41b4, { 0x84, 0x81, 0xa8, 0x0f, 0x49, 0xc5, 0xa9, 0x3a } }
// {D930E29B-6909-44e5-AB4B-AF10D6923705} // {D930E29B-6909-44e5-AB4B-AF10D6923705}
#define NS_THEMERENDERER_CID \ #define NS_THEMERENDERER_CID \
{ 0xd930e29b, 0x6909, 0x44e5, { 0xab, 0x4b, 0xaf, 0x10, 0xd6, 0x92, 0x37, 0x5 } } { 0xd930e29b, 0x6909, 0x44e5, { 0xab, 0x4b, 0xaf, 0x10, 0xd6, 0x92, 0x37, 0x5 } }
@ -138,18 +139,7 @@ public:
nsIntSize* aResult, nsIntSize* aResult,
PRBool* aIsOverridable)=0; PRBool* aIsOverridable)=0;
virtual nsTransparencyMode GetWidgetTransparency(PRUint8 aWidgetType)=0;
typedef enum Transparency {
eOpaque = 0,
eTransparent,
eUnknownTransparency
};
/**
* Returns what we know about the transparency of the widget.
*/
virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, PRUint8 aWidgetType)
{ return eUnknownTransparency; }
NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType, NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
nsIAtom* aAttribute, PRBool* aShouldRepaint)=0; nsIAtom* aAttribute, PRBool* aShouldRepaint)=0;

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

@ -1069,7 +1069,7 @@ PRBool
nsDisplayBackground::IsOpaque(nsDisplayListBuilder* aBuilder) { nsDisplayBackground::IsOpaque(nsDisplayListBuilder* aBuilder) {
// theme background overrides any other background // theme background overrides any other background
if (mIsThemed) if (mIsThemed)
return mThemeTransparency == nsITheme::eOpaque; return PR_FALSE;
const nsStyleBackground* bg; const nsStyleBackground* bg;

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

@ -1305,7 +1305,7 @@ private:
class nsDisplayBackground : public nsDisplayItem { class nsDisplayBackground : public nsDisplayItem {
public: public:
nsDisplayBackground(nsIFrame* aFrame) : nsDisplayItem(aFrame) { nsDisplayBackground(nsIFrame* aFrame) : nsDisplayItem(aFrame) {
mIsThemed = mFrame->IsThemed(&mThemeTransparency); mIsThemed = mFrame->IsThemed();
MOZ_COUNT_CTOR(nsDisplayBackground); MOZ_COUNT_CTOR(nsDisplayBackground);
} }
#ifdef NS_BUILD_REFCNT_LOGGING #ifdef NS_BUILD_REFCNT_LOGGING
@ -1325,7 +1325,6 @@ public:
private: private:
/* Used to cache mFrame->IsThemed() since it isn't a cheap call */ /* Used to cache mFrame->IsThemed() since it isn't a cheap call */
PRPackedBool mIsThemed; PRPackedBool mIsThemed;
nsITheme::Transparency mThemeTransparency;
}; };
/** /**

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

@ -3244,11 +3244,9 @@ nsLayoutUtils::GetFrameTransparency(nsIFrame* aBackgroundFrame,
if (HasNonZeroCorner(aCSSRootFrame->GetStyleContext()->GetStyleBorder()->mBorderRadius)) if (HasNonZeroCorner(aCSSRootFrame->GetStyleContext()->GetStyleBorder()->mBorderRadius))
return eTransparencyTransparent; return eTransparencyTransparent;
nsITheme::Transparency transparency; nsTransparencyMode transparency;
if (aCSSRootFrame->IsThemed(&transparency)) if (aCSSRootFrame->IsThemed(&transparency))
return transparency == nsITheme::eTransparent return transparency;
? eTransparencyTransparent
: eTransparencyOpaque;
if (aCSSRootFrame->GetStyleDisplay()->mAppearance == NS_THEME_WIN_GLASS) if (aCSSRootFrame->GetStyleDisplay()->mAppearance == NS_THEME_WIN_GLASS)
return eTransparencyGlass; return eTransparencyGlass;

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

@ -977,19 +977,19 @@ public:
const nsRect& aDirtyRect, const nsRect& aDirtyRect,
nsDisplayList* aList); nsDisplayList* aList);
PRBool IsThemed(nsITheme::Transparency* aTransparencyState = nsnull) { PRBool IsThemed(nsTransparencyMode* aTransparencyMode = nsnull) {
return IsThemed(GetStyleDisplay(), aTransparencyState); return IsThemed(GetStyleDisplay(), aTransparencyMode);
} }
PRBool IsThemed(const nsStyleDisplay* aDisp, PRBool IsThemed(const nsStyleDisplay* aDisp,
nsITheme::Transparency* aTransparencyState = nsnull) { nsTransparencyMode* aTransparencyMode = nsnull) {
if (!aDisp->mAppearance) if (!aDisp->mAppearance)
return PR_FALSE; return PR_FALSE;
nsPresContext* pc = PresContext(); nsPresContext* pc = PresContext();
nsITheme *theme = pc->GetTheme(); nsITheme *theme = pc->GetTheme();
if(!theme || !theme->ThemeSupportsWidget(pc, this, aDisp->mAppearance)) if(!theme || !theme->ThemeSupportsWidget(pc, this, aDisp->mAppearance))
return PR_FALSE; return PR_FALSE;
if (aTransparencyState) { if (aTransparencyMode) {
*aTransparencyState = theme->GetWidgetTransparency(this, aDisp->mAppearance); *aTransparencyMode = theme->GetWidgetTransparency(aDisp->mAppearance);
} }
return PR_TRUE; return PR_TRUE;
} }

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

@ -90,7 +90,7 @@ public:
PRBool WidgetIsContainer(PRUint8 aWidgetType); PRBool WidgetIsContainer(PRUint8 aWidgetType);
PRBool ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType); PRBool ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType);
PRBool ThemeNeedsComboboxDropmarker(); PRBool ThemeNeedsComboboxDropmarker();
virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, PRUint8 aWidgetType); virtual nsTransparencyMode GetWidgetTransparency(PRUint8 aWidgetType);
protected: protected:

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

@ -2469,12 +2469,12 @@ nsNativeThemeCocoa::ThemeNeedsComboboxDropmarker()
return PR_FALSE; return PR_FALSE;
} }
nsITheme::Transparency nsTransparencyMode
nsNativeThemeCocoa::GetWidgetTransparency(nsIFrame* aFrame, PRUint8 aWidgetType) nsNativeThemeCocoa::GetWidgetTransparency(PRUint8 aWidgetType)
{ {
if (aWidgetType == NS_THEME_MENUPOPUP || if (aWidgetType == NS_THEME_MENUPOPUP ||
aWidgetType == NS_THEME_TOOLTIP) aWidgetType == NS_THEME_TOOLTIP)
return eTransparent; return eTransparencyTransparent;
return eUnknownTransparency; return eTransparencyOpaque;
} }

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

@ -1341,3 +1341,9 @@ nsNativeThemeGTK::ThemeNeedsComboboxDropmarker()
{ {
return PR_FALSE; return PR_FALSE;
} }
nsTransparencyMode
nsNativeThemeGTK::GetWidgetTransparency(PRUint8 aWidgetType)
{
return eTransparencyOpaque;
}

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

@ -92,6 +92,8 @@ public:
PRBool ThemeNeedsComboboxDropmarker(); PRBool ThemeNeedsComboboxDropmarker();
virtual nsTransparencyMode GetWidgetTransparency(PRUint8 aWidgetType);
nsNativeThemeGTK(); nsNativeThemeGTK();
virtual ~nsNativeThemeGTK(); virtual ~nsNativeThemeGTK();

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

@ -627,6 +627,12 @@ nsNativeThemeQt::ThemeNeedsComboboxDropmarker()
return PR_TRUE; return PR_TRUE;
} }
nsTransparencyMode
nsNativeThemeQt::GetWidgetTransparency(PRUint8 aWidgetType)
{
return eTransparencyOpaque;
}
void void
nsNativeThemeQt::InitButtonStyle(PRUint8 aWidgetType, nsNativeThemeQt::InitButtonStyle(PRUint8 aWidgetType,
nsIFrame* aFrame, nsIFrame* aFrame,

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

@ -99,6 +99,8 @@ public:
PRBool ThemeNeedsComboboxDropmarker(); PRBool ThemeNeedsComboboxDropmarker();
virtual nsTransparencyMode GetWidgetTransparency(PRUint8 aWidgetType);
nsNativeThemeQt(); nsNativeThemeQt();
virtual ~nsNativeThemeQt(); virtual ~nsNativeThemeQt();

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

@ -1776,22 +1776,10 @@ nsNativeThemeWin::ThemeNeedsComboboxDropmarker()
return PR_TRUE; return PR_TRUE;
} }
nsITheme::Transparency nsTransparencyMode
nsNativeThemeWin::GetWidgetTransparency(nsIFrame* aFrame, PRUint8 aWidgetType) nsNativeThemeWin::GetWidgetTransparency(PRUint8 aWidgetType)
{ {
HANDLE theme = GetTheme(aWidgetType); return eTransparencyOpaque;
// For the classic theme we don't really have a way of knowing
if (!theme)
return eUnknownTransparency;
PRInt32 part, state;
nsresult rv = GetThemePartAndState(aFrame, aWidgetType, part, state);
// Fail conservatively
NS_ENSURE_SUCCESS(rv, eUnknownTransparency);
if (nsUXThemeData::isThemeBackgroundPartiallyTransparent(theme, part, state))
return eTransparent;
return eOpaque;
} }
/* Windows 9x/NT/2000/Classic XP Theme Support */ /* Windows 9x/NT/2000/Classic XP Theme Support */

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

@ -78,7 +78,7 @@ public:
nsIntSize* aResult, nsIntSize* aResult,
PRBool* aIsOverridable); PRBool* aIsOverridable);
virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, PRUint8 aWidgetType); virtual nsTransparencyMode GetWidgetTransparency(PRUint8 aWidgetType);
NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType, NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType,
nsIAtom* aAttribute, PRBool* aShouldRepaint); nsIAtom* aAttribute, PRBool* aShouldRepaint);

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

@ -83,7 +83,6 @@ nsUXThemeData::GetThemeMarginsPtr nsUXThemeData::getThemeMargins = NULL;
nsUXThemeData::IsAppThemedPtr nsUXThemeData::isAppThemed = NULL; nsUXThemeData::IsAppThemedPtr nsUXThemeData::isAppThemed = NULL;
nsUXThemeData::GetCurrentThemeNamePtr nsUXThemeData::getCurrentThemeName = NULL; nsUXThemeData::GetCurrentThemeNamePtr nsUXThemeData::getCurrentThemeName = NULL;
nsUXThemeData::GetThemeSysColorPtr nsUXThemeData::getThemeSysColor = NULL; nsUXThemeData::GetThemeSysColorPtr nsUXThemeData::getThemeSysColor = NULL;
nsUXThemeData::IsThemeBackgroundPartiallyTransparentPtr nsUXThemeData::isThemeBackgroundPartiallyTransparent = NULL;
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
nsUXThemeData::DwmExtendFrameIntoClientAreaProc nsUXThemeData::dwmExtendFrameIntoClientAreaPtr = NULL; nsUXThemeData::DwmExtendFrameIntoClientAreaProc nsUXThemeData::dwmExtendFrameIntoClientAreaPtr = NULL;
@ -125,7 +124,6 @@ nsUXThemeData::Initialize()
isAppThemed = (IsAppThemedPtr)GetProcAddress(sThemeDLL, "IsAppThemed"); isAppThemed = (IsAppThemedPtr)GetProcAddress(sThemeDLL, "IsAppThemed");
getCurrentThemeName = (GetCurrentThemeNamePtr)GetProcAddress(sThemeDLL, "GetCurrentThemeName"); getCurrentThemeName = (GetCurrentThemeNamePtr)GetProcAddress(sThemeDLL, "GetCurrentThemeName");
getThemeSysColor = (GetThemeSysColorPtr)GetProcAddress(sThemeDLL, "GetThemeSysColor"); getThemeSysColor = (GetThemeSysColorPtr)GetProcAddress(sThemeDLL, "GetThemeSysColor");
isThemeBackgroundPartiallyTransparent = (IsThemeBackgroundPartiallyTransparentPtr)GetProcAddress(sThemeDLL, "IsThemeBackgroundPartiallyTransparent");
} }
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
sDwmDLL = ::LoadLibraryW(kDwmLibraryName); sDwmDLL = ::LoadLibraryW(kDwmLibraryName);

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

@ -153,7 +153,6 @@ public:
LPWSTR pszColorBuff, int cchMaxColorChars, LPWSTR pszColorBuff, int cchMaxColorChars,
LPWSTR pszSizeBuff, int cchMaxSizeChars); LPWSTR pszSizeBuff, int cchMaxSizeChars);
typedef COLORREF (WINAPI*GetThemeSysColorPtr)(HANDLE hTheme, int iColorID); typedef COLORREF (WINAPI*GetThemeSysColorPtr)(HANDLE hTheme, int iColorID);
typedef BOOL (WINAPI*IsThemeBackgroundPartiallyTransparentPtr)(HANDLE hTheme, int iPartId, int iStateId);
static OpenThemeDataPtr openTheme; static OpenThemeDataPtr openTheme;
static CloseThemeDataPtr closeTheme; static CloseThemeDataPtr closeTheme;
@ -168,7 +167,6 @@ public:
static IsAppThemedPtr isAppThemed; static IsAppThemedPtr isAppThemed;
static GetCurrentThemeNamePtr getCurrentThemeName; static GetCurrentThemeNamePtr getCurrentThemeName;
static GetThemeSysColorPtr getThemeSysColor; static GetThemeSysColorPtr getThemeSysColor;
static IsThemeBackgroundPartiallyTransparentPtr isThemeBackgroundPartiallyTransparent;
#if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN
// dwmapi.dll function typedefs and declarations // dwmapi.dll function typedefs and declarations