Bug 892966 - Don't rely on being able to retrieve the current surface from a gfxContext when drawing cocoa menus. r=jrmuizel

This commit is contained in:
Matt Woodrow 2013-07-12 17:19:28 -04:00
Родитель c45ae27d7e
Коммит 7afb3b3690
1 изменённых файлов: 11 добавлений и 1 удалений

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

@ -33,6 +33,8 @@
#include "gfxQuartzNativeDrawing.h"
#include <algorithm>
using namespace mozilla::gfx;
#define DRAW_IN_FRAME_DEBUG 0
#define SCROLLBARS_VISUAL_DEBUG 0
@ -2038,7 +2040,15 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsRenderingContext* aContext,
break;
case NS_THEME_MENUITEM: {
if (thebesCtx->OriginalSurface()->GetContentType() == gfxASurface::CONTENT_COLOR_ALPHA) {
bool isTransparent;
if (thebesCtx->IsCairo()) {
isTransparent = thebesCtx->OriginalSurface()->GetContentType() == gfxASurface::CONTENT_COLOR_ALPHA;
} else {
SurfaceFormat format = thebesCtx->GetDrawTarget()->GetFormat();
isTransparent = (format == FORMAT_R8G8B8A8) ||
(format == FORMAT_B8G8R8A8);
}
if (isTransparent) {
// Clear the background to get correct transparency.
CGContextClearRect(cgContext, macRect);
}