Bug 895274 part.63 Rename NS_FORM_SUBMIT to eFormSubmit r=smaug

This commit is contained in:
Masayuki Nakano 2015-09-02 15:08:00 +09:00
parent 5cba4456d2
commit 4d315c9f6d
8 changed files with 20 additions and 21 deletions

View File

@ -853,7 +853,7 @@ Event::GetEventPopupControlState(WidgetEvent* aEvent, nsIDOMEvent* aDOMEvent)
// nsPresShell::HandleEventInternal() for details.
if (EventStateManager::IsHandlingUserInput()) {
switch(aEvent->mMessage) {
case NS_FORM_SUBMIT :
case eFormSubmit:
if (PopupAllowedForEvent("submit")) {
abuse = openControlled;
}

View File

@ -398,7 +398,7 @@ EVENT(stalled,
EventNameType_HTML,
eBasicEventClass)
EVENT(submit,
NS_FORM_SUBMIT,
eFormSubmit,
EventNameType_HTMLXUL,
eBasicEventClass)
EVENT(suspend,

View File

@ -370,7 +370,7 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
if (mForm && (mType == NS_FORM_BUTTON_SUBMIT ||
mType == NS_FORM_BUTTON_RESET)) {
InternalFormEvent event(true,
(mType == NS_FORM_BUTTON_RESET) ? NS_FORM_RESET : NS_FORM_SUBMIT);
(mType == NS_FORM_BUTTON_RESET) ? NS_FORM_RESET : eFormSubmit);
event.originator = this;
nsEventStatus status = nsEventStatus_eIgnore;
@ -382,7 +382,7 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
//
// Using presShell to dispatch the event. It makes sure that
// event is not handled if the window is being destroyed.
if (presShell && (event.mMessage != NS_FORM_SUBMIT ||
if (presShell && (event.mMessage != eFormSubmit ||
mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate) ||
// We know the element is a submit control, if this check is moved,
// make sure formnovalidate is used only if it's a submit control.

View File

@ -256,7 +256,7 @@ HTMLFormElement::Submit(ErrorResult& aRv)
mPendingSubmission = nullptr;
}
aRv = DoSubmitOrReset(nullptr, NS_FORM_SUBMIT);
aRv = DoSubmitOrReset(nullptr, eFormSubmit);
}
NS_IMETHODIMP
@ -493,7 +493,7 @@ HTMLFormElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
aVisitor.mWantsWillHandleEvent = true;
if (aVisitor.mEvent->originalTarget == static_cast<nsIContent*>(this)) {
uint32_t msg = aVisitor.mEvent->mMessage;
if (msg == NS_FORM_SUBMIT) {
if (msg == eFormSubmit) {
if (mGeneratingSubmit) {
aVisitor.mCanHandle = false;
return NS_OK;
@ -522,7 +522,7 @@ HTMLFormElement::WillHandleEvent(EventChainPostVisitor& aVisitor)
// If this is the bubble stage and there is a nested form below us which
// received a submit event we do *not* want to handle the submit event
// for this form too.
if ((aVisitor.mEvent->mMessage == NS_FORM_SUBMIT ||
if ((aVisitor.mEvent->mMessage == eFormSubmit ||
aVisitor.mEvent->mMessage == NS_FORM_RESET) &&
aVisitor.mEvent->mFlags.mInBubblingPhase &&
aVisitor.mEvent->originalTarget != static_cast<nsIContent*>(this)) {
@ -536,7 +536,7 @@ HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
{
if (aVisitor.mEvent->originalTarget == static_cast<nsIContent*>(this)) {
EventMessage msg = aVisitor.mEvent->mMessage;
if (msg == NS_FORM_SUBMIT) {
if (msg == eFormSubmit) {
// let the form know not to defer subsequent submissions
mDeferSubmission = false;
}
@ -544,9 +544,8 @@ HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
if (aVisitor.mEventStatus == nsEventStatus_eIgnore) {
switch (msg) {
case NS_FORM_RESET:
case NS_FORM_SUBMIT:
{
if (mPendingSubmission && msg == NS_FORM_SUBMIT) {
case eFormSubmit: {
if (mPendingSubmission && msg == eFormSubmit) {
// tell the form to forget a possible pending submission.
// the reason is that the script returned true (the event was
// ignored) so if there is a stored submission, it will miss
@ -561,7 +560,7 @@ HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
break;
}
} else {
if (msg == NS_FORM_SUBMIT) {
if (msg == eFormSubmit) {
// tell the form to flush a possible pending submission.
// the reason is that the script returned false (the event was
// not ignored) so if there is a stored submission, it needs to
@ -570,7 +569,7 @@ HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
}
}
if (msg == NS_FORM_SUBMIT) {
if (msg == eFormSubmit) {
mGeneratingSubmit = false;
}
else if (msg == NS_FORM_RESET) {
@ -582,7 +581,7 @@ HTMLFormElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
nsresult
HTMLFormElement::DoSubmitOrReset(WidgetEvent* aEvent,
int32_t aMessage)
EventMessage aMessage)
{
// Make sure the presentation is up-to-date
nsIDocument* doc = GetComposedDoc();
@ -597,7 +596,7 @@ HTMLFormElement::DoSubmitOrReset(WidgetEvent* aEvent,
return DoReset();
}
if (NS_FORM_SUBMIT == aMessage) {
if (eFormSubmit == aMessage) {
// Don't submit if we're not in a document or if we're in
// a sandboxed frame and form submit is disabled.
if (!doc || (doc->GetSandboxFlags() & SANDBOXED_FORMS)) {

View File

@ -452,7 +452,7 @@ protected:
};
nsresult DoSubmitOrReset(WidgetEvent* aEvent,
int32_t aMessage);
EventMessage aMessage);
nsresult DoReset();
// Async callback to handle removal of our default submit

View File

@ -2817,7 +2817,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;
InternalFormEvent event(true, NS_FORM_SUBMIT);
InternalFormEvent event(true, eFormSubmit);
nsEventStatus status = nsEventStatus_eIgnore;
shell->HandleDOMEventWithTarget(mForm, &event, &status);
}
@ -4015,7 +4015,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
case NS_FORM_INPUT_IMAGE:
if (mForm) {
InternalFormEvent event(true,
(mType == NS_FORM_INPUT_RESET) ? NS_FORM_RESET : NS_FORM_SUBMIT);
(mType == NS_FORM_INPUT_RESET) ? NS_FORM_RESET : eFormSubmit);
event.originator = this;
nsEventStatus status = nsEventStatus_eIgnore;
@ -4027,7 +4027,7 @@ HTMLInputElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
// pres shell. See bug 125624.
// TODO: removing this code and have the submit event sent by the
// form, see bug 592124.
if (presShell && (event.mMessage != NS_FORM_SUBMIT ||
if (presShell && (event.mMessage != eFormSubmit ||
mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate) ||
// We know the element is a submit control, if this check is moved,
// make sure formnovalidate is used only if it's a submit control.

View File

@ -90,7 +90,7 @@ NS_EVENT_MESSAGE(eBeforeUnload, eStreamEventFirst + 6)
NS_EVENT_MESSAGE(eReadyStateChange, eStreamEventFirst + 8)
NS_EVENT_MESSAGE(eFormEventFirst, 1200)
NS_EVENT_MESSAGE(NS_FORM_SUBMIT, eFormEventFirst)
NS_EVENT_MESSAGE(eFormSubmit, eFormEventFirst)
NS_EVENT_MESSAGE(NS_FORM_RESET, eFormEventFirst + 1)
NS_EVENT_MESSAGE(NS_FORM_CHANGE, eFormEventFirst + 2)
NS_EVENT_MESSAGE(NS_FORM_SELECTED, eFormEventFirst + 3)

View File

@ -2642,7 +2642,7 @@ case _value: eventName.AssignLiteral(_name) ; break
_ASSIGN_eventName(NS_FORM_SELECTED,"NS_FORM_SELECTED");
_ASSIGN_eventName(NS_FORM_CHANGE,"NS_FORM_CHANGE");
_ASSIGN_eventName(NS_FORM_RESET,"NS_FORM_RESET");
_ASSIGN_eventName(NS_FORM_SUBMIT,"NS_FORM_SUBMIT");
_ASSIGN_eventName(eFormSubmit,"eFormSubmit");
_ASSIGN_eventName(eImageAbort,"eImageAbort");
_ASSIGN_eventName(eLoadError,"eLoadError");
_ASSIGN_eventName(eKeyDown,"eKeyDown");