nsIFocusController* focusController = ourWindow->GetRootFocusController(); nsIDOMElement* domElement = nsnull; CallQueryInterface(this, &domElement);
nsIFocusController* focusController = ourWindow->GetRootFocusController(); nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(NS_STATIC_CAST(nsIContent *, this));
nsHTMLLegendElement::SetFocus(nsPresContext* aPresContext){  nsIDocument *document = GetCurrentDoc();  if (!aPresContext || !document) {    return;  }  nsCOMPtr<nsIEventStateManager> esm = aPresContext->EventStateManager();  if (IsFocusable()) {    esm->SetContentState(this, NS_EVENT_STATE_FOCUS);  } else {    // If the legend isn't focusable (no tabindex) we focus whatever is    // focusable following the legend instead, bug 81481.    nsCOMPtr<nsPIDOMWindow> ourWindow = do_QueryInterface(document->GetScriptGlobalObject());    if (ourWindow) {      nsIFocusController* focusController = ourWindow->GetRootFocusController();      nsIDOMElement* domElement = nsnull;      CallQueryInterface(this, &domElement);      if (focusController && domElement) {        focusController->MoveFocus(PR_TRUE, domElement);      }    }  }}