nsCOMPtr<nsIContent> content; aFrame->GetContent(getter_AddRefs(content)); nsIDocument* doc = content->GetDocument();
nsIDocument* doc = aFrame->GetContent()->GetDocument();
static void GetPrimaryPresShell(nsIFrame* aFrame, nsIPresShell** aResult){  *aResult = nsnull;  if (!aFrame)    return;   nsCOMPtr<nsIContent> content;  aFrame->GetContent(getter_AddRefs(content));  nsIDocument* doc = content->GetDocument();  if (doc)    doc->GetShellAt(0, aResult); // Addref happens here.}