Bug 1558686 - Enable XUL default button behavior for any doc that allows XUL. r=Jamie

Fixes test 'accessible/tests/mochitest/relations/test_general.xul' when
loaded as XHTML.

Differential Revision: https://phabricator.services.mozilla.com/D34655

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Brendan Dahl 2019-06-12 03:16:33 +00:00
parent d3868c05b8
commit da359a0016

View File

@ -1741,11 +1741,10 @@ Relation Accessible::RelationByType(RelationType aType) const {
// In XUL, use first <button default="true" .../> in the document
dom::Document* doc = mContent->OwnerDoc();
nsIContent* buttonEl = nullptr;
if (doc->IsXULDocument()) {
dom::XULDocument* xulDoc = doc->AsXULDocument();
if (doc->AllowXULXBL()) {
nsCOMPtr<nsIHTMLCollection> possibleDefaultButtons =
xulDoc->GetElementsByAttribute(NS_LITERAL_STRING("default"),
NS_LITERAL_STRING("true"));
doc->GetElementsByAttribute(NS_LITERAL_STRING("default"),
NS_LITERAL_STRING("true"));
if (possibleDefaultButtons) {
uint32_t length = possibleDefaultButtons->Length();
// Check for button in list of default="true" elements