Bug 1566299: Update XULListBoxAccessible now that autocomplete-richlistbox-popup is a Custom Element. r=surkov

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
James Teh 2019-07-18 04:47:42 +00:00
Родитель 9916bc6b41
Коммит 52d863a910
1 изменённых файлов: 19 добавлений и 15 удалений

Просмотреть файл

@ -73,7 +73,7 @@ XULListboxAccessible::XULListboxAccessible(nsIContent* aContent,
nsIContent* parentContent = mContent->GetFlattenedTreeParent();
if (parentContent) {
nsCOMPtr<nsIAutoCompletePopup> autoCompletePopupElm =
do_QueryInterface(parentContent);
parentContent->AsElement()->AsAutoCompletePopup();
if (autoCompletePopupElm) mGenericTypes |= eAutoCompletePopup;
}
@ -377,13 +377,15 @@ 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);
@ -391,13 +393,15 @@ bool XULListboxAccessible::IsActiveWidget() const {
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;