bug 1164976 - move AccessibleWrap::FireStateChangeEvent to be a member of MaiAtkObject r=davidb
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Wed, 13 May 2015 10:35:34 -0400
changeset 244090 d9afa8ff148ecb258925faaa9b4447fef640ac2a
parent 244089 06b840460921eb9f8977df21465e8b1d7197af2d
child 244091 661f089f73b53b4c5080188aa36a4d97469149c3
push id59840
push usertrev.saunders@gmail.com
push dateSat, 16 May 2015 00:30:46 +0000
treeherdermozilla-inbound@e5649b9714d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb
bugs1164976
milestone41.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 1164976 - move AccessibleWrap::FireStateChangeEvent to be a member of MaiAtkObject r=davidb
accessible/atk/AccessibleWrap.cpp
accessible/atk/nsMai.h
--- a/accessible/atk/AccessibleWrap.cpp
+++ b/accessible/atk/AccessibleWrap.cpp
@@ -1123,17 +1123,22 @@ AccessibleWrap::HandleAccEvent(AccEvent*
 
     AccessibleWrap* accWrap = GetAccessibleWrap(atkObj);
     if (!accWrap) {
         return NS_OK; // Node is shut down
     }
 
     switch (type) {
     case nsIAccessibleEvent::EVENT_STATE_CHANGE:
-        return FireAtkStateChangeEvent(aEvent, atkObj);
+      {
+        AccStateChangeEvent* event = downcast_accEvent(aEvent);
+        MAI_ATK_OBJECT(atkObj)->FireStateChangeEvent(event->GetState(),
+                                                     event->IsStateEnabled());
+        break;
+      }
 
     case nsIAccessibleEvent::EVENT_TEXT_REMOVED:
     case nsIAccessibleEvent::EVENT_TEXT_INSERTED:
         return FireAtkTextChangedEvent(aEvent, atkObj);
 
     case nsIAccessibleEvent::EVENT_FOCUS:
       {
         a11y::RootAccessible* rootAccWrap = accWrap->RootAccessible();
@@ -1375,44 +1380,37 @@ a11y::ProxyEvent(ProxyAccessible* aTarge
     break;
   case nsIAccessibleEvent::EVENT_MENUPOPUP_END:
     atk_object_notify_state_change(wrapper, ATK_STATE_VISIBLE, false);
     atk_object_notify_state_change(wrapper, ATK_STATE_SHOWING, false);
     break;
   }
 }
 
-nsresult
-AccessibleWrap::FireAtkStateChangeEvent(AccEvent* aEvent,
-                                        AtkObject* aObject)
+void
+MaiAtkObject::FireStateChangeEvent(uint64_t aState, bool aEnabled)
 {
-    AccStateChangeEvent* event = downcast_accEvent(aEvent);
-    NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
-
-    bool isEnabled = event->IsStateEnabled();
-    int32_t stateIndex = AtkStateMap::GetStateIndexFor(event->GetState());
+    int32_t stateIndex = AtkStateMap::GetStateIndexFor(aState);
     if (stateIndex >= 0) {
         NS_ASSERTION(gAtkStateMap[stateIndex].stateMapEntryType != kNoSuchState,
                      "No such state");
 
         if (gAtkStateMap[stateIndex].atkState != kNone) {
             NS_ASSERTION(gAtkStateMap[stateIndex].stateMapEntryType != kNoStateChange,
                          "State changes should not fired for this state");
 
             if (gAtkStateMap[stateIndex].stateMapEntryType == kMapOpposite)
-                isEnabled = !isEnabled;
+                aEnabled = !aEnabled;
 
             // Fire state change for first state if there is one to map
-            atk_object_notify_state_change(aObject,
+            atk_object_notify_state_change(&parent,
                                            gAtkStateMap[stateIndex].atkState,
-                                           isEnabled);
+                                           aEnabled);
         }
     }
-
-    return NS_OK;
 }
 
 nsresult
 AccessibleWrap::FireAtkTextChangedEvent(AccEvent* aEvent,
                                         AtkObject* aObject)
 {
     AccTextChangeEvent* event = downcast_accEvent(aEvent);
     NS_ENSURE_TRUE(event, NS_ERROR_FAILURE);
--- a/accessible/atk/nsMai.h
+++ b/accessible/atk/nsMai.h
@@ -71,11 +71,16 @@ struct MaiAtkObject
    * Get the AtkHyperlink for this atk object.
    */
   AtkHyperlink* GetAtkHyperlink();
 
   /*
    * Shutdown this AtkObject.
    */
   void Shutdown();
+
+  /*
+   * Notify atk of a state change on this AtkObject.
+   */
+  void FireStateChangeEvent(uint64_t aState, bool aEnabled);
 };
 
 #endif /* __NS_MAI_H__ */