Bug 920377 part.9 Get rid of nsFormEvent r=roc

This commit is contained in:
Masayuki Nakano 2013-09-27 15:20:55 +09:00
parent 99c5bbdbfb
commit c932c46352
6 changed files with 12 additions and 13 deletions

View File

@ -649,8 +649,8 @@ nsDOMEvent::DuplicatePrivateData()
}
case NS_FORM_EVENT:
{
nsFormEvent* oldFormEvent = static_cast<nsFormEvent*>(mEvent);
nsFormEvent* formEvent = new nsFormEvent(false, msg);
InternalFormEvent* oldFormEvent = static_cast<InternalFormEvent*>(mEvent);
InternalFormEvent* formEvent = new InternalFormEvent(false, msg);
formEvent->AssignFormEventData(*oldFormEvent, true);
newEvent = formEvent;
break;

View File

@ -347,9 +347,8 @@ HTMLButtonElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
if (aVisitor.mItemFlags & NS_OUTER_ACTIVATE_EVENT) {
if (mForm && (mType == NS_FORM_BUTTON_SUBMIT ||
mType == NS_FORM_BUTTON_RESET)) {
nsFormEvent event(true,
(mType == NS_FORM_BUTTON_RESET)
? NS_FORM_RESET : NS_FORM_SUBMIT);
InternalFormEvent event(true,
(mType == NS_FORM_BUTTON_RESET) ? NS_FORM_RESET : NS_FORM_SUBMIT);
event.originator = this;
nsEventStatus status = nsEventStatus_eIgnore;

View File

@ -422,7 +422,7 @@ HTMLFormElement::Submit()
NS_IMETHODIMP
HTMLFormElement::Reset()
{
nsFormEvent event(true, NS_FORM_RESET);
InternalFormEvent event(true, NS_FORM_RESET);
nsEventDispatcher::Dispatch(static_cast<nsIContent*>(this), nullptr,
&event);
return NS_OK;
@ -822,13 +822,15 @@ HTMLFormElement::BuildSubmission(nsFormSubmission** aFormSubmission,
nsGenericHTMLElement* originatingElement = nullptr;
if (aEvent) {
if (NS_FORM_EVENT == aEvent->eventStructType) {
nsIContent* originator = ((nsFormEvent *)aEvent)->originator;
nsIContent* originator =
static_cast<InternalFormEvent*>(aEvent)->originator;
if (originator) {
if (!originator->IsHTML()) {
return NS_ERROR_UNEXPECTED;
}
originatingElement =
static_cast<nsGenericHTMLElement*>(((nsFormEvent *)aEvent)->originator);
static_cast<nsGenericHTMLElement*>(
static_cast<InternalFormEvent*>(aEvent)->originator);
}
}
}

View File

@ -2810,7 +2810,7 @@ HTMLInputElement::MaybeSubmitForm(nsPresContext* aPresContext)
// If there's only one text control, just submit the form
// Hold strong ref across the event
nsRefPtr<mozilla::dom::HTMLFormElement> form = mForm;
nsFormEvent event(true, NS_FORM_SUBMIT);
InternalFormEvent event(true, NS_FORM_SUBMIT);
nsEventStatus status = nsEventStatus_eIgnore;
shell->HandleDOMEventWithTarget(mForm, &event, &status);
}
@ -3616,8 +3616,8 @@ HTMLInputElement::PostHandleEvent(nsEventChainPostVisitor& aVisitor)
case NS_FORM_INPUT_SUBMIT:
case NS_FORM_INPUT_IMAGE:
if (mForm) {
nsFormEvent event(true, (mType == NS_FORM_INPUT_RESET) ?
NS_FORM_RESET : NS_FORM_SUBMIT);
InternalFormEvent event(true,
(mType == NS_FORM_INPUT_RESET) ? NS_FORM_RESET : NS_FORM_SUBMIT);
event.originator = this;
nsEventStatus status = nsEventStatus_eIgnore;

View File

@ -251,6 +251,5 @@ public:
typedef mozilla::InternalScriptErrorEvent nsScriptErrorEvent;
typedef mozilla::InternalScrollPortEvent nsScrollPortEvent;
typedef mozilla::InternalScrollAreaEvent nsScrollAreaEvent;
typedef mozilla::InternalFormEvent nsFormEvent;
#endif // mozilla_ContentEvents_h__

View File

@ -131,6 +131,5 @@ typedef mozilla::WidgetTouchEvent nsTouchEvent;
typedef mozilla::InternalScriptErrorEvent nsScriptErrorEvent;
typedef mozilla::InternalScrollPortEvent nsScrollPortEvent;
typedef mozilla::InternalScrollAreaEvent nsScrollAreaEvent;
typedef mozilla::InternalFormEvent nsFormEvent;
#endif // mozilla_EventForwards_h__