diff --git a/gfx/src/thebes/nsThebesImage.cpp b/gfx/src/thebes/nsThebesImage.cpp --- a/gfx/src/thebes/nsThebesImage.cpp +++ b/gfx/src/thebes/nsThebesImage.cpp @@ -800,5 +800,6 @@ if (mFormat == gfxASurface::ImageFormatARGB32) { mFormat = gfxASurface::ImageFormatRGB24; mFormatChanged = PR_TRUE; + mAlphaDepth = 0; } } diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -56,6 +56,11 @@ #ifdef MOZ_SVG #include "nsSVGIntegrationUtils.h" #endif + +#include "imgIContainer.h" +#include "gfxIImageFrame.h" +#include "nsIInterfaceRequestorUtils.h" +#include "nsIImage.h" nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame, PRBool aIsForEvents, PRBool aBuildCaret) @@ -493,14 +498,40 @@ return PR_FALSE; const nsStyleBackground* bg; - PRBool hasBG = - nsCSSRendering::FindBackground(mFrame->PresContext(), mFrame, &bg); - return (hasBG && NS_GET_A(bg->mBackgroundColor) == 255 && - // bottom layer's clip is used for the color - bg->BottomLayer().mClip == NS_STYLE_BG_CLIP_BORDER && - !nsLayoutUtils::HasNonZeroCorner(mFrame->GetStyleBorder()-> - mBorderRadius)); + if (!nsCSSRendering::FindBackground(mFrame->PresContext(), mFrame, &bg)) + return PR_FALSE; + + const nsStyleBackground::Layer& bottomLayer = bg->BottomLayer(); + + if (NS_GET_A(bg->mBackgroundColor) == 255 && + // bottom layer's clip is used for the color + bottomLayer.mClip == NS_STYLE_BG_CLIP_BORDER && + !nsLayoutUtils::HasNonZeroCorner(mFrame->GetStyleBorder()->mBorderRadius)) + return PR_TRUE; + + if (bottomLayer.mClip == NS_STYLE_BG_CLIP_BORDER && bottomLayer.mRepeat == NS_STYLE_BG_REPEAT_XY && + !nsLayoutUtils::HasNonZeroCorner(mFrame->GetStyleBorder()->mBorderRadius)) { + + if (bottomLayer.mImage.mRequest) { + nsCOMPtr container; + bottomLayer.mImage.mRequest->GetImage(getter_AddRefs(container)); + + PRUint32 nframes; + container->GetNumFrames(&nframes); + if (nframes == 1) { + nsCOMPtr imgFrame; + container->GetCurrentFrame(getter_AddRefs(imgFrame)); + nsCOMPtr img(do_GetInterface(imgFrame)); + + PRBool hasMask = img->GetHasAlphaMask(); + + return !hasMask; + } + } + } + + return PR_FALSE; } PRBool