Bug 413632: Remove the remaining MOZ_CAIRO_GFX (and related variables). Full patch except configure.in change. r/sr=dbaron, r=vlad, a=beltzner

This commit is contained in:
mozilla@weilbacher.org 2008-02-21 00:37:27 -08:00
parent 660ff7939b
commit 7ed1ca89ae
12 changed files with 15 additions and 88 deletions

View File

@ -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();

View File

@ -43,9 +43,7 @@
#include "nsPoint.h"
#include "nsSize.h"
#ifdef MOZ_CAIRO_GFX
class gfxContext;
#endif
class nsRenderingContextImpl : public nsIRenderingContext
{

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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();

View File

@ -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;
};

View File

@ -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)

View File

@ -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<gfxContext> 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;
}

View File

@ -63,9 +63,7 @@
#include <Messenger.h>
#endif
#ifdef MOZ_CAIRO_GFX
#include <gfxBeOSSurface.h>
#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<gfxBeOSSurface> mThebesSurface;
#endif
//Just for saving space we use packed bools.
PRPackedBool mIsTopWidgetWindow;

View File

@ -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);

View File

@ -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
}
}