From 7ed1ca89aeaa56954051c365da2846071c3d5dac Mon Sep 17 00:00:00 2001 From: "mozilla@weilbacher.org" Date: Thu, 21 Feb 2008 00:37:27 -0800 Subject: [PATCH] Bug 413632: Remove the remaining MOZ_CAIRO_GFX (and related variables). Full patch except configure.in change. r/sr=dbaron, r=vlad, a=beltzner --- .../canvas/src/nsCanvasRenderingContext2D.cpp | 6 ++-- gfx/src/nsRenderingContextImpl.h | 2 -- layout/base/nsCSSRendering.cpp | 4 --- layout/base/nsLayoutUtils.cpp | 7 ---- layout/base/nsStyleConsts.h | 5 ++- layout/style/nsCSSParser.cpp | 32 ++++--------------- layout/style/nsICSSParser.h | 7 ++-- toolkit/library/nsStaticXULComponents.cpp | 18 +---------- widget/src/beos/nsWindow.cpp | 8 ----- widget/src/beos/nsWindow.h | 6 ---- widget/src/xpwidgets/nsBaseWidget.h | 2 -- xpfe/components/winhooks/nsWindowsHooks.cpp | 6 ---- 12 files changed, 15 insertions(+), 88 deletions(-) diff --git a/content/canvas/src/nsCanvasRenderingContext2D.cpp b/content/canvas/src/nsCanvasRenderingContext2D.cpp index ececa61aec6c..135103440e59 100644 --- a/content/canvas/src/nsCanvasRenderingContext2D.cpp +++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp @@ -194,7 +194,7 @@ public: if (offset < 0.0 || offset > 1.0) return NS_ERROR_DOM_INDEX_SIZE_ERR; - nsresult rv = mCSSParser->ParseColorString(nsString(colorstr), nsnull, 0, PR_TRUE, &color); + nsresult rv = mCSSParser->ParseColorString(nsString(colorstr), nsnull, 0, &color); if (NS_FAILED(rv)) return NS_ERROR_DOM_SYNTAX_ERR; @@ -491,7 +491,7 @@ nsCanvasRenderingContext2D::SetStyleFromVariant(nsIVariant* aStyle, PRInt32 aWhi } NS_ENSURE_SUCCESS(rv, rv); - rv = mCSSParser->ParseColorString(str, nsnull, 0, PR_TRUE, &color); + rv = mCSSParser->ParseColorString(str, nsnull, 0, &color); if (NS_FAILED(rv)) { // Error reporting happens inside the CSS parser return NS_OK; @@ -2321,7 +2321,7 @@ nsCanvasRenderingContext2D::DrawWindow(nsIDOMWindow* aWindow, PRInt32 aX, PRInt3 nscolor bgColor; nsresult rv = mCSSParser->ParseColorString(PromiseFlatString(aBGColor), - nsnull, 0, PR_TRUE, &bgColor); + nsnull, 0, &bgColor); NS_ENSURE_SUCCESS(rv, rv); nsIPresShell* presShell = presContext->PresShell(); diff --git a/gfx/src/nsRenderingContextImpl.h b/gfx/src/nsRenderingContextImpl.h index 17832aede4fc..686d8282b6c4 100644 --- a/gfx/src/nsRenderingContextImpl.h +++ b/gfx/src/nsRenderingContextImpl.h @@ -43,9 +43,7 @@ #include "nsPoint.h" #include "nsSize.h" -#ifdef MOZ_CAIRO_GFX class gfxContext; -#endif class nsRenderingContextImpl : public nsIRenderingContext { diff --git a/layout/base/nsCSSRendering.cpp b/layout/base/nsCSSRendering.cpp index f29361499747..9b3a87a49863 100644 --- a/layout/base/nsCSSRendering.cpp +++ b/layout/base/nsCSSRendering.cpp @@ -4170,11 +4170,9 @@ nsCSSRendering::DrawTableBorderSegment(nsIRenderingContext& aContext, aEndBevelOffset = 0; } -#ifdef MOZ_CAIRO_GFX gfxContext *ctx = aContext.ThebesContext(); gfxContext::AntialiasMode oldMode = ctx->CurrentAntialiasMode(); ctx->SetAntialiasMode(gfxContext::MODE_ALIASED); -#endif switch (aBorderStyle) { case NS_STYLE_BORDER_STYLE_NONE: @@ -4370,9 +4368,7 @@ nsCSSRendering::DrawTableBorderSegment(nsIRenderingContext& aContext, break; } -#ifdef MOZ_CAIRO_GFX ctx->SetAntialiasMode(oldMode); -#endif } // End table border-collapsing section diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index f4e0e50c494f..eee99a083a22 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -2236,7 +2236,6 @@ nsLayoutUtils::DrawImage(nsIRenderingContext* aRenderingContext, const nsRect& aDirtyRect, const nsRect* aSourceRect) { -#ifdef MOZ_CAIRO_GFX nsRect dirtyRect; dirtyRect.IntersectRect(aDirtyRect, aDestRect); if (dirtyRect.IsEmpty()) @@ -2369,12 +2368,6 @@ nsLayoutUtils::DrawImage(nsIRenderingContext* aRenderingContext, } return img->Draw(*aRenderingContext, pxSrc, pxDirty); -#else - /* - * If somebody wants non-cairo GFX to work again, they could write - * appropriate code to call nsIRenderingContext::DrawImage here - */ -#endif } void diff --git a/layout/base/nsStyleConsts.h b/layout/base/nsStyleConsts.h index 510c87ca74e0..9ba1b8c7cf7e 100644 --- a/layout/base/nsStyleConsts.h +++ b/layout/base/nsStyleConsts.h @@ -43,9 +43,8 @@ #include "nsFont.h" -#ifndef MOZ_CAIRO_GFX -#define GFX_HAS_INVERT -#endif +// cairo doesn't support invert +// #define GFX_HAS_INVERT // XXX fold this into nsStyleContext and group by nsStyleXXX struct diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 0f405ce193b6..f7f34dd4549a 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -150,7 +150,6 @@ public: NS_IMETHOD ParseColorString(const nsSubstring& aBuffer, nsIURI* aURL, // for error reporting PRUint32 aLineNumber, // for error reporting - PRBool aHandleAlphaColors, nscolor* aColor); void AppendRule(nsICSSRule* aRule); @@ -457,10 +456,6 @@ protected: // ignore CSS comments. PRPackedBool mHTMLMediaMode : 1; - // True if ParseColor should handle rgba() and hsla(), which most of - // Gecko currently doesn't understand. - PRPackedBool mHandleAlphaColors : 1; - // True if tagnames and attributes are case-sensitive PRPackedBool mCaseSensitive : 1; @@ -559,11 +554,6 @@ CSSParserImpl::CSSParserImpl() mSVGMode(PR_FALSE), #endif mHTMLMediaMode(PR_FALSE), -#ifdef MOZ_CAIRO_GFX - mHandleAlphaColors(PR_TRUE), -#else - mHandleAlphaColors(PR_FALSE), -#endif mCaseSensitive(PR_FALSE), mParsingCompoundProperty(PR_FALSE) #ifdef DEBUG @@ -1079,26 +1069,18 @@ NS_IMETHODIMP CSSParserImpl::ParseColorString(const nsSubstring& aBuffer, nsIURI* aURL, // for error reporting PRUint32 aLineNumber, // for error reporting - PRBool aHandleAlphaColors, nscolor* aColor) { - NS_ASSERTION(aHandleAlphaColors == PR_TRUE || aHandleAlphaColors == PR_FALSE, "bad PRBool value"); - nsresult rv = InitScanner(aBuffer, aURL, aLineNumber, aURL, nsnull); if (NS_FAILED(rv)) return rv; - PRBool origHandleAlphaColors = mHandleAlphaColors; - mHandleAlphaColors = aHandleAlphaColors; - nsCSSValue value; PRBool colorParsed = ParseColor(rv, value); OUTPUT_ERROR(); ReleaseScanner(); - mHandleAlphaColors = origHandleAlphaColors; - if (!colorParsed) { return NS_ERROR_FAILURE; } @@ -2918,13 +2900,11 @@ PRBool CSSParserImpl::ParseColor(nsresult& aErrorCode, nsCSSValue& aValue) nsCSSKeyword keyword = nsCSSKeywords::LookupKeyword(tk->mIdent); if (eCSSKeyword_UNKNOWN < keyword) { // known keyword PRInt32 value; -#ifdef MOZ_CAIRO_GFX - // XXX Once non-cairo is no longer supported, we should remove + // XXX Now that non-cairo is no longer supported, we should remove // the special parsing of transparent for background-color and // border-color. (It currently overrides this, since keywords // are checked earlier in ParseVariant.) -#endif - if (mHandleAlphaColors && keyword == eCSSKeyword_transparent) { + if (keyword == eCSSKeyword_transparent) { aValue.SetColorValue(NS_RGBA(0, 0, 0, 0)); return PR_TRUE; } @@ -2950,7 +2930,7 @@ PRBool CSSParserImpl::ParseColor(nsresult& aErrorCode, nsCSSValue& aValue) return PR_FALSE; // already pushed back } else if (mToken.mIdent.LowerCaseEqualsLiteral("-moz-rgba") || - (mHandleAlphaColors && mToken.mIdent.LowerCaseEqualsLiteral("rgba"))) { + mToken.mIdent.LowerCaseEqualsLiteral("rgba")) { // rgba ( component , component , component , opacity ) PRUint8 r, g, b, a; PRInt32 type = COLOR_TYPE_UNKNOWN; @@ -2974,7 +2954,7 @@ PRBool CSSParserImpl::ParseColor(nsresult& aErrorCode, nsCSSValue& aValue) return PR_FALSE; } else if (mToken.mIdent.LowerCaseEqualsLiteral("-moz-hsla") || - (mHandleAlphaColors && mToken.mIdent.LowerCaseEqualsLiteral("hsla"))) { + mToken.mIdent.LowerCaseEqualsLiteral("hsla")) { // hsla ( hue , saturation , lightness , opacity ) // "hue" is a number, "saturation" and "lightness" are percentages, // "opacity" is a number. @@ -3881,8 +3861,8 @@ PRBool CSSParserImpl::ParseVariant(nsresult& aErrorCode, nsCSSValue& aValue, tk->mIdent.LowerCaseEqualsLiteral("hsl") || tk->mIdent.LowerCaseEqualsLiteral("-moz-rgba") || tk->mIdent.LowerCaseEqualsLiteral("-moz-hsla") || - (mHandleAlphaColors && (tk->mIdent.LowerCaseEqualsLiteral("rgba") || - tk->mIdent.LowerCaseEqualsLiteral("hsla")))))) + tk->mIdent.LowerCaseEqualsLiteral("rgba") || + tk->mIdent.LowerCaseEqualsLiteral("hsla")))) { // Put token back so that parse color can get it UngetToken(); diff --git a/layout/style/nsICSSParser.h b/layout/style/nsICSSParser.h index 73c8aae4004b..6e933abe3a0d 100644 --- a/layout/style/nsICSSParser.h +++ b/layout/style/nsICSSParser.h @@ -156,9 +156,9 @@ public: PRBool aHTMLMode) = 0; /** - * Parse aBuffer into a nscolor |aColor|. If aHandleAlphaColors is - * set, handle rgba()/hsla(). Will return NS_ERROR_FAILURE if - * aBuffer is not a valid CSS color specification. + * Parse aBuffer into a nscolor |aColor|. The alpha component of the + * resulting aColor may vary due to rgba()/hsla(). Will return + * NS_ERROR_FAILURE if aBuffer is not a valid CSS color specification. * * Will also currently return NS_ERROR_FAILURE if it is not * self-contained (i.e. doesn't reference any external style state, @@ -167,7 +167,6 @@ public: NS_IMETHOD ParseColorString(const nsSubstring& aBuffer, nsIURI* aURL, // for error reporting PRUint32 aLineNumber, // for error reporting - PRBool aHandleAlphaColors, nscolor* aColor) = 0; }; diff --git a/toolkit/library/nsStaticXULComponents.cpp b/toolkit/library/nsStaticXULComponents.cpp index 3523c1df578b..f196036db864 100644 --- a/toolkit/library/nsStaticXULComponents.cpp +++ b/toolkit/library/nsStaticXULComponents.cpp @@ -79,23 +79,7 @@ #define IPC_MODULE #endif -#ifdef MOZ_CAIRO_GFX -# define GFX_MODULES MODULE(nsGfxModule) -#else -# if defined(MOZ_WIDGET_PHOTON) -# define GFX_MODULES MODULE(nsGfxPhModule) -# elif defined(XP_WIN) -# define GFX_MODULES MODULE(nsGfxModule) -# elif defined(XP_MACOSX) -# define GFX_MODULES MODULE(nsGfxMacModule) -# elif defined(XP_BEOS) -# define GFX_MODULES MODULE(nsGfxBeOSModule) -# elif defined(XP_OS2) -# define GFX_MODULES MODULE(nsGfxOS2Module) -# else -# error Unknown GFX module. -# endif -#endif +#define GFX_MODULES MODULE(nsGfxModule) #ifdef XP_WIN # define WIDGET_MODULES MODULE(nsWidgetModule) diff --git a/widget/src/beos/nsWindow.cpp b/widget/src/beos/nsWindow.cpp index 2d5933540cea..19f01d15ba1d 100644 --- a/widget/src/beos/nsWindow.cpp +++ b/widget/src/beos/nsWindow.cpp @@ -76,10 +76,8 @@ #include "nsIRollupListener.h" #include "nsIMenuRollup.h" -#ifdef MOZ_CAIRO_GFX #include "gfxBeOSSurface.h" #include "gfxContext.h" -#endif // See comments in nsWindow.h as to why we override these calls from nsBaseWidget NS_IMPL_THREADSAFE_ADDREF(nsWindow) @@ -647,7 +645,6 @@ NS_METHOD nsWindow::Create(nsNativeWidget aParent, aParent)); } -#ifdef MOZ_CAIRO_GFX gfxASurface* nsWindow::GetThebesSurface() { @@ -657,7 +654,6 @@ nsWindow::GetThebesSurface() } return mThebesSurface; } -#endif //------------------------------------------------------------------------- // @@ -2548,7 +2544,6 @@ nsresult nsWindow::OnPaint(BRegion *breg) } // Double buffering for cairo builds is done here -#ifdef MOZ_CAIRO_GFX nsRefPtr ctx = rc->ThebesContext(); ctx->Save(); @@ -2564,7 +2559,6 @@ nsresult nsWindow::OnPaint(BRegion *breg) // double buffer ctx->PushGroup(gfxContext::CONTENT_COLOR); -#endif nsPaintEvent event(PR_TRUE, NS_PAINT, this); @@ -2586,7 +2580,6 @@ nsresult nsWindow::OnPaint(BRegion *breg) NS_RELEASE(event.widget); -#ifdef MOZ_CAIRO_GFX // The second half of double buffering if (rv == NS_OK) { ctx->SetOperator(gfxContext::OPERATOR_SOURCE); @@ -2598,7 +2591,6 @@ nsresult nsWindow::OnPaint(BRegion *breg) } ctx->Restore(); -#endif return rv; } diff --git a/widget/src/beos/nsWindow.h b/widget/src/beos/nsWindow.h index 611ba30e88d1..cc74a387cc7d 100644 --- a/widget/src/beos/nsWindow.h +++ b/widget/src/beos/nsWindow.h @@ -63,9 +63,7 @@ #include #endif -#ifdef MOZ_CAIRO_GFX #include -#endif #define NSRGB_2_COLOREF(color) \ RGB(NS_GET_R(color),NS_GET_G(color),NS_GET_B(color)) @@ -128,9 +126,7 @@ public: nsWidgetInitData *aInitData, nsNativeWidget aNativeParent = nsnull); -#ifdef MOZ_CAIRO_GFX gfxASurface* GetThebesSurface(); -#endif NS_IMETHOD Destroy(); virtual nsIWidget* GetParent(void); @@ -237,9 +233,7 @@ protected: window_feel mBWindowFeel; window_look mBWindowLook; -#ifdef MOZ_CAIRO_GFX nsRefPtr mThebesSurface; -#endif //Just for saving space we use packed bools. PRPackedBool mIsTopWidgetWindow; diff --git a/widget/src/xpwidgets/nsBaseWidget.h b/widget/src/xpwidgets/nsBaseWidget.h index 6aa102101a5a..edd31f75c454 100644 --- a/widget/src/xpwidgets/nsBaseWidget.h +++ b/widget/src/xpwidgets/nsBaseWidget.h @@ -110,9 +110,7 @@ public: virtual nsIRenderingContext* GetRenderingContext(); virtual nsIDeviceContext* GetDeviceContext(); virtual nsIToolkit* GetToolkit(); -#ifdef MOZ_CAIRO_GFX virtual gfxASurface* GetThebesSurface(); -#endif NS_IMETHOD SetModal(PRBool aModal); NS_IMETHOD ModalEventFilter(PRBool aRealEvent, void *aEvent, PRBool *aForWindow); diff --git a/xpfe/components/winhooks/nsWindowsHooks.cpp b/xpfe/components/winhooks/nsWindowsHooks.cpp index 31b0923b623e..a0837f976333 100644 --- a/xpfe/components/winhooks/nsWindowsHooks.cpp +++ b/xpfe/components/winhooks/nsWindowsHooks.cpp @@ -881,11 +881,6 @@ WriteBitmap(nsIFile* aFile, gfxIImageFrame* aImage) if (written == sizeof(BITMAPFILEHEADER)) { stream->Write((const char*)&bmi, sizeof(BITMAPINFOHEADER), &written); if (written == sizeof(BITMAPINFOHEADER)) { -#ifndef MOZ_CAIRO_GFX - stream->Write((const char*)bits, length, &written); - if (written == length) - rv = NS_OK; -#else // write out the image data backwards because the desktop won't // show bitmaps with negative heights for top-to-bottom PRUint32 i = length; @@ -899,7 +894,6 @@ WriteBitmap(nsIFile* aFile, gfxIImageFrame* aImage) break; } } while (i != 0); -#endif } }