b=418882, crash on www.rhein-zeitung.de, potential fix; r+sr=roc

This commit is contained in:
vladimir@pobox.com 2008-03-07 16:58:57 -08:00
Родитель 50d25150ec
Коммит 1561fa16ce
1 изменённых файлов: 15 добавлений и 10 удалений

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

@ -1358,14 +1358,6 @@ nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext,
// the offset of the DC
nsPoint origin;
// check if we need to update hdc
HDC hdc = (HDC)aRenderingContext.GetNativeGraphicData(nsIRenderingContext::NATIVE_WINDOWS_DC);
if (reinterpret_cast<HDC>(window->window) != hdc) {
window->window = reinterpret_cast<nsPluginPort*>(hdc);
doupdatewindow = PR_TRUE;
}
/*
* Layout now has an optimized way of painting. Now we always get
* a new drawing surface, sized to be just what's needed. Windowless
@ -1391,8 +1383,6 @@ nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext,
origin.x = NSToIntRound(float(ctxMatrix.GetTranslation().x));
origin.y = NSToIntRound(float(ctxMatrix.GetTranslation().y));
SaveDC(hdc);
/* Need to force the clip to be set */
ctx->UpdateSurfaceClip();
@ -1400,6 +1390,21 @@ nsObjectFrame::PaintPlugin(nsIRenderingContext& aRenderingContext,
gfxFloat xoff, yoff;
nsRefPtr<gfxASurface> surf = ctx->CurrentSurface(&xoff, &yoff);
if (surf->CairoStatus() != 0) {
NS_WARNING("Plugin is being asked to render to a surface that's in error!");
return;
}
// check if we need to update hdc
HDC hdc = (HDC)aRenderingContext.GetNativeGraphicData(nsIRenderingContext::NATIVE_WINDOWS_DC);
if (reinterpret_cast<HDC>(window->window) != hdc) {
window->window = reinterpret_cast<nsPluginPort*>(hdc);
doupdatewindow = PR_TRUE;
}
SaveDC(hdc);
POINT origViewportOrigin;
GetViewportOrgEx(hdc, &origViewportOrigin);
SetViewportOrgEx(hdc, origViewportOrigin.x + (int) xoff, origViewportOrigin.y + (int) yoff, NULL);