Bug 920377 part.7 Get rid of nsFocusEvent r=roc
authorMasayuki Nakano <masayuki@d-toybox.com>
Fri, 27 Sep 2013 15:20:55 +0900
changeset 148951 99e55a7040fad62d3a60e2c488cca941cddf60c8
parent 148950 78f0a1cb042e3d5e9913acef737346008345e5a3
child 148952 103d145e68c09368cf73bf58caedb97ad3eb176a
push id25366
push userkwierso@gmail.com
push dateSat, 28 Sep 2013 02:13:38 +0000
treeherdermozilla-central@e1914e294152 [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.7 Get rid of nsFocusEvent r=roc
content/base/src/Element.cpp
content/events/src/nsDOMEvent.cpp
content/events/src/nsDOMFocusEvent.cpp
content/events/src/nsDOMFocusEvent.h
content/events/src/nsEventDispatcher.cpp
content/html/content/src/HTMLInputElement.cpp
dom/base/nsFocusManager.cpp
dom/interfaces/events/nsIDOMEvent.idl
widget/ContentEvents.h
widget/EventForwards.h
--- a/content/base/src/Element.cpp
+++ b/content/base/src/Element.cpp
@@ -2133,17 +2133,17 @@ Element::PreHandleEventForLinks(nsEventC
   // updated even if the event is consumed before we have a chance to set it.
   switch (aVisitor.mEvent->message) {
   // Set the status bar similarly for mouseover and focus
   case NS_MOUSE_ENTER_SYNTH:
     aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
     // FALL THROUGH
   case NS_FOCUS_CONTENT:
     if (aVisitor.mEvent->eventStructType != NS_FOCUS_EVENT ||
-        !static_cast<nsFocusEvent*>(aVisitor.mEvent)->isRefocus) {
+        !static_cast<InternalFocusEvent*>(aVisitor.mEvent)->isRefocus) {
       nsAutoString target;
       GetLinkTarget(target);
       nsContentUtils::TriggerLink(this, aVisitor.mPresContext, absURI, target,
                                   false, true, true);
       // Make sure any ancestor links don't also TriggerLink
       aVisitor.mEvent->mFlags.mMultipleActionsPrevented = true;
     }
     break;
--- a/content/events/src/nsDOMEvent.cpp
+++ b/content/events/src/nsDOMEvent.cpp
@@ -152,17 +152,17 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ns
       case NS_CLIPBOARD_EVENT:
         static_cast<nsClipboardEvent*>(tmp->mEvent)->clipboardData = nullptr;
         break;
       case NS_MUTATION_EVENT:
         static_cast<InternalMutationEvent*>(tmp->mEvent)->mRelatedNode =
           nullptr;
         break;
       case NS_FOCUS_EVENT:
-        static_cast<nsFocusEvent*>(tmp->mEvent)->relatedTarget = nullptr;
+        static_cast<InternalFocusEvent*>(tmp->mEvent)->relatedTarget = nullptr;
         break;
       default:
         break;
     }
   }
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mPresContext);
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mExplicitOriginalTarget);
   NS_IMPL_CYCLE_COLLECTION_UNLINK(mOwner);
@@ -199,17 +199,17 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(
       case NS_MUTATION_EVENT:
         NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->mRelatedNode");
         cb.NoteXPCOMChild(
           static_cast<InternalMutationEvent*>(tmp->mEvent)->mRelatedNode);
         break;
       case NS_FOCUS_EVENT:
         NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEvent->relatedTarget");
         cb.NoteXPCOMChild(
-          static_cast<nsFocusEvent*>(tmp->mEvent)->relatedTarget);
+          static_cast<InternalFocusEvent*>(tmp->mEvent)->relatedTarget);
         break;
       default:
         break;
     }
   }
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPresContext)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mExplicitOriginalTarget)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOwner)
@@ -649,18 +649,19 @@ nsDOMEvent::DuplicatePrivateData()
       nsFormEvent* oldFormEvent = static_cast<nsFormEvent*>(mEvent);
       nsFormEvent* formEvent = new nsFormEvent(false, msg);
       formEvent->AssignFormEventData(*oldFormEvent, true);
       newEvent = formEvent;
       break;
     }
     case NS_FOCUS_EVENT:
     {
-      nsFocusEvent* newFocusEvent = new nsFocusEvent(false, msg);
-      nsFocusEvent* oldFocusEvent = static_cast<nsFocusEvent*>(mEvent);
+      InternalFocusEvent* newFocusEvent = new InternalFocusEvent(false, msg);
+      InternalFocusEvent* oldFocusEvent =
+        static_cast<InternalFocusEvent*>(mEvent);
       newFocusEvent->AssignFocusEventData(*oldFocusEvent, true);
       newEvent = newFocusEvent;
       break;
     }
     case NS_COMMAND_EVENT:
     {
       WidgetCommandEvent* oldCommandEvent =
         static_cast<WidgetCommandEvent*>(mEvent);
--- a/content/events/src/nsDOMFocusEvent.cpp
+++ b/content/events/src/nsDOMFocusEvent.cpp
@@ -8,63 +8,64 @@
 #include "mozilla/ContentEvents.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 
 NS_IMPL_ISUPPORTS_INHERITED1(nsDOMFocusEvent, nsDOMUIEvent, nsIDOMFocusEvent)
 
 nsDOMFocusEvent::nsDOMFocusEvent(mozilla::dom::EventTarget* aOwner,
-                                 nsPresContext* aPresContext, nsFocusEvent* aEvent)
-  : nsDOMUIEvent(aOwner, aPresContext, aEvent ?
-                 static_cast<nsGUIEvent*>(aEvent) :
-                 static_cast<nsGUIEvent*>(new nsFocusEvent(false, NS_FOCUS_CONTENT)))
+                                 nsPresContext* aPresContext,
+                                 InternalFocusEvent* aEvent)
+  : nsDOMUIEvent(aOwner, aPresContext,
+                 aEvent ? aEvent :
+                          new InternalFocusEvent(false, NS_FOCUS_CONTENT))
 {
   if (aEvent) {
     mEventIsInternal = false;
   } else {
     mEventIsInternal = true;
     mEvent->time = PR_Now();
   }
 }
 
 nsDOMFocusEvent::~nsDOMFocusEvent()
 {
   if (mEventIsInternal && mEvent) {
-    delete static_cast<nsFocusEvent*>(mEvent);
+    delete static_cast<InternalFocusEvent*>(mEvent);
     mEvent = nullptr;
   }
 }
 
 /* readonly attribute nsIDOMEventTarget relatedTarget; */
 NS_IMETHODIMP
 nsDOMFocusEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
 {
   NS_ENSURE_ARG_POINTER(aRelatedTarget);
   NS_IF_ADDREF(*aRelatedTarget = GetRelatedTarget());
   return NS_OK;
 }
 
 mozilla::dom::EventTarget*
 nsDOMFocusEvent::GetRelatedTarget()
 {
-  return static_cast<nsFocusEvent*>(mEvent)->relatedTarget;
+  return static_cast<InternalFocusEvent*>(mEvent)->relatedTarget;
 }
 
 nsresult
 nsDOMFocusEvent::InitFocusEvent(const nsAString& aType,
                                 bool aCanBubble,
                                 bool aCancelable,
                                 nsIDOMWindow* aView,
                                 int32_t aDetail,
                                 mozilla::dom::EventTarget* aRelatedTarget)
 {
   nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
   NS_ENSURE_SUCCESS(rv, rv);
-  static_cast<nsFocusEvent*>(mEvent)->relatedTarget = aRelatedTarget;
+  static_cast<InternalFocusEvent*>(mEvent)->relatedTarget = aRelatedTarget;
   return NS_OK;
 }
 
 already_AddRefed<nsDOMFocusEvent>
 nsDOMFocusEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
                              const nsAString& aType,
                              const mozilla::dom::FocusEventInit& aParam,
                              mozilla::ErrorResult& aRv)
@@ -76,13 +77,13 @@ nsDOMFocusEvent::Constructor(const mozil
                           aParam.mDetail, aParam.mRelatedTarget);
   e->SetTrusted(trusted);
   return e.forget();
 }
 
 nsresult NS_NewDOMFocusEvent(nsIDOMEvent** aInstancePtrResult,
                              mozilla::dom::EventTarget* aOwner,
                              nsPresContext* aPresContext,
-                             nsFocusEvent* aEvent)
+                             InternalFocusEvent* aEvent)
 {
   nsDOMFocusEvent* it = new nsDOMFocusEvent(aOwner, aPresContext, aEvent);
   return CallQueryInterface(it, aInstancePtrResult);
 }
--- a/content/events/src/nsDOMFocusEvent.h
+++ b/content/events/src/nsDOMFocusEvent.h
@@ -22,17 +22,18 @@ public:
 
   virtual JSObject* WrapObject(JSContext* aCx,
                                JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
   {
     return mozilla::dom::FocusEventBinding::Wrap(aCx, aScope, this);
   }
 
   nsDOMFocusEvent(mozilla::dom::EventTarget* aOwner,
-                  nsPresContext* aPresContext, nsFocusEvent* aEvent);
+                  nsPresContext* aPresContext,
+                  mozilla::InternalFocusEvent* aEvent);
 
   mozilla::dom::EventTarget* GetRelatedTarget();
 
   static already_AddRefed<nsDOMFocusEvent> Constructor(const mozilla::dom::GlobalObject& aGlobal,
                                                        const nsAString& aType,
                                                        const mozilla::dom::FocusEventInit& aParam,
                                                        mozilla::ErrorResult& aRv);
 protected:
--- a/content/events/src/nsEventDispatcher.cpp
+++ b/content/events/src/nsEventDispatcher.cpp
@@ -706,17 +706,17 @@ nsEventDispatcher::CreateEvent(mozilla::
       return NS_NewDOMCompositionEvent(
         aDOMEvent, aOwner,
         aPresContext, static_cast<nsCompositionEvent*>(aEvent));
     case NS_MOUSE_EVENT:
       return NS_NewDOMMouseEvent(aDOMEvent, aOwner, aPresContext,
                                  static_cast<nsInputEvent*>(aEvent));
     case NS_FOCUS_EVENT:
       return NS_NewDOMFocusEvent(aDOMEvent, aOwner, aPresContext,
-                                 static_cast<nsFocusEvent*>(aEvent));
+                                 static_cast<InternalFocusEvent*>(aEvent));
     case NS_MOUSE_SCROLL_EVENT:
       return NS_NewDOMMouseScrollEvent(aDOMEvent, aOwner, aPresContext,
                                  static_cast<nsInputEvent*>(aEvent));
     case NS_WHEEL_EVENT:
       return NS_NewDOMWheelEvent(aDOMEvent, aOwner, aPresContext,
                                  static_cast<WheelEvent*>(aEvent));
     case NS_DRAG_EVENT:
       return NS_NewDOMDragEvent(aDOMEvent, aOwner, aPresContext,
--- a/content/html/content/src/HTMLInputElement.cpp
+++ b/content/html/content/src/HTMLInputElement.cpp
@@ -3388,17 +3388,17 @@ HTMLInputElement::PostHandleEvent(nsEven
         case NS_FOCUS_CONTENT:
         {
           // see if we should select the contents of the textbox. This happens
           // for text and password fields when the field was focused by the
           // keyboard or a navigation, the platform allows it, and it wasn't
           // just because we raised a window.
           nsIFocusManager* fm = nsFocusManager::GetFocusManager();
           if (fm && IsSingleLineTextControl(false) &&
-              !(static_cast<nsFocusEvent*>(aVisitor.mEvent))->fromRaise &&
+              !(static_cast<InternalFocusEvent*>(aVisitor.mEvent))->fromRaise &&
               SelectTextFieldOnFocus()) {
             nsIDocument* document = GetCurrentDoc();
             if (document) {
               uint32_t lastFocusMethod;
               fm->GetLastFocusMethod(document->GetWindow(), &lastFocusMethod);
               if (lastFocusMethod &
                   (nsIFocusManager::FLAG_BYKEY | nsIFocusManager::FLAG_BYMOVEFOCUS)) {
                 nsRefPtr<nsPresContext> presContext = GetPresContext();
--- a/dom/base/nsFocusManager.cpp
+++ b/dom/base/nsFocusManager.cpp
@@ -1847,17 +1847,17 @@ public:
   FocusBlurEvent(nsISupports* aTarget, uint32_t aType,
                  nsPresContext* aContext, bool aWindowRaised,
                  bool aIsRefocus)
   : mTarget(aTarget), mType(aType), mContext(aContext),
     mWindowRaised(aWindowRaised), mIsRefocus(aIsRefocus) {}
 
   NS_IMETHOD Run()
   {
-    nsFocusEvent event(true, mType);
+    InternalFocusEvent event(true, mType);
     event.mFlags.mBubbles = false;
     event.fromRaise = mWindowRaised;
     event.isRefocus = mIsRefocus;
     return nsEventDispatcher::Dispatch(mTarget, mContext, &event);
   }
 
   nsCOMPtr<nsISupports>   mTarget;
   uint32_t                mType;
--- a/dom/interfaces/events/nsIDOMEvent.idl
+++ b/dom/interfaces/events/nsIDOMEvent.idl
@@ -242,17 +242,17 @@ nsresult
 NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult,
                     mozilla::dom::EventTarget* aOwner,
                     nsPresContext* aPresContext,
                     nsInputEvent* aEvent);
 nsresult
 NS_NewDOMFocusEvent(nsIDOMEvent** aInstancePtrResult,
                     mozilla::dom::EventTarget* aOwner,
                     nsPresContext* aPresContext,
-                    nsFocusEvent* aEvent);
+                    mozilla::InternalFocusEvent* aEvent);
 nsresult
 NS_NewDOMMouseScrollEvent(nsIDOMEvent** aInstancePtrResult,
                           mozilla::dom::EventTarget* aOwner,
                           nsPresContext* aPresContext,
                           nsInputEvent* aEvent);
 nsresult
 NS_NewDOMWheelEvent(nsIDOMEvent** aInstancePtrResult,
                     mozilla::dom::EventTarget* aOwner,
--- a/widget/ContentEvents.h
+++ b/widget/ContentEvents.h
@@ -248,11 +248,10 @@ public:
 } // namespace mozilla
 
 // TODO: Remove following typedefs
 typedef mozilla::InternalScriptErrorEvent nsScriptErrorEvent;
 typedef mozilla::InternalScrollPortEvent  nsScrollPortEvent;
 typedef mozilla::InternalScrollAreaEvent  nsScrollAreaEvent;
 typedef mozilla::InternalFormEvent        nsFormEvent;
 typedef mozilla::InternalClipboardEvent   nsClipboardEvent;
-typedef mozilla::InternalFocusEvent       nsFocusEvent;
 
 #endif // mozilla_ContentEvents_h__
--- a/widget/EventForwards.h
+++ b/widget/EventForwards.h
@@ -128,11 +128,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;
 typedef mozilla::InternalClipboardEvent    nsClipboardEvent;
-typedef mozilla::InternalFocusEvent        nsFocusEvent;
 
 #endif // mozilla_EventForwards_h__