Bug 1566299: Update XULListBoxAccessible now that autocomplete-richlistbox-popup is a Custom Element. r=surkov a=RyanVM
authorJames Teh <jteh@mozilla.com>
Thu, 18 Jul 2019 04:47:42 +0000
changeset 541478 07d0601ce1716b9f1d425a9d1b469eddd5410165
parent 541477 524bbb009aa8b0956b0790b915d88ffda43fc6f3
child 541479 43030692b97baac6e41b94f3a59829209fdd3aaa
push id11620
push userrmaries@mozilla.com
push dateMon, 22 Jul 2019 19:45:05 +0000
treeherdermozilla-beta@50dcd65bee40 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssurkov, RyanVM
bugs1566299, 1525101
milestone69.0
Bug 1566299: Update XULListBoxAccessible now that autocomplete-richlistbox-popup is a Custom Element. r=surkov a=RyanVM In bug 1525101, autocomplete-richlistbox-popup was converted to a Custom Element. This means we can no longer use do_QueryInterface to get nsIAutoCompletePopup. Instead, we must use Element::AsAutoCompletePopup. This fixes accessibility focus for these autocompletes. Differential Revision: https://phabricator.services.mozilla.com/D38158
accessible/xul/XULListboxAccessible.cpp
--- a/accessible/xul/XULListboxAccessible.cpp
+++ b/accessible/xul/XULListboxAccessible.cpp
@@ -68,17 +68,17 @@ bool XULColumnItemAccessible::DoAction(u
 ////////////////////////////////////////////////////////////////////////////////
 
 XULListboxAccessible::XULListboxAccessible(nsIContent* aContent,
                                            DocAccessible* aDoc)
     : XULSelectControlAccessible(aContent, aDoc) {
   nsIContent* parentContent = mContent->GetFlattenedTreeParent();
   if (parentContent) {
     nsCOMPtr<nsIAutoCompletePopup> autoCompletePopupElm =
-        do_QueryInterface(parentContent);
+        parentContent->AsElement()->AsAutoCompletePopup();
     if (autoCompletePopupElm) mGenericTypes |= eAutoCompletePopup;
   }
 
   if (IsMulticolumn()) mGenericTypes |= eTable;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULListboxAccessible: Accessible
@@ -372,37 +372,41 @@ void XULListboxAccessible::UnselectRow(u
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULListboxAccessible: Widgets
 
 bool XULListboxAccessible::IsWidget() const { return true; }
 
 bool XULListboxAccessible::IsActiveWidget() const {
   if (IsAutoCompletePopup()) {
-    nsCOMPtr<nsIAutoCompletePopup> autoCompletePopupElm =
-        do_QueryInterface(mContent->GetParent());
-
-    if (autoCompletePopupElm) {
-      bool isOpen = false;
-      autoCompletePopupElm->GetPopupOpen(&isOpen);
-      return isOpen;
+    nsIContent* parentContent = mContent->GetParent();
+    if (parentContent) {
+      nsCOMPtr<nsIAutoCompletePopup> autoCompletePopupElm =
+          parentContent->AsElement()->AsAutoCompletePopup();
+      if (autoCompletePopupElm) {
+        bool isOpen = false;
+        autoCompletePopupElm->GetPopupOpen(&isOpen);
+        return isOpen;
+      }
     }
   }
   return FocusMgr()->HasDOMFocus(mContent);
 }
 
 bool XULListboxAccessible::AreItemsOperable() const {
   if (IsAutoCompletePopup()) {
-    nsCOMPtr<nsIAutoCompletePopup> autoCompletePopupElm =
-        do_QueryInterface(mContent->GetParent());
-
-    if (autoCompletePopupElm) {
-      bool isOpen = false;
-      autoCompletePopupElm->GetPopupOpen(&isOpen);
-      return isOpen;
+    nsIContent* parentContent = mContent->GetParent();
+    if (parentContent) {
+      nsCOMPtr<nsIAutoCompletePopup> autoCompletePopupElm =
+          parentContent->AsElement()->AsAutoCompletePopup();
+      if (autoCompletePopupElm) {
+        bool isOpen = false;
+        autoCompletePopupElm->GetPopupOpen(&isOpen);
+        return isOpen;
+      }
     }
   }
   return true;
 }
 
 Accessible* XULListboxAccessible::ContainerWidget() const {
   if (IsAutoCompletePopup() && mContent->GetParent()) {
     // This works for XUL autocompletes. It doesn't work for HTML forms