Bug 1455055 part 4. Clean up HandleEvent implementations in accessible. r=masayuki
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 20 Apr 2018 00:49:29 -0400
changeset 470811 a8a18e514b3d582939adb8173b540eedabbc06d6
parent 470810 21dc0a5895332067a6ff6e7dba21569c18ea4b55
child 470812 3f6f6c68e211b11ade14bf6cddd38426c73c63b0
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmasayuki
bugs1455055
milestone61.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 1455055 part 4. Clean up HandleEvent implementations in accessible. r=masayuki MozReview-Commit-ID: B3ez0ESo21g
accessible/base/DocManager.cpp
accessible/generic/RootAccessible.cpp
accessible/generic/RootAccessible.h
--- a/accessible/base/DocManager.cpp
+++ b/accessible/base/DocManager.cpp
@@ -354,18 +354,17 @@ DocManager::OnSecurityChange(nsIWebProgr
 // nsIDOMEventListener
 
 NS_IMETHODIMP
 DocManager::HandleEvent(Event* aEvent)
 {
   nsAutoString type;
   aEvent->GetType(type);
 
-  nsCOMPtr<nsIDocument> document =
-    do_QueryInterface(aEvent->InternalDOMEvent()->GetTarget());
+  nsCOMPtr<nsIDocument> document = do_QueryInterface(aEvent->GetTarget());
   NS_ASSERTION(document, "pagehide or DOMContentLoaded for non document!");
   if (!document)
     return NS_OK;
 
   if (type.EqualsLiteral("pagehide")) {
     // 'pagehide' event is registered on every DOM document we create an
     // accessible for, process the event for the target. This document
     // accessible and all its sub document accessible are shutdown as result of
--- a/accessible/generic/RootAccessible.cpp
+++ b/accessible/generic/RootAccessible.cpp
@@ -228,18 +228,17 @@ RootAccessible::DocumentActivated(DocAcc
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIDOMEventListener
 
 NS_IMETHODIMP
 RootAccessible::HandleEvent(Event* aDOMEvent)
 {
   MOZ_ASSERT(aDOMEvent);
-  Event* event = aDOMEvent->InternalDOMEvent();
-  nsCOMPtr<nsINode> origTargetNode = do_QueryInterface(event->GetOriginalTarget());
+  nsCOMPtr<nsINode> origTargetNode = do_QueryInterface(aDOMEvent->GetOriginalTarget());
   if (!origTargetNode)
     return NS_OK;
 
 #ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eDOMEvents)) {
     nsAutoString eventType;
     aDOMEvent->GetType(eventType);
     logging::DOMEvent("handled", origTargetNode, eventType);
@@ -248,30 +247,30 @@ RootAccessible::HandleEvent(Event* aDOME
 
   DocAccessible* document =
     GetAccService()->GetDocAccessible(origTargetNode->OwnerDoc());
 
   if (document) {
     // Root accessible exists longer than any of its descendant documents so
     // that we are guaranteed notification is processed before root accessible
     // is destroyed.
-    document->HandleNotification<RootAccessible, nsIDOMEvent>
+    document->HandleNotification<RootAccessible, Event>
       (this, &RootAccessible::ProcessDOMEvent, aDOMEvent);
   }
 
   return NS_OK;
 }
 
 // RootAccessible protected
 void
-RootAccessible::ProcessDOMEvent(nsIDOMEvent* aDOMEvent)
+RootAccessible::ProcessDOMEvent(Event* aDOMEvent)
 {
   MOZ_ASSERT(aDOMEvent);
-  Event* event = aDOMEvent->InternalDOMEvent();
-  nsCOMPtr<nsINode> origTargetNode = do_QueryInterface(event->GetOriginalTarget());
+  nsCOMPtr<nsINode> origTargetNode =
+    do_QueryInterface(aDOMEvent->GetOriginalTarget());
 
   nsAutoString eventType;
   aDOMEvent->GetType(eventType);
 
 #ifdef A11Y_LOG
   if (logging::IsEnabled(logging::eDOMEvents))
     logging::DOMEvent("processed", origTargetNode, eventType);
 #endif
@@ -647,21 +646,21 @@ RootAccessible::HandlePopupHidingEvent(n
     RefPtr<AccEvent> event =
       new AccStateChangeEvent(widget, states::EXPANDED, false);
     document->FireDelayedEvent(event);
   }
 }
 
 #ifdef MOZ_XUL
 static void
-GetPropertyBagFromEvent(nsIDOMEvent* aEvent, nsIPropertyBag2** aPropertyBag)
+GetPropertyBagFromEvent(Event* aEvent, nsIPropertyBag2** aPropertyBag)
 {
   *aPropertyBag = nullptr;
 
-  CustomEvent* customEvent = aEvent->InternalDOMEvent()->AsCustomEvent();
+  CustomEvent* customEvent = aEvent->AsCustomEvent();
   if (!customEvent)
     return;
 
   AutoJSAPI jsapi;
   if (!jsapi.Init(customEvent->GetParentObject()))
     return;
 
   JSContext* cx = jsapi.cx();
@@ -677,17 +676,17 @@ GetPropertyBagFromEvent(nsIDOMEvent* aEv
   rv = UnwrapArg<nsIPropertyBag2>(cx, detailObj, getter_AddRefs(propBag));
   if (NS_FAILED(rv))
     return;
 
   propBag.forget(aPropertyBag);
 }
 
 void
-RootAccessible::HandleTreeRowCountChangedEvent(nsIDOMEvent* aEvent,
+RootAccessible::HandleTreeRowCountChangedEvent(Event* aEvent,
                                                XULTreeAccessible* aAccessible)
 {
   nsCOMPtr<nsIPropertyBag2> propBag;
   GetPropertyBagFromEvent(aEvent, getter_AddRefs(propBag));
   if (!propBag)
     return;
 
   nsresult rv;
@@ -699,17 +698,17 @@ RootAccessible::HandleTreeRowCountChange
   rv = propBag->GetPropertyAsInt32(NS_LITERAL_STRING("count"), &count);
   if (NS_FAILED(rv))
     return;
 
   aAccessible->InvalidateCache(index, count);
 }
 
 void
-RootAccessible::HandleTreeInvalidatedEvent(nsIDOMEvent* aEvent,
+RootAccessible::HandleTreeInvalidatedEvent(Event* aEvent,
                                            XULTreeAccessible* aAccessible)
 {
   nsCOMPtr<nsIPropertyBag2> propBag;
   GetPropertyBagFromEvent(aEvent, getter_AddRefs(propBag));
   if (!propBag)
     return;
 
   int32_t startRow = 0, endRow = -1, startCol = 0, endCol = -1;
--- a/accessible/generic/RootAccessible.h
+++ b/accessible/generic/RootAccessible.h
@@ -53,33 +53,33 @@ protected:
    * Add/remove DOM event listeners.
    */
   virtual nsresult AddEventListeners() override;
   virtual nsresult RemoveEventListeners() override;
 
   /**
    * Process the DOM event.
    */
-  void ProcessDOMEvent(nsIDOMEvent* aEvent);
+  void ProcessDOMEvent(dom::Event* aEvent);
 
   /**
    * Process "popupshown" event. Used by HandleEvent().
    */
   void HandlePopupShownEvent(Accessible* aAccessible);
 
   /*
    * Process "popuphiding" event. Used by HandleEvent().
    */
   void HandlePopupHidingEvent(nsINode* aNode);
 
 #ifdef MOZ_XUL
-    void HandleTreeRowCountChangedEvent(nsIDOMEvent* aEvent,
-                                        XULTreeAccessible* aAccessible);
-    void HandleTreeInvalidatedEvent(nsIDOMEvent* aEvent,
-                                    XULTreeAccessible* aAccessible);
+  void HandleTreeRowCountChangedEvent(dom::Event* aEvent,
+                                      XULTreeAccessible* aAccessible);
+  void HandleTreeInvalidatedEvent(dom::Event* aEvent,
+                                  XULTreeAccessible* aAccessible);
 
     uint32_t GetChromeFlags();
 #endif
 };
 
 inline RootAccessible*
 Accessible::AsRoot()
 {