diff --git a/accessible/base/nsTextEquivUtils.cpp b/accessible/base/nsTextEquivUtils.cpp index 01a2381d1d57..695cab6e5b33 100644 --- a/accessible/base/nsTextEquivUtils.cpp +++ b/accessible/base/nsTextEquivUtils.cpp @@ -11,6 +11,7 @@ #include "LocalAccessible-inl.h" #include "AccIterator.h" #include "nsCoreUtils.h" +#include "mozilla/dom/ChildIterator.h" #include "mozilla/dom/Text.h" #include "nsIContentInlines.h" @@ -123,8 +124,9 @@ nsresult nsTextEquivUtils::AppendTextEquivFromTextContent(nsIContent* aContent, nsresult nsTextEquivUtils::AppendFromDOMChildren(nsIContent* aContent, nsAString* aString) { - for (nsIContent* childContent = aContent->GetFirstChild(); childContent; - childContent = childContent->GetNextSibling()) { + auto iter = + dom::AllChildrenIterator(aContent, nsIContent::eAllChildren, true); + while (nsIContent* childContent = iter.GetNextChild()) { nsresult rv = AppendFromDOMNode(childContent, aString); NS_ENSURE_SUCCESS(rv, rv); } diff --git a/accessible/tests/mochitest/name/test_general.html b/accessible/tests/mochitest/name/test_general.html index 05b9db1a5d39..c21fba85c96f 100644 --- a/accessible/tests/mochitest/name/test_general.html +++ b/accessible/tests/mochitest/name/test_general.html @@ -264,6 +264,8 @@ const shadowRoot = getNode("shadowHost").shadowRoot; const shadowButtonVisibleText = shadowRoot.getElementById("shadowButtonVisibleText"); testName(shadowButtonVisibleText, "shadowButtonVisibleText"); + const shadowButtonHiddenText = shadowRoot.getElementById("shadowButtonHiddenText"); + testName(shadowButtonHiddenText, "shadowButtonHiddenText"); SimpleTest.finish(); } @@ -736,10 +738,13 @@
shadowButtonVisibleText + shadowButtonHiddenText