Bug 246062. No accessible name for trees and listboxes. r=neil, sr=jst

This commit is contained in:
aaronleventhal%moonset.net 2004-06-23 14:07:49 +00:00
Родитель c91c66aa08
Коммит 58253cb880
11 изменённых файлов: 53 добавлений и 205 удалений

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

@ -68,3 +68,5 @@ ACCESSIBILITY_ATOM(optgroup, "optgroup")
ACCESSIBILITY_ATOM(option, "option")
ACCESSIBILITY_ATOM(ul, "ul")
// Alphabetical list of attributes
ACCESSIBILITY_ATOM(id, "id")

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

@ -1258,6 +1258,9 @@ NS_IMETHODIMP nsAccessible::GetXULName(nsAString& _retval)
nsresult rv = NS_OK;
nsAutoString label;
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
NS_ASSERTION(content, "No content for accessible DOM node!");
// CASE #1 -- great majority of the cases
nsCOMPtr<nsIDOMXULLabeledControlElement> labeledEl(do_QueryInterface(mDOMNode));
if (labeledEl) {
@ -1310,34 +1313,50 @@ NS_IMETHODIMP nsAccessible::GetXULName(nsAString& _retval)
// This should keep search times down and still get the relevant
// labels.
nsAutoString controlID;
domElement->GetAttribute(NS_LITERAL_STRING("id"), controlID);
nsCOMPtr<nsIDOMNode> parent;
if (!controlID.IsEmpty() && NS_SUCCEEDED(rv = mDOMNode->GetParentNode(getter_AddRefs(parent)))) {
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(parent));
NS_ASSERTION(xulElement, "No xulElement for parent DOM Node!");
if (xulElement) {
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::id, controlID);
nsIContent *labelSearchStart = nsnull;
if (controlID.IsEmpty()) {
// If no control ID and we're anonymous content
// get ID from parent that inserted us.
nsIContent *bindingParent = content->GetBindingParent();
if (bindingParent) {
bindingParent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::id, controlID);
if (!controlID.IsEmpty()) {
labelSearchStart = bindingParent->GetParent();
}
}
}
else {
// We have an id
labelSearchStart = content->GetParent();
}
static const PRUint32 kAncestorLevelsToSearch = 3;
for (PRUint32 level = 0; level < kAncestorLevelsToSearch; level ++) {
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(labelSearchStart));
if (!xulElement) {
break;
}
nsCOMPtr<nsIDOMNodeList> labelList;
if (NS_SUCCEEDED(rv = xulElement->GetElementsByAttribute(NS_LITERAL_STRING("control"), controlID, getter_AddRefs(labelList))))
{
PRUint32 length = 0;
if (NS_SUCCEEDED(rv = labelList->GetLength(&length)) && length > 0) {
for (PRUint32 index = 0; index < length; ++index) {
xulElement->GetElementsByAttribute(NS_LITERAL_STRING("control"), controlID,
getter_AddRefs(labelList));
if (!labelList) {
break;
}
PRUint32 index = 0;
nsCOMPtr<nsIDOMNode> child;
if (NS_SUCCEEDED(rv = labelList->Item(index, getter_AddRefs(child) ))) {
rv = AppendLabelText(child, label);
}
}
}
while (NS_SUCCEEDED(labelList->Item(index++, getter_AddRefs(child))) && child) {
AppendLabelText(child, label);
}
if (!label.IsEmpty()) {
break;
}
labelSearchStart = labelSearchStart->GetParent();
} // End of CASE #3
} // END of CASE #2
} // END of CASE #1
label.CompressWhitespace();
if (label.IsEmpty()) {
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
NS_ASSERTION(content, "No nsIContent for DOM node");
return GetNameFromSubtree(content, &_retval);
}

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

@ -192,7 +192,7 @@
<description>&languageIntro.label;</description>
<separator class="thin"/>
<description>&installedLanguagePacks.label;</description>
<label control="languagePackList">&installedLanguagePacks.label;</label>
<listbox id="languagePackList" flex="1" rows="3"
ref="urn:mozilla:locale:root"
datasources="rdf:chrome"
@ -244,7 +244,7 @@
<separator class="thin"/>
<description>&contentIntro.label;</description>
<description>&installedContentPacks.label;</description>
<label control="contentPackList">&installedContentPacks.label;</label>
<listbox id="contentPackList" flex="1" rows="3"
ref="urn:mozilla:locale:root" datasources="rdf:chrome"
sortResource="http://www.mozilla.org/rdf/chrome#name"

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

@ -109,7 +109,7 @@
<separator id="destinationSeparator"/>
<vbox id="folderbox" flex="1">
<label id="destinationLabel" value="&destination.label;"/>
<label id="destinationLabel" value="&destination.label;" control="bookmarks-view"/>
<bookmarks-tree id="bookmarks-view" flex="1" type="folders"
rows="10" seltype="single"
persist="width height"/>

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

@ -59,8 +59,8 @@
<groupbox flex="1">
<caption label="&descript;"/>
<label value="&fileTypes.label;"/>
<vbox flex="1">
<label value="&fileTypes.label;" control="appList"/>
<hbox flex="1">
<tree id="appList" flex="1" seltype="single" hidecolumnpicker="true"
datasources="rdf:null" ref="urn:mimetypes"

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

@ -61,7 +61,7 @@
<!-- The two-pane -->
<hbox flex="1">
<vbox flex="1">
<label value="&charset.customize.additional.label;"/>
<label value="&charset.customize.additional.label;" control="available_charsets"/>
<!-- Available Charsets Tree -->
<listbox id="available_charsets" flex="1" seltype="multiple"
onselect="SelectAvailableCharset();"
@ -78,7 +78,7 @@
<separator orient="vertical"/>
<vbox flex="1">
<label value="&charset.customize.current.label;"/>
<label value="&charset.customize.current.label;" control="active_charsets"/>
<listbox id="active_charsets" flex="1" seltype="multiple"
onselect="SelectActiveCharset();"
ondblclick="RemoveActiveCharset();"/>

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

@ -1,114 +0,0 @@
<?xml version="1.0"?> <!-- -*- Mode: SGML; indent-tabs-mode: nil; -*- -->
<!--
***** BEGIN LICENSE BLOCK *****
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is mozilla.org Code.
The Initial Developer of the Original Code is
Netscape Communications Corporation.
Portions created by the Initial Developer are Copyright (C) 1999
the Initial Developer. All Rights Reserved.
Contributor(s):
Alternatively, the contents of this file may be used under the terms of
either of the GNU General Public License Version 2 or later (the "GPL"),
or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<!DOCTYPE page SYSTEM "chrome://communicator/locale/pref/pref-languages.dtd" >
<page xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="Init();"
headertitle="&languages.customize.lHeader;">
<script type="application/x-javascript" src="chrome://communicator/content/pref/pref-languages.js"/>
<!-- XXX: Replace strres.js when pref-languages.js is converted -->
<script type="application/x-javascript" src="chrome://global/content/strres.js"/>
<script type="application/x-javascript">
<![CDATA[
var _elementIDs = ["active_languages", "DefaultCharsetList"];
var observerService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
observerService.notifyObservers(null, "charsetmenu-selected", "other");
]]>
</script>
<broadcaster id="intlAcceptLanguages"
value=""
preftype="localizedstring"
prefattribute="value"
prefstring="intl.accept_languages"/>
<groupbox flex="1">
<caption label="&langtitle.label;"/>
<description>&languages.customize.prefLangDescript;</description>
<description>&languages.customize.active.label;</description>
<hbox flex="1">
<listbox id="active_languages" flex="1" style="width: 0px; height: 0px;"
preftype="localizedstring" prefstring="intl.accept_languages" prefvalue="" prefattribute="prefvalue" wsm_attributes="prefvalue"
seltype="multiple" onselect="SelectLanguage();"/>
<vbox>
<button oncommand="MoveUp();" id="up" class="up" disabled="true"
label="&languages.customize.moveUp.label;"
accesskey="&languages.customize.moveUp.accesskey;"
prefstring="pref.browser.language.disable_button.up"/>
<button oncommand="MoveDown();" id="down" class="down" disabled="true"
label="&languages.customize.moveDown.label;"
accesskey="&languages.customize.moveDown.accesskey;"
prefstring="pref.browser.language.disable_button.down"/>
<spacer flex="1"/>
<button id="add"
label="&languages.customize.addButton.label;"
accesskey="&languages.customize.addButton.accesskey;"
oncommand="AddLanguage();"
prefstring="pref.browser.language.disable_button.add"/>
<button id="remove" disabled="true"
label="&languages.customize.deleteButton.label;"
accesskey="&languages.customize.deleteButton.accesskey;"
oncommand="RemoveActiveLanguage();"
prefstring="pref.browser.language.disable_button.remove"/>
</vbox>
</hbox>
</groupbox>
<groupbox align="start">
<caption label="&languages.customize.Charset.grouplabel;"/>
<hbox align="center">
<label value="&languages.customize.DefaultCharset.label;" accesskey="&languages.customize.DefaultCharset.accesskey;" control="DefaultCharsetList"/>
<menulist id="DefaultCharsetList" ref="NC:DecodersRoot" datasources="rdf:charset-menu"
prefstring="intl.charset.default" preftype="localizedstring"
wsm_attributes="value">
<template>
<menupopup>
<menuitem label="rdf:http://home.netscape.com/NC-rdf#Name" value="..." uri="..."/>
</menupopup>
</template>
</menulist>
</hbox>
</groupbox>
</page>

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

@ -66,7 +66,7 @@
<separator/>
<label id="allowScripts" value="&allowScripts.label;"/>
<label id="allowScripts" control="AllowList" value="&allowScripts.label;"/>
<listbox id="AllowList" flex="1">
<listitem type="checkbox" id="allowWindowMoveResize" label="&allowWindowMoveResize.label;"

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

@ -62,7 +62,7 @@
<description>&skinIntro.label;</description>
<description>&installedThemes.label;</description>
<label control="skinsList">&installedThemes.label;</label>
<listbox id="skinsList" datasources="rdf:chrome"
onselect="themeSelect();"

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

@ -56,8 +56,8 @@
<script type="application/x-javascript" src="chrome://communicator/content/pref/pref-winhooks.js"/>
<!-- File types -->
<label value="&files.text;"/>
<listbox class="indent" style="width: 0px; height: 0px;" flex="2">
<label class="indent" value="&files.text;" control="fileTypes"/>
<listbox class="indent" id="fileTypes" style="width: 0px; height: 0px;" flex="2">
<listitem type="checkbox" id="isHandlingHTML" label="&html.label;"/>
<listitem type="checkbox" id="isHandlingJPEG" label="&jpeg.label;"/>
<listitem type="checkbox" id="isHandlingGIF" label="&gif.label;"/>
@ -74,8 +74,8 @@
<separator/>
<!-- Internet Shortcuts -->
<label value="&shortcuts.text;"/>
<listbox class="indent" style="width: 0px; height: 0px;" flex="2">
<label class="indent" control="protocols" value="&shortcuts.text;"/>
<listbox class="indent" id="protocols" tyle="width: 0px; height: 0px;" flex="2">
<listitem type="checkbox" id="isHandlingHTTP" label="&http.label;"/>
<listitem type="checkbox" id="isHandlingHTTPS" label="&https.label;"/>
<listitem type="checkbox" id="isHandlingFTP" label="&ftp.label;"/>

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

@ -1,59 +0,0 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<?xul-overlay href="chrome://communicator/content/pref/preftree.xul"?>
<!DOCTYPE dialog [
<!ENTITY % dtd1 SYSTEM "chrome://communicator/locale/pref/pref.dtd" > %dtd1;
<!ENTITY % dtd2 SYSTEM "chrome://communicator-platform/locale/pref/platformPrefOverlay.dtd" > %dtd2;
]>
<!-- This dialog has a fixed size and is not resizable.
You MAY NOT increase the size of this dialog.
Questions, Comments -> ben@netscape.com -->
<dialog id="prefDialog"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&prefWindow.title;"
style="&prefWindow.size;"
windowtype="mozilla:preferences"
buttons="accept,cancel,help"
onload="onLoad();"
ondialogaccept="return hPrefWindow.onAccept();"
ondialogcancel="return hPrefWindow.onCancel();"
ondialoghelp="doHelpButton();"
persist="screenX screenY">
<stringbundle id="bundle_prefutilities"
src="chrome://communicator/locale/pref/prefutilities.properties"/>
<script type="application/x-javascript" src="chrome://global/content/nsWidgetStateManager.js"/>
<script type="application/x-javascript" src="chrome://communicator/content/pref/nsPrefWindow.js"/>
<script type="application/x-javascript" src="chrome://communicator/content/pref/pref-help.js"/>
<script type="application/x-javascript" src="chrome://help/content/contextHelp.js"/>
<hbox flex="1">
<vbox>
<label value="&categoryHeader;"/>
<!-- tree sidebar -->
<tree id="prefsTree" style="width: 13em;" flex="1"/>
</vbox>
<vbox flex="1">
<dialogheader id="header"/>
<iframe id="panelFrame" name="panelFrame" style="width: 0px" flex="1"/>
</vbox>
</hbox>
<script type="application/x-javascript">
<![CDATA[
if(window.arguments && window.arguments[0]) {
document.getElementById("panelFrame").setAttribute("src", window.arguments[0] );
document.getElementById("panelFrame").setAttribute("tag", window.arguments[0] );
}
else {
document.getElementById("panelFrame").setAttribute("src", "chrome://communicator/content/pref/pref-navigator.xul" );
document.getElementById("panelFrame").setAttribute("tag", "chrome://communicator/content/pref/pref-navigator.xul" );
}
]]>
</script>
</dialog>