Back to index

lightning-sunbird  0.9+nobinonly
Functions
MenuHelpersX Namespace Reference

Functions

nsresult DocShellToPresContext (nsIDocShell *inDocShell, nsPresContext **outContext)
nsEventStatus DispatchCommandTo (nsIWeakReference *aDocShellWeakRef, nsIContent *aTargetContent)

Function Documentation

nsEventStatus MenuHelpersX::DispatchCommandTo ( nsIWeakReference aDocShellWeakRef,
nsIContent aTargetContent 
)

Definition at line 937 of file nsMenuBarX.cpp.

{
  NS_PRECONDITION(aTargetContent, "null ptr");

  nsCOMPtr<nsIDocShell> docShell = do_QueryReferent(aDocShellWeakRef);
  if (!docShell)
    return nsEventStatus_eConsumeNoDefault;
  nsCOMPtr<nsPresContext> presContext;
  MenuHelpersX::DocShellToPresContext(docShell, getter_AddRefs(presContext));

  nsEventStatus status = nsEventStatus_eConsumeNoDefault;
  nsXULCommandEvent event(PR_TRUE, NS_XUL_COMMAND, nsnull);

  // FIXME: Should probably figure out how to init this with the actual
  // pressed keys, but this is a big old edge case anyway. -dwh

  aTargetContent->HandleDOMEvent(presContext, &event, nsnull,
                                 NS_EVENT_FLAG_INIT, &status);
  return status;
}

Here is the call graph for this function:

Definition at line 926 of file nsMenuBarX.cpp.

{
  NS_ENSURE_ARG_POINTER(outContext);
  *outContext = nsnull;
  if (!inDocShell)
    return NS_ERROR_INVALID_ARG;
  
  nsresult retval = NS_OK;
  
  nsCOMPtr<nsIContentViewer> contentViewer;
  inDocShell->GetContentViewer(getter_AddRefs(contentViewer));
  if ( contentViewer ) {
    nsCOMPtr<nsIDocumentViewer> docViewer ( do_QueryInterface(contentViewer) );
    if ( docViewer )
      docViewer->GetPresContext(outContext);     // AddRefs for us
    else
      retval = NS_ERROR_FAILURE;
  }
  else
    retval = NS_ERROR_FAILURE;
  
  return retval;
  
} // DocShellToPresContext

Here is the call graph for this function:

Here is the caller graph for this function: