From adf86885d54be50f861595ed64ea5fb8d52ff8fc Mon Sep 17 00:00:00 2001 From: "surkov.alexander%gmail.com" Date: Fri, 6 Apr 2007 15:44:46 +0000 Subject: [PATCH] Fix for bug 376032 - posinset and setsize incorrect for html radio without html form, r=aaronlev --- .../src/html/nsHTMLFormControlAccessible.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/accessible/src/html/nsHTMLFormControlAccessible.cpp b/accessible/src/html/nsHTMLFormControlAccessible.cpp index 22363bc17c8..9ea331617f5 100644 --- a/accessible/src/html/nsHTMLFormControlAccessible.cpp +++ b/accessible/src/html/nsHTMLFormControlAccessible.cpp @@ -40,6 +40,7 @@ #include "nsAccessibleTreeWalker.h" #include "nsAccessibilityAtoms.h" #include "nsHTMLFormControlAccessible.h" +#include "nsIDOMDocument.h" #include "nsIDOMHTMLInputElement.h" #include "nsIDOMNSEditableElement.h" #include "nsIDOMNSHTMLButtonElement.h" @@ -160,13 +161,20 @@ nsHTMLRadioButtonAccessible::GetAttributes(nsIPersistentProperties **aAttributes nsAutoString name; content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::name, name); + nsCOMPtr inputs; + nsCOMPtr radio(do_QueryInterface(mDOMNode)); nsCOMPtr form; radio->GetForm(getter_AddRefs(form)); - NS_ENSURE_TRUE(form, NS_OK); + if (form) { + form->GetElementsByTagNameNS(nsURI, tagName, getter_AddRefs(inputs)); + } else { + nsCOMPtr document; + mDOMNode->GetOwnerDocument(getter_AddRefs(document)); + if (document) + document->GetElementsByTagNameNS(nsURI, tagName, getter_AddRefs(inputs)); + } - nsCOMPtr inputs; - form->GetElementsByTagNameNS(nsURI, tagName, getter_AddRefs(inputs)); NS_ENSURE_TRUE(inputs, NS_OK); PRUint32 inputsCount = 0;