b=386799, crash with zero-width canvas, r=stuart,sr=roc

This commit is contained in:
vladimir@pobox.com 2007-07-18 07:40:19 -07:00
Родитель 90e0f218f9
Коммит 77c5fe6ed4
2 изменённых файлов: 13 добавлений и 5 удалений

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

@ -188,6 +188,10 @@ nsHTMLCanvasFrame::PaintCanvas(nsIRenderingContext& aRenderingContext,
if (!canvas)
return;
// anything to do?
if (inner.width == 0 || inner.height == 0)
return;
nsSize canvasSize = GetCanvasSize();
nsSize sizeAppUnits(PresContext()->DevPixelsToAppUnits(canvasSize.width),
PresContext()->DevPixelsToAppUnits(canvasSize.height));

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

@ -512,9 +512,13 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
double offsetX = 0.0, offsetY = 0.0;
nsRefPtr<gfxASurface> thebesSurface = thebesCtx->CurrentSurface(&offsetX, &offsetY);
if (thebesSurface->CairoStatus() != 0) {
NS_WARNING("Got Cairo surface with nonzero error status");
return NS_ERROR_FAILURE;
}
if (thebesSurface->GetType() != gfxASurface::SurfaceTypeQuartz) {
fprintf(stderr, "Expected surface of type Quartz, got %d\n",
thebesSurface->GetType());
NS_WARNING("Expected surface of type Quartz, got somthing else");
return NS_ERROR_FAILURE;
}
@ -524,9 +528,9 @@ nsNativeThemeCocoa::DrawWidgetBackground(nsIRenderingContext* aContext, nsIFrame
//fprintf (stderr, "surface: %p cgContext: %p\n", quartzSurf, cgContext);
if (cgContext == nsnull ||
((((unsigned long)cgContext) & 0xffff) == 0x3f3f)) {
fprintf (stderr, "********** Invalid CGContext!\n");
if (cgContext == nsnull) {
NS_WARNING("Invalid CGContext!");
return NS_ERROR_FAILURE;
}
// Eventually we can just do a GetCTM and restore it with SetCTM,