Bug 920377 part.9 Get rid of nsFormEvent r=roc
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 27 Sep 2013 15:20:55 +0900
changeset 162768 65a887bb7f110bacdeaf3c39c5092ac7f7066f39
parent 162767 103d145e68c09368cf73bf58caedb97ad3eb176a
child 162769 bd82d2c60f4654055505f012ce8fbc0b8ef7c953
push id3066
push userakeybl@mozilla.com
push dateMon, 09 Dec 2013 19:58:46 +0000
treeherdermozilla-beta@a31a0dce83aa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs920377
milestone27.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 920377 part.9 Get rid of nsFormEvent r=roc
content/events/src/nsDOMEvent.cpp
content/html/content/src/HTMLButtonElement.cpp
content/html/content/src/HTMLFormElement.cpp
content/html/content/src/HTMLInputElement.cpp
widget/ContentEvents.h
widget/EventForwards.h
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -644,18 +644,18 @@ nsDOMEvent::DuplicatePrivateData()
       InternalMutationEvent* oldMutationEvent =
         static_cast<InternalMutationEvent*>(mEvent);
       mutationEvent->AssignMutationEventData(*oldMutationEvent, true);
       newEvent = mutationEvent;
       break;
     }
     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;
     }
     case NS_FOCUS_EVENT:
     {
       InternalFocusEvent* newFocusEvent = new InternalFocusEvent(false, msg);
       InternalFocusEvent* oldFocusEvent =
--- a/content/html/content/src/HTMLButtonElement.cpp
+++ b/content/html/content/src/HTMLButtonElement.cpp
@@ -342,19 +342,18 @@ HTMLButtonElement::PostHandleEvent(nsEve
         break;
 
       default:
         break;
     }
     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;
 
         nsCOMPtr<nsIPresShell> presShell =
           aVisitor.mPresContext->GetPresShell();
         // If |nsIPresShell::Destroy| has been called due to
         // handling the event, the pres context will return
         // a null pres shell.  See bug 125624.
--- a/content/html/content/src/HTMLFormElement.cpp
+++ b/content/html/content/src/HTMLFormElement.cpp
@@ -417,17 +417,17 @@ HTMLFormElement::Submit()
   ErrorResult rv;
   Submit(rv);
   return rv.ErrorCode();
 }
 
 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;
 }
 
 NS_IMETHODIMP
 HTMLFormElement::CheckValidity(bool* retVal)
 {
@@ -817,23 +817,25 @@ HTMLFormElement::BuildSubmission(nsFormS
                                  nsEvent* aEvent)
 {
   NS_ASSERTION(!mPendingSubmission, "tried to build two submissions!");
 
   // Get the originating frame (failure is non-fatal)
   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);
       }
     }
   }
 
   nsresult rv;
 
   //
   // Get the submission object
--- a/content/html/content/src/HTMLInputElement.cpp
+++ b/content/html/content/src/HTMLInputElement.cpp
@@ -2805,17 +2805,17 @@ HTMLInputElement::MaybeSubmitForm(nsPres
   } else if (mForm->HasSingleTextControl() &&
              (mForm->HasAttr(kNameSpaceID_None, nsGkAtoms::novalidate) ||
               mForm->CheckValidFormSubmission())) {
     // TODO: removing this code and have the submit event sent by the form,
     // bug 592124.
     // 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);
   }
 
   return NS_OK;
 }
 
 void
@@ -3611,18 +3611,18 @@ HTMLInputElement::PostHandleEvent(nsEven
             mForm->FlushPendingSubmission();
           }
         }
         switch(mType) {
         case NS_FORM_INPUT_RESET:
         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;
 
             nsCOMPtr<nsIPresShell> presShell =
               aVisitor.mPresContext->GetPresShell();
 
             // If |nsIPresShell::Destroy| has been called due to
             // handling the event the pres context will return a null
--- a/widget/ContentEvents.h
+++ b/widget/ContentEvents.h
@@ -246,11 +246,10 @@ public:
 };
 
 } // namespace mozilla
 
 // TODO: Remove following typedefs
 typedef mozilla::InternalScriptErrorEvent nsScriptErrorEvent;
 typedef mozilla::InternalScrollPortEvent  nsScrollPortEvent;
 typedef mozilla::InternalScrollAreaEvent  nsScrollAreaEvent;
-typedef mozilla::InternalFormEvent        nsFormEvent;
 
 #endif // mozilla_ContentEvents_h__
--- a/widget/EventForwards.h
+++ b/widget/EventForwards.h
@@ -126,11 +126,10 @@ typedef WidgetWheelEvent                
 }
 
 typedef mozilla::WidgetGestureNotifyEvent  nsGestureNotifyEvent;
 typedef mozilla::WidgetSimpleGestureEvent  nsSimpleGestureEvent;
 typedef mozilla::WidgetTouchEvent          nsTouchEvent;
 typedef mozilla::InternalScriptErrorEvent  nsScriptErrorEvent;
 typedef mozilla::InternalScrollPortEvent   nsScrollPortEvent;
 typedef mozilla::InternalScrollAreaEvent   nsScrollAreaEvent;
-typedef mozilla::InternalFormEvent         nsFormEvent;
 
 #endif // mozilla_EventForwards_h__