зеркало из https://github.com/mozilla/gecko-dev.git
Make CreateRenderingContext() return error for a null surface and add error handling to callers. b=362201 r+sr=vladimir
This commit is contained in:
Родитель
6b0092f0a1
Коммит
b3b5d084fc
|
@ -321,6 +321,9 @@ nsThebesDeviceContext::CreateRenderingContext(nsIWidget *aWidget,
|
|||
nsRefPtr<gfxASurface> surface(aWidget->GetThebesSurface());
|
||||
if (surface)
|
||||
rv = pContext->Init(this, surface);
|
||||
else
|
||||
rv = NS_ERROR_FAILURE;
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
aContext = pContext;
|
||||
NS_ADDREF(aContext);
|
||||
|
|
|
@ -3410,7 +3410,9 @@ PresShell::CreateRenderingContext(nsIFrame *aFrame,
|
|||
}
|
||||
*aResult = result;
|
||||
|
||||
result->Translate(offset.x, offset.y);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
result->Translate(offset.x, offset.y);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -160,9 +160,11 @@ inFlasher::DrawElementOutline(nsIDOMElement* aElement)
|
|||
|
||||
while (frame) {
|
||||
nsCOMPtr<nsIRenderingContext> rcontext;
|
||||
presShell->CreateRenderingContext(frame, getter_AddRefs(rcontext));
|
||||
nsRect rect(nsPoint(0,0), frame->GetSize());
|
||||
nsresult rv =
|
||||
presShell->CreateRenderingContext(frame, getter_AddRefs(rcontext));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRect rect(nsPoint(0,0), frame->GetSize());
|
||||
if (mInvert) {
|
||||
rcontext->InvertRect(rect);
|
||||
}
|
||||
|
|
|
@ -1740,9 +1740,9 @@ nsChildView::Idle()
|
|||
gfxASurface*
|
||||
nsChildView::GetThebesSurface()
|
||||
{
|
||||
|
||||
if (!mTempThebesSurface) {
|
||||
mTempThebesSurface = new gfxQuartzSurface(gfxSize(1, 1), gfxASurface::ImageFormatARGB32);
|
||||
NS_ENSURE_TRUE(mTempThebesSurface.get(), nsnull); // OOM
|
||||
}
|
||||
|
||||
gfxASurface *surf = mTempThebesSurface.get();
|
||||
|
|
Загрузка…
Ссылка в новой задаче