Bug 957254 - Accessible window events missing for javascript alerts. r=tbsaunde
authorJonathan Wei <jwei@mozilla.com>
Sat, 08 Feb 2014 20:55:52 -0500
changeset 167667 4b87ae646c62347e7d14c90a80fda04d0b0a31bb
parent 167666 e6ea08c515609fab961b860d9336ab4c8a77811c
child 167668 44212959e3b04b6eccdee4b6f2b8052186e976f0
push id39529
push userryanvm@gmail.com
push dateSun, 09 Feb 2014 01:58:46 +0000
treeherdermozilla-inbound@000706153103 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde
bugs957254
milestone30.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 957254 - Accessible window events missing for javascript alerts. r=tbsaunde
accessible/src/atk/AccessibleWrap.cpp
--- a/accessible/src/atk/AccessibleWrap.cpp
+++ b/accessible/src/atk/AccessibleWrap.cpp
@@ -1121,65 +1121,77 @@ AccessibleWrap::HandleAccEvent(AccEvent*
     case nsIAccessibleEvent::EVENT_SECTION_CHANGED:
         g_signal_emit_by_name(atkObj, "visible_data_changed");
         break;
 
     case nsIAccessibleEvent::EVENT_SHOW:
         return FireAtkShowHideEvent(aEvent, atkObj, true);
 
     case nsIAccessibleEvent::EVENT_HIDE:
+        // XXX - Handle native dialog accessibles.
+        if (!accessible->IsRoot() && accessible->HasARIARole() &&
+            accessible->ARIARole() == roles::DIALOG) {
+          guint id = g_signal_lookup("deactivate", MAI_TYPE_ATK_OBJECT);
+          g_signal_emit(atkObj, id, 0);
+        }
         return FireAtkShowHideEvent(aEvent, atkObj, false);
 
         /*
          * Because dealing with menu is very different between nsIAccessible
          * and ATK, and the menu activity is important, specially transfer the
          * following two event.
          * Need more verification by AT test.
          */
     case nsIAccessibleEvent::EVENT_MENU_START:
     case nsIAccessibleEvent::EVENT_MENU_END:
         break;
 
     case nsIAccessibleEvent::EVENT_WINDOW_ACTIVATE:
       {
         accessible->AsRoot()->mActivated = true;
-        guint id = g_signal_lookup ("activate", MAI_TYPE_ATK_OBJECT);
+        guint id = g_signal_lookup("activate", MAI_TYPE_ATK_OBJECT);
         g_signal_emit(atkObj, id, 0);
 
         // Always fire a current focus event after activation.
         FocusMgr()->ForceFocusEvent();
       } break;
 
     case nsIAccessibleEvent::EVENT_WINDOW_DEACTIVATE:
       {
         accessible->AsRoot()->mActivated = false;
-        guint id = g_signal_lookup ("deactivate", MAI_TYPE_ATK_OBJECT);
+        guint id = g_signal_lookup("deactivate", MAI_TYPE_ATK_OBJECT);
         g_signal_emit(atkObj, id, 0);
       } break;
 
     case nsIAccessibleEvent::EVENT_WINDOW_MAXIMIZE:
       {
-        guint id = g_signal_lookup ("maximize", MAI_TYPE_ATK_OBJECT);
+        guint id = g_signal_lookup("maximize", MAI_TYPE_ATK_OBJECT);
         g_signal_emit(atkObj, id, 0);
       } break;
 
     case nsIAccessibleEvent::EVENT_WINDOW_MINIMIZE:
       {
-        guint id = g_signal_lookup ("minimize", MAI_TYPE_ATK_OBJECT);
+        guint id = g_signal_lookup("minimize", MAI_TYPE_ATK_OBJECT);
         g_signal_emit(atkObj, id, 0);
       } break;
 
     case nsIAccessibleEvent::EVENT_WINDOW_RESTORE:
       {
-        guint id = g_signal_lookup ("restore", MAI_TYPE_ATK_OBJECT);
+        guint id = g_signal_lookup("restore", MAI_TYPE_ATK_OBJECT);
         g_signal_emit(atkObj, id, 0);
       } break;
 
     case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_COMPLETE:
         g_signal_emit_by_name (atkObj, "load_complete");
+        // XXX - Handle native dialog accessibles.
+        if (!accessible->IsRoot() && accessible->HasARIARole() &&
+            accessible->ARIARole() == roles::DIALOG) {
+          guint id = g_signal_lookup("activate", MAI_TYPE_ATK_OBJECT);
+          g_signal_emit(atkObj, id, 0);
+        }
       break;
 
     case nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD:
         g_signal_emit_by_name (atkObj, "reload");
       break;
 
     case nsIAccessibleEvent::EVENT_DOCUMENT_LOAD_STOPPED:
         g_signal_emit_by_name (atkObj, "load_stopped");