rv = dx->CreateRenderingContext(NS_STATIC_CAST(nsIWidget *, widget), result);
rv = dx->CreateRenderingContext(widget.get(), result);
PresShell::CreateRenderingContext(nsIFrame *aFrame,                                  nsIRenderingContext** aResult){  NS_PRECONDITION(nsnull != aResult, "null ptr");  if (nsnull == aResult) {    return NS_ERROR_NULL_POINTER;  }  nsIView   *view = nsnull;  nsPoint   pt;  nsresult  rv;  aFrame->GetView(mPresContext, &view);  if (nsnull == view)    aFrame->GetOffsetFromView(mPresContext, pt, &view);  nsCOMPtr<nsIWidget> widget;  if (nsnull != view) {    nsCOMPtr<nsIViewManager> vm;    view->GetViewManager(*getter_AddRefs(vm));    vm->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(NS_STATIC_CAST(nsIWidget *, widget), result);    }    else {      rv = dx->CreateRenderingContext(result);    }  }  *aResult = result;  return rv;}