Bug 384229. No accessible name for location and search fields. r=ginn.chen, r=mano

This commit is contained in:
aaronleventhal@moonset.net 2007-06-14 18:50:37 -07:00
Родитель f4030a0ebc
Коммит a2995a4280
3 изменённых файлов: 27 добавлений и 1 удалений

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

@ -401,6 +401,26 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible::GetRole(PRUint32 *aRole)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetName(nsAString& aName)
{
nsCOMPtr<nsIContent> 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<nsIAccessible> parent;
rv = GetParent(getter_AddRefs(parent));
return parent ? parent->GetName(aName) : rv;
}
NS_IMETHODIMP nsHTMLTextFieldAccessible::GetValue(nsAString& _retval) NS_IMETHODIMP nsHTMLTextFieldAccessible::GetValue(nsAString& _retval)
{ {
PRUint32 state; PRUint32 state;

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

@ -109,6 +109,7 @@ public:
NS_IMETHOD Init(); NS_IMETHOD Init();
NS_IMETHOD Shutdown(); NS_IMETHOD Shutdown();
NS_IMETHOD GetRole(PRUint32 *_retval); NS_IMETHOD GetRole(PRUint32 *_retval);
NS_IMETHOD GetName(nsAString& aName);
NS_IMETHOD GetValue(nsAString& _retval); NS_IMETHOD GetValue(nsAString& _retval);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState); NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetNumActions(PRUint8 *_retval); NS_IMETHOD GetNumActions(PRUint8 *_retval);

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

@ -45,6 +45,8 @@
%searchBarDTD; %searchBarDTD;
<!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd"> <!ENTITY % globalDTD SYSTEM "chrome://global/locale/global.dtd">
%globalDTD; %globalDTD;
<!ENTITY % browserDTD SYSTEM "chrome://browser/locale/browser.dtd">
%browserDTD;
]> ]>
<bindings id="SearchBindings" <bindings id="SearchBindings"
@ -548,7 +550,7 @@
<binding id="searchbar-textbox" <binding id="searchbar-textbox"
extends="chrome://global/content/bindings/autocomplete.xml#autocomplete"> extends="chrome://global/content/bindings/autocomplete.xml#autocomplete">
<implementation implements="nsIObserver"> <implementation implements="nsIObserver nsIDOMXULLabeledControlElement">
<constructor><![CDATA[ <constructor><![CDATA[
if (this._getParentSearchbar().parentNode.parentNode.localName == if (this._getParentSearchbar().parentNode.parentNode.localName ==
"toolbarpaletteitem") "toolbarpaletteitem")
@ -568,6 +570,9 @@
} catch (ex) { } } catch (ex) { }
]]></destructor> ]]></destructor>
<property name="label" readonly="true"
onget="return '&searchItem.title; ' +
this._getParentSearchbar().currentEngine.name;"/>
<field name="_stringBundle"/> <field name="_stringBundle"/>
<field name="_formHistSvc"/> <field name="_formHistSvc"/>
<field name="_prefBranch"/> <field name="_prefBranch"/>