Back to index

lightning-sunbird  0.9+nobinonly
Classes | Functions
nsXFormsTriggerElement.cpp File Reference
#include "nsIDOM3Node.h"
#include "nsIDOMElement.h"
#include "nsIDOMUIEvent.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMDocumentEvent.h"
#include "nsIDOMDocument.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMHTMLButtonElement.h"
#include "nsIDOMDocumentView.h"
#include "nsIDOMAbstractView.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsXFormsAtoms.h"
#include "nsXFormsUtils.h"
#include "nsXFormsControlStub.h"
#include "nsIXFormsSubmitElement.h"
#include "nsIXFormsSubmissionElement.h"
#include "nsXFormsDelegateStub.h"
#include "nsIXFormsUIWidget.h"

Go to the source code of this file.

Classes

class  nsXFormsSubmitElement

Functions

 NS_NewXFormsTriggerElement (nsIXTFElement **aResult)
 NS_IMPL_ISUPPORTS_INHERITED1 (nsXFormsSubmitElement, nsXFormsDelegateStub, nsIXFormsSubmitElement) NS_IMETHODIMP nsXFormsSubmitElement
 NS_NewXFormsSubmitElement (nsIXTFElement **aResult)

Function Documentation

Definition at line 87 of file nsXFormsTriggerElement.cpp.

{
  nsresult rv;
  
  rv = nsXFormsDelegateStub::HandleDefault(aEvent, aHandled);
  NS_ENSURE_SUCCESS(rv, rv);
  if (*aHandled) {
    return NS_OK;
  }

  if (!nsXFormsUtils::EventHandlingAllowed(aEvent, mElement))
    return NS_OK;

  nsAutoString type;
  aEvent->GetType(type);
  if (!(*aHandled = type.EqualsLiteral("DOMActivate")))
    return NS_OK;

  NS_NAMED_LITERAL_STRING(submission, "submission");
  nsAutoString submissionID;
  mElement->GetAttribute(submission, submissionID);

  nsCOMPtr<nsIDOMElement> submissionElement;
  nsXFormsUtils::GetElementByContextId(mElement, submissionID,
                                       getter_AddRefs(submissionElement));

  nsCOMPtr<nsIXFormsSubmissionElement> xfSubmission(do_QueryInterface(submissionElement));

  if (!xfSubmission) {
    const PRUnichar *strings[] = { submissionID.get(), submission.get() };
    nsXFormsUtils::ReportError(NS_LITERAL_STRING("idRefError"),
                               strings, 2, mElement, mElement);
    return nsXFormsUtils::DispatchEvent(mElement, eEvent_BindingException);
  }

  xfSubmission->SetActivator(this);
  nsXFormsUtils::DispatchEvent(submissionElement, eEvent_Submit);

  *aHandled = PR_TRUE;
  return NS_OK;
}

Here is the call graph for this function:

Definition at line 148 of file nsXFormsTriggerElement.cpp.

{
  *aResult = new nsXFormsSubmitElement();
  if (!*aResult)
    return NS_ERROR_OUT_OF_MEMORY;

  NS_ADDREF(*aResult);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 60 of file nsXFormsTriggerElement.cpp.

{
  *aResult = new nsXFormsDelegateStub(NS_LITERAL_STRING("trigger"));
  if (!*aResult)
    return NS_ERROR_OUT_OF_MEMORY;

  NS_ADDREF(*aResult);
  return NS_OK;
}

Here is the call graph for this function:

Here is the caller graph for this function: