From 4c44cd7e3108d7684f8c192bcce774c19a3e21eb Mon Sep 17 00:00:00 2001 From: "aaronleventhal%moonset.net" Date: Fri, 15 Jun 2007 01:50:38 +0000 Subject: [PATCH] Bug 384229. No accessible name for location and search fields. r=ginn.chen, r=mano git-svn-id: svn://10.0.0.236/trunk@228097 18797224-902f-48f8-a5cc-f745e15eee43 --- .../src/html/nsHTMLFormControlAccessible.cpp | 20 +++++++++++++++++++ .../src/html/nsHTMLFormControlAccessible.h | 1 + .../components/search/content/search.xml | 7 ++++++- 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/mozilla/accessible/src/html/nsHTMLFormControlAccessible.cpp b/mozilla/accessible/src/html/nsHTMLFormControlAccessible.cpp index 8dddc6c0a2b..9450bfacdee 100644 --- a/mozilla/accessible/src/html/nsHTMLFormControlAccessible.cpp +++ b/mozilla/accessible/src/html/nsHTMLFormControlAccessible.cpp @@ -401,6 +401,26 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetRole(PRUint32 *aRole) return NS_OK; } +NS_IMETHODIMP nsHTMLTextFieldAccessible::GetName(nsAString& aName) +{ + nsCOMPtr content = do_QueryInterface(mDOMNode); + if (!content) { + return NS_ERROR_FAILURE; + } + nsresult rv = GetHTMLName(aName, PR_FALSE); + if (NS_FAILED(rv) || !aName.IsEmpty() || !content->GetBindingParent()) { + return rv; + } + + // There's a binding parent. + // This means we're part of another control, so use parent accessible for name. + // This ensures that a textbox inside of a XUL widget gets + // an accessible name. + nsCOMPtr parent; + rv = GetParent(getter_AddRefs(parent)); + return parent ? parent->GetName(aName) : rv; +} + NS_IMETHODIMP nsHTMLTextFieldAccessible::GetValue(nsAString& _retval) { PRUint32 state; diff --git a/mozilla/accessible/src/html/nsHTMLFormControlAccessible.h b/mozilla/accessible/src/html/nsHTMLFormControlAccessible.h index 37d83343700..b8bf679216b 100644 --- a/mozilla/accessible/src/html/nsHTMLFormControlAccessible.h +++ b/mozilla/accessible/src/html/nsHTMLFormControlAccessible.h @@ -109,6 +109,7 @@ public: NS_IMETHOD Init(); NS_IMETHOD Shutdown(); NS_IMETHOD GetRole(PRUint32 *_retval); + NS_IMETHOD GetName(nsAString& aName); NS_IMETHOD GetValue(nsAString& _retval); NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState); NS_IMETHOD GetNumActions(PRUint8 *_retval); diff --git a/mozilla/browser/components/search/content/search.xml b/mozilla/browser/components/search/content/search.xml index b753546dd6c..fb0846afd69 100644 --- a/mozilla/browser/components/search/content/search.xml +++ b/mozilla/browser/components/search/content/search.xml @@ -45,6 +45,8 @@ %searchBarDTD; %globalDTD; + +%browserDTD; ]> - + +