return LaunchPopup ( mElement, xPos, yPos, offsetX, offsetY );
nsCOMPtr<nsIDOMElement> popupContent; if (NS_FAILED(rv = xulDocument->GetElementById(identifier, getter_AddRefs(popupContent)))) { NS_ERROR("GetElementById had some kind of spasm."); return rv; } if ( !popupContent ) return NS_OK;   nsIScriptContextOwner* owner = document->GetScriptContextOwner(); nsCOMPtr<nsIScriptContext> context; if (NS_OK == owner->GetScriptContext(getter_AddRefs(context))) { nsIScriptGlobalObject* global = context->GetGlobalObject(); if (global) {  nsCOMPtr<nsIDOMWindow> domWindow = do_QueryInterface(global); if (domWindow != nsnull) {  nsAutoString anchorAlignment("none"); mElement->GetAttribute("popupanchor", anchorAlignment);  nsAutoString popupAlignment("topleft"); mElement->GetAttribute("popupalign", popupAlignment);   xulDocument->SetPopupElement(mElement);    PRInt32 xPos = aScreenX, yPos = aScreenY; if (anchorAlignment != "none") { xPos -= aOffsetX; yPos -= aOffsetY; } printf("***creating XUL popup at %ld %ld\n", xPos, yPos); domWindow->CreatePopup(mElement, popupContent, xPos, yPos, type, anchorAlignment, popupAlignment, getter_AddRefs(mPopup)); if ( popupType == eXULPopupType_popup && mPopup ) mPopup->Focus();   } NS_RELEASE(global); } } NS_IF_RELEASE(owner);  return NS_OK;
XULPopupListenerImpl::LaunchPopup ( nsIDOMEvent* anEvent ){  // Retrieve our x and y position.  nsCOMPtr<nsIDOMUIEvent> uiEvent ( do_QueryInterface(anEvent) );  if (!uiEvent) {    //non-ui event passed in.  bad things.    return NS_OK;  }  PRInt32 xPos, yPos;  uiEvent->GetScreenX(&xPos);   uiEvent->GetScreenY(&yPos);   PRInt32 offsetX, offsetY;  uiEvent->GetClientX(&offsetX);  uiEvent->GetClientY(&offsetY);  return LaunchPopup ( mElement, xPos, yPos, offsetX, offsetY );}