From cc75c719796ad592dd9736b4648e60d4d2bba96d Mon Sep 17 00:00:00 2001 From: Karl Tomlinson Date: Fri, 11 Jun 2010 10:53:01 +1200 Subject: [PATCH] backout ce0bec337cdd due to bad message --- gfx/public/nsITheme.h | 16 +++---------- layout/base/nsDisplayList.cpp | 2 +- layout/base/nsDisplayList.h | 7 +++--- layout/base/nsLayoutUtils.cpp | 6 ++--- layout/generic/nsIFrame.h | 11 ++++----- widget/src/cocoa/nsNativeThemeCocoa.h | 2 +- widget/src/cocoa/nsNativeThemeCocoa.mm | 8 +++---- widget/src/gtk2/nsNativeThemeGTK.cpp | 6 +++++ widget/src/gtk2/nsNativeThemeGTK.h | 2 ++ widget/src/qt/nsNativeThemeQt.cpp | 6 +++++ widget/src/qt/nsNativeThemeQt.h | 2 ++ widget/src/windows/nsNativeThemeWin.cpp | 31 +++---------------------- widget/src/windows/nsNativeThemeWin.h | 2 +- widget/src/windows/nsUXThemeData.cpp | 2 -- widget/src/windows/nsUXThemeData.h | 2 -- 15 files changed, 39 insertions(+), 66 deletions(-) diff --git a/gfx/public/nsITheme.h b/gfx/public/nsITheme.h index 8c1ee6908d5c..94f108bb8449 100644 --- a/gfx/public/nsITheme.h +++ b/gfx/public/nsITheme.h @@ -59,7 +59,8 @@ class nsIAtom; // IID for the nsITheme interface // {887e8902-db6b-41b4-8481-a80f49c5a93a} #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} #define NS_THEMERENDERER_CID \ { 0xd930e29b, 0x6909, 0x44e5, { 0xab, 0x4b, 0xaf, 0x10, 0xd6, 0x92, 0x37, 0x5 } } @@ -138,18 +139,7 @@ public: nsIntSize* aResult, PRBool* aIsOverridable)=0; - - 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; } + virtual nsTransparencyMode GetWidgetTransparency(PRUint8 aWidgetType)=0; NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType, nsIAtom* aAttribute, PRBool* aShouldRepaint)=0; diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index b7a4e3cdf8e8..0e6afcaecec4 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -675,7 +675,7 @@ PRBool nsDisplayBackground::IsOpaque(nsDisplayListBuilder* aBuilder) { // theme background overrides any other background if (mIsThemed) - return mThemeTransparency == nsITheme::eOpaque; + return PR_FALSE; nsStyleContext *bgSC; if (!nsCSSRendering::FindBackground(mFrame->PresContext(), mFrame, &bgSC)) diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 22fffe4d3d11..65a06e2689d6 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -1257,7 +1257,7 @@ private: class nsDisplayBackground : public nsDisplayItem { public: nsDisplayBackground(nsIFrame* aFrame) : nsDisplayItem(aFrame) { - mIsThemed = mFrame->IsThemed(&mThemeTransparency); + mIsThemed = mFrame->IsThemed(); MOZ_COUNT_CTOR(nsDisplayBackground); } #ifdef NS_BUILD_REFCNT_LOGGING @@ -1278,9 +1278,8 @@ public: virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx); NS_DISPLAY_DECL_NAME("Background") private: - /* Used to cache mFrame->IsThemed() since it isn't a cheap call */ - PRPackedBool mIsThemed; - nsITheme::Transparency mThemeTransparency; + /* Used to cache mFrame->IsThemed() since it isn't a cheap call */ + PRPackedBool mIsThemed; }; /** diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 10856c2400ad..97ecc10ad774 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -3216,11 +3216,9 @@ nsLayoutUtils::GetFrameTransparency(nsIFrame* aBackgroundFrame, if (HasNonZeroCorner(aCSSRootFrame->GetStyleContext()->GetStyleBorder()->mBorderRadius)) return eTransparencyTransparent; - nsITheme::Transparency transparency; + nsTransparencyMode transparency; if (aCSSRootFrame->IsThemed(&transparency)) - return transparency == nsITheme::eTransparent - ? eTransparencyTransparent - : eTransparencyOpaque; + return transparency; if (aCSSRootFrame->GetStyleDisplay()->mAppearance == NS_THEME_WIN_GLASS) return eTransparencyGlass; diff --git a/layout/generic/nsIFrame.h b/layout/generic/nsIFrame.h index bf4c4de363b4..8e289d79652d 100644 --- a/layout/generic/nsIFrame.h +++ b/layout/generic/nsIFrame.h @@ -997,20 +997,19 @@ public: */ virtual nscolor GetCaretColorAt(PRInt32 aOffset); - - PRBool IsThemed(nsITheme::Transparency* aTransparencyState = nsnull) { - return IsThemed(GetStyleDisplay(), aTransparencyState); + PRBool IsThemed(nsTransparencyMode* aTransparencyMode = nsnull) { + return IsThemed(GetStyleDisplay(), aTransparencyMode); } PRBool IsThemed(const nsStyleDisplay* aDisp, - nsITheme::Transparency* aTransparencyState = nsnull) { + nsTransparencyMode* aTransparencyMode = nsnull) { if (!aDisp->mAppearance) return PR_FALSE; nsPresContext* pc = PresContext(); nsITheme *theme = pc->GetTheme(); if(!theme || !theme->ThemeSupportsWidget(pc, this, aDisp->mAppearance)) return PR_FALSE; - if (aTransparencyState) { - *aTransparencyState = theme->GetWidgetTransparency(this, aDisp->mAppearance); + if (aTransparencyMode) { + *aTransparencyMode = theme->GetWidgetTransparency(aDisp->mAppearance); } return PR_TRUE; } diff --git a/widget/src/cocoa/nsNativeThemeCocoa.h b/widget/src/cocoa/nsNativeThemeCocoa.h index 60a57c4304d9..10902f12bc9d 100644 --- a/widget/src/cocoa/nsNativeThemeCocoa.h +++ b/widget/src/cocoa/nsNativeThemeCocoa.h @@ -90,7 +90,7 @@ public: PRBool WidgetIsContainer(PRUint8 aWidgetType); PRBool ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType); PRBool ThemeNeedsComboboxDropmarker(); - virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, PRUint8 aWidgetType); + virtual nsTransparencyMode GetWidgetTransparency(PRUint8 aWidgetType); protected: diff --git a/widget/src/cocoa/nsNativeThemeCocoa.mm b/widget/src/cocoa/nsNativeThemeCocoa.mm index f89f3922f627..b4774ceee90e 100644 --- a/widget/src/cocoa/nsNativeThemeCocoa.mm +++ b/widget/src/cocoa/nsNativeThemeCocoa.mm @@ -2480,12 +2480,12 @@ nsNativeThemeCocoa::ThemeNeedsComboboxDropmarker() return PR_FALSE; } -nsITheme::Transparency -nsNativeThemeCocoa::GetWidgetTransparency(nsIFrame* aFrame, PRUint8 aWidgetType) +nsTransparencyMode +nsNativeThemeCocoa::GetWidgetTransparency(PRUint8 aWidgetType) { if (aWidgetType == NS_THEME_MENUPOPUP || aWidgetType == NS_THEME_TOOLTIP) - return eTransparent; + return eTransparencyTransparent; - return eUnknownTransparency; + return eTransparencyOpaque; } diff --git a/widget/src/gtk2/nsNativeThemeGTK.cpp b/widget/src/gtk2/nsNativeThemeGTK.cpp index 871ee9bc7c06..35ef4db49048 100644 --- a/widget/src/gtk2/nsNativeThemeGTK.cpp +++ b/widget/src/gtk2/nsNativeThemeGTK.cpp @@ -1342,3 +1342,9 @@ nsNativeThemeGTK::ThemeNeedsComboboxDropmarker() { return PR_FALSE; } + +nsTransparencyMode +nsNativeThemeGTK::GetWidgetTransparency(PRUint8 aWidgetType) +{ + return eTransparencyOpaque; +} diff --git a/widget/src/gtk2/nsNativeThemeGTK.h b/widget/src/gtk2/nsNativeThemeGTK.h index 704457bfd4eb..f708c945756d 100644 --- a/widget/src/gtk2/nsNativeThemeGTK.h +++ b/widget/src/gtk2/nsNativeThemeGTK.h @@ -92,6 +92,8 @@ public: PRBool ThemeNeedsComboboxDropmarker(); + virtual nsTransparencyMode GetWidgetTransparency(PRUint8 aWidgetType); + nsNativeThemeGTK(); virtual ~nsNativeThemeGTK(); diff --git a/widget/src/qt/nsNativeThemeQt.cpp b/widget/src/qt/nsNativeThemeQt.cpp index 43a46db802cd..f89102aaad10 100644 --- a/widget/src/qt/nsNativeThemeQt.cpp +++ b/widget/src/qt/nsNativeThemeQt.cpp @@ -627,6 +627,12 @@ nsNativeThemeQt::ThemeNeedsComboboxDropmarker() return PR_TRUE; } +nsTransparencyMode +nsNativeThemeQt::GetWidgetTransparency(PRUint8 aWidgetType) +{ + return eTransparencyOpaque; +} + void nsNativeThemeQt::InitButtonStyle(PRUint8 aWidgetType, nsIFrame* aFrame, diff --git a/widget/src/qt/nsNativeThemeQt.h b/widget/src/qt/nsNativeThemeQt.h index 86fce2525a7a..4b69c0004634 100644 --- a/widget/src/qt/nsNativeThemeQt.h +++ b/widget/src/qt/nsNativeThemeQt.h @@ -99,6 +99,8 @@ public: PRBool ThemeNeedsComboboxDropmarker(); + virtual nsTransparencyMode GetWidgetTransparency(PRUint8 aWidgetType); + nsNativeThemeQt(); virtual ~nsNativeThemeQt(); diff --git a/widget/src/windows/nsNativeThemeWin.cpp b/widget/src/windows/nsNativeThemeWin.cpp index 5b306c98e3c4..fdb62ece2154 100644 --- a/widget/src/windows/nsNativeThemeWin.cpp +++ b/widget/src/windows/nsNativeThemeWin.cpp @@ -397,13 +397,6 @@ nsNativeThemeWin::IsMenuActive(nsIFrame *aFrame, PRUint8 aWidgetType) return CheckBooleanAttr(aFrame, nsWidgetAtoms::mozmenuactive); } -/** - * aPart is filled in with the UXTheme part code. On return, values > 0 - * are the actual UXTheme part code; -1 means the widget will be drawn by - * us; 0 means that we should use part code 0, which isn't a real part code - * but elicits some kind of default behaviour from UXTheme when drawing - * (but isThemeBackgroundPartiallyTransparent may not work). - */ nsresult nsNativeThemeWin::GetThemePartAndState(nsIFrame* aFrame, PRUint8 aWidgetType, PRInt32& aPart, PRInt32& aState) @@ -1783,28 +1776,10 @@ nsNativeThemeWin::ThemeNeedsComboboxDropmarker() return PR_TRUE; } -nsITheme::Transparency -nsNativeThemeWin::GetWidgetTransparency(nsIFrame* aFrame, PRUint8 aWidgetType) +nsTransparencyMode +nsNativeThemeWin::GetWidgetTransparency(PRUint8 aWidgetType) { - HANDLE theme = GetTheme(aWidgetType); - // 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 (part <= 0) { - // Not a real part code, so isThemeBackgroundPartiallyTransparent may - // not work, so don't call it. - return eUnknownTransparency; - } - - if (nsUXThemeData::isThemeBackgroundPartiallyTransparent(theme, part, state)) - return eTransparent; - return eOpaque; + return eTransparencyOpaque; } /* Windows 9x/NT/2000/Classic XP Theme Support */ diff --git a/widget/src/windows/nsNativeThemeWin.h b/widget/src/windows/nsNativeThemeWin.h index 2a91c96ec178..efb6393511bc 100644 --- a/widget/src/windows/nsNativeThemeWin.h +++ b/widget/src/windows/nsNativeThemeWin.h @@ -78,7 +78,7 @@ public: nsIntSize* aResult, PRBool* aIsOverridable); - virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, PRUint8 aWidgetType); + virtual nsTransparencyMode GetWidgetTransparency(PRUint8 aWidgetType); NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType, nsIAtom* aAttribute, PRBool* aShouldRepaint); diff --git a/widget/src/windows/nsUXThemeData.cpp b/widget/src/windows/nsUXThemeData.cpp index 4df110ebf6f4..77abcdad3a82 100644 --- a/widget/src/windows/nsUXThemeData.cpp +++ b/widget/src/windows/nsUXThemeData.cpp @@ -83,7 +83,6 @@ nsUXThemeData::GetThemeMarginsPtr nsUXThemeData::getThemeMargins = NULL; nsUXThemeData::IsAppThemedPtr nsUXThemeData::isAppThemed = NULL; nsUXThemeData::GetCurrentThemeNamePtr nsUXThemeData::getCurrentThemeName = NULL; nsUXThemeData::GetThemeSysColorPtr nsUXThemeData::getThemeSysColor = NULL; -nsUXThemeData::IsThemeBackgroundPartiallyTransparentPtr nsUXThemeData::isThemeBackgroundPartiallyTransparent = NULL; #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN nsUXThemeData::DwmExtendFrameIntoClientAreaProc nsUXThemeData::dwmExtendFrameIntoClientAreaPtr = NULL; @@ -125,7 +124,6 @@ nsUXThemeData::Initialize() isAppThemed = (IsAppThemedPtr)GetProcAddress(sThemeDLL, "IsAppThemed"); getCurrentThemeName = (GetCurrentThemeNamePtr)GetProcAddress(sThemeDLL, "GetCurrentThemeName"); getThemeSysColor = (GetThemeSysColorPtr)GetProcAddress(sThemeDLL, "GetThemeSysColor"); - isThemeBackgroundPartiallyTransparent = (IsThemeBackgroundPartiallyTransparentPtr)GetProcAddress(sThemeDLL, "IsThemeBackgroundPartiallyTransparent"); } #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN sDwmDLL = ::LoadLibraryW(kDwmLibraryName); diff --git a/widget/src/windows/nsUXThemeData.h b/widget/src/windows/nsUXThemeData.h index 620a0dbef6c2..27efc5a9617c 100644 --- a/widget/src/windows/nsUXThemeData.h +++ b/widget/src/windows/nsUXThemeData.h @@ -153,7 +153,6 @@ public: LPWSTR pszColorBuff, int cchMaxColorChars, LPWSTR pszSizeBuff, int cchMaxSizeChars); typedef COLORREF (WINAPI*GetThemeSysColorPtr)(HANDLE hTheme, int iColorID); - typedef BOOL (WINAPI*IsThemeBackgroundPartiallyTransparentPtr)(HANDLE hTheme, int iPartId, int iStateId); static OpenThemeDataPtr openTheme; static CloseThemeDataPtr closeTheme; @@ -168,7 +167,6 @@ public: static IsAppThemedPtr isAppThemed; static GetCurrentThemeNamePtr getCurrentThemeName; static GetThemeSysColorPtr getThemeSysColor; - static IsThemeBackgroundPartiallyTransparentPtr isThemeBackgroundPartiallyTransparent; #if MOZ_WINSDK_TARGETVER >= MOZ_NTDDI_LONGHORN // dwmapi.dll function typedefs and declarations