Guarantee that the pres context's device context will be non-null by returning failure from Init() if it's null. Rename inline getter GetDeviceContext() to DeviceContext(), convert all callers to use the inline getter, and remove the virtual/refcounting getter. Bug 229371, r+sr=dbaron.
git-svn-id: svn://10.0.0.236/trunk@152182 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -3909,17 +3909,13 @@ PresShell::CreateRenderingContext(nsIFrame *aFrame,
|
||||
view->GetViewManager()->GetWidgetForView(view, getter_AddRefs(widget));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDeviceContext> dx;
|
||||
|
||||
nsIRenderingContext* result = nsnull;
|
||||
rv = mPresContext->GetDeviceContext(getter_AddRefs(dx));
|
||||
if (NS_SUCCEEDED(rv) && dx) {
|
||||
if (nsnull != widget) {
|
||||
rv = dx->CreateRenderingContext(widget.get(), result);
|
||||
}
|
||||
else {
|
||||
rv = dx->CreateRenderingContext(result);
|
||||
}
|
||||
nsIDeviceContext *deviceContext = mPresContext->DeviceContext();
|
||||
if (widget) {
|
||||
rv = deviceContext->CreateRenderingContext(widget.get(), result);
|
||||
}
|
||||
else {
|
||||
rv = deviceContext->CreateRenderingContext(result);
|
||||
}
|
||||
*aResult = result;
|
||||
|
||||
@@ -7032,8 +7028,7 @@ PresShell::VerifyIncrementalReflow()
|
||||
}
|
||||
|
||||
NS_ASSERTION(NS_SUCCEEDED (rv), "failed to create presentation context");
|
||||
nsCOMPtr<nsIDeviceContext> dc;
|
||||
mPresContext->GetDeviceContext(getter_AddRefs(dc));
|
||||
nsIDeviceContext *dc = mPresContext->DeviceContext();
|
||||
rv = cx->Init(dc);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user