result = aPresContext->PresShell()->GetDocument();
nsIPresShell* shell; aPresContext->GetShell(&shell); if (shell) { shell->GetDocument(&result); NS_RELEASE(shell); }
nsTextFrame::GetDocument(nsPresContext* aPresContext){  nsIDocument *result = nsnull;  if (mContent) {    result = mContent->GetDocument();  }  if (!result && aPresContext) {    result = aPresContext->PresShell()->GetDocument();  }  return result;}