Bug 237249. Accessible Name, role and value of URL bar and search field broken. r=pkwarren on accessibility module, r=mconnor for toolkit changes, r+sr=Neil for xpfe changes, sr=bryner for accessibility module changes, a=dveditz

This commit is contained in:
aaronleventhal%moonset.net 2005-02-11 13:17:18 +00:00
Родитель f0dacfb551
Коммит 60203664ea
5 изменённых файлов: 33 добавлений и 221 удалений

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

@ -78,6 +78,7 @@ ACCESSIBILITY_ATOM(optgroup, "optgroup")
ACCESSIBILITY_ATOM(option, "option")
ACCESSIBILITY_ATOM(q, "q")
ACCESSIBILITY_ATOM(select, "select")
ACCESSIBILITY_ATOM(toolbaritem, "toolbaritem")
ACCESSIBILITY_ATOM(ul, "ul")
// Alphabetical list of attributes
@ -89,6 +90,7 @@ ACCESSIBILITY_ATOM(id, "id")
ACCESSIBILITY_ATOM(name, "name")
ACCESSIBILITY_ATOM(tabindex, "tabindex")
ACCESSIBILITY_ATOM(title, "title")
ACCESSIBILITY_ATOM(tooltiptext, "tooltiptext")
// DHTML accessibility attributes
ACCESSIBILITY_ATOM(valuenow, "valuenow") // For DHTML widget values

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

@ -973,13 +973,8 @@ nsresult nsAccessible::AppendStringWithSpaces(nsAString *aFlatString, const nsAS
nsresult nsAccessible::AppendFlatStringFromContentNode(nsIContent *aContent, nsAString *aFlatString)
{
nsAutoString textEquivalent;
nsCOMPtr<nsIDOMXULElement> xulElement(do_QueryInterface(aContent));
if (xulElement) {
nsCOMPtr<nsIDOMElement> elt(do_QueryInterface(aContent));
NS_ASSERTION(elt, "No DOM element for content node!");
elt->GetAttribute(NS_LITERAL_STRING("value"), textEquivalent); // Prefer value over tooltiptext
if (textEquivalent.IsEmpty())
elt->GetAttribute(NS_LITERAL_STRING("tooltiptext"), textEquivalent);
if (aContent->IsContentOfType(nsIContent::eXUL)) {
aContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::tooltiptext, textEquivalent);
textEquivalent.CompressWhitespace();
return AppendStringWithSpaces(aFlatString, textEquivalent);
}
@ -1298,14 +1293,28 @@ nsresult nsAccessible::GetXULName(nsAString& aLabel, PRBool aCanAggregateSubtree
return NS_OK;
}
if (!aCanAggregateSubtree) {
// Don't use AppendFlatStringFromSubtree for container widgets like menulist
// Still try the title as as fallback method in that case.
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::title, aLabel);
content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::tooltiptext, label);
label.CompressWhitespace();
if (!label.IsEmpty()) {
aLabel = label;
return NS_OK;
}
return AppendFlatStringFromSubtree(content, &aLabel);
// Can get text from title of <toolbaritem> if we're a child of a <toolbaritem>
nsIContent *bindingParent = content->GetBindingParent();
nsIContent *parent = bindingParent? bindingParent->GetParent() :
content->GetParent();
if (parent && parent->Tag() == nsAccessibilityAtoms::toolbaritem &&
NS_CONTENT_ATTR_HAS_VALUE == parent->GetAttr(kNameSpaceID_None,
nsAccessibilityAtoms::title,
label)) {
label.CompressWhitespace();
aLabel = label;
return NS_OK;
}
// Don't use AppendFlatStringFromSubtree for container widgets like menulist
return aCanAggregateSubtree? AppendFlatStringFromSubtree(content, &aLabel) : NS_OK;
}
NS_IMETHODIMP nsAccessible::FireToolkitEvent(PRUint32 aEvent, nsIAccessible *aTarget, void * aData)
@ -1346,6 +1355,7 @@ nsRoleMapEntry nsAccessible::gWAIRoleMap[] =
{"secret-text", ROLE_PASSWORD_TEXT, eTitleOnly, STATE_PROTECTED, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}}, // XXX Use ext state STATE_SINGLE_LINE
{"select", ROLE_LIST, eTitleOnly, 0, {"readonly", 0, STATE_READONLY}, {"multiselect", 0, STATE_EXTSELECTABLE | STATE_MULTISELECTABLE}, {0, 0, 0}},
{"slider", ROLE_SLIDER, eTitleOnly, 0, {"readonly", 0, STATE_READONLY}, {0, 0, 0}, {0, 0, 0}},
{"spreadsheet", ROLE_TABLE, eTitleOnly, STATE_MULTISELECTABLE | STATE_EXTSELECTABLE | STATE_FOCUSABLE, {"readonly", 0, STATE_READONLY}, {0, 0, 0}, {0, 0, 0}},
{"submit", ROLE_PUSHBUTTON, eAggregateSubtree, STATE_DEFAULT, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}},
{"textarea", ROLE_TEXT, eTitleOnly, 0, {"readonly", 0, STATE_READONLY}, {0, 0, 0}, {0, 0, 0}}, // XXX Use ext state STATE_MULTI_LINE
{"textfield", ROLE_TEXT, eTitleOnly, 0, {"readonly", 0, STATE_READONLY}, {0, 0, 0}, {0, 0, 0}}, // XXX Use ext state STATE_SINGLE_LINE

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

@ -84,9 +84,6 @@
</field>
<constructor><![CDATA[
// set default property values
this.ifSetAttribute("disablehistory", true);
mController = Components.classes["@mozilla.org/autocomplete/controller;1"].
createInstance(Components.interfaces.nsIAutoCompleteController);
]]></constructor>
@ -96,9 +93,13 @@
<property name="accessible">
<getter>
<![CDATA[
// enablehistory="true": dropmarker shows up, so expose as a combobox.
// enablehistory="false" (default): no dropmarker, so expose as a textfield.
var accService = Components.classes["@mozilla.org/accessibilityService;1"].
getService(Components.interfaces.nsIAccessibilityService);
return accService.createXULComboboxAccessible(this);
return (this.getAttribute("enablehistory") == 'true') ?
accService.createXULComboboxAccessible(this) :
accService.createXULTextBoxAccessible(this);
]]>
</getter>
</property>
@ -219,9 +220,7 @@
onset="this.setAttribute('crop',val); return val;"
onget="return this.getAttribute('crop');"/>
<property name="label"
onset="this.setAttribute('label',val); return val;"
onget="return this.getAttribute('label');"/>
<property name="label" readonly="true" onget="return this.mInputElt.value;"/>
<property name="open"
onget="return this.getAttribute('open') == 'true';">

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

@ -177,6 +177,9 @@
<hbox id="nav-bar-inner" flex="1">
<observes element="nav-bar" attribute="buttonstyle"/>
<!-- Need hidden label on textbox for accessibility, because what
receives focus needs a text name -->
<label control="urlbar" hidden="true" value="&locationBar.title;"/>
<textbox id="urlbar" class="chromeclass-location uri-element" flex="1"
type="autocomplete" searchSessions="history"
timeout="50" maxrows="6" alwaysopenpopup="true"

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

@ -1,202 +0,0 @@
<!-- extracted from content/navigator.xul -->
<!-- LOCALIZATION NOTE : FILE This file contains the browser main menu items -->
<!-- LOCALIZATION NOTE : FILE Do not translate accesskey and commandkey -->
<!-- LOCALIZATION NOTE (mainWindow.title): DONT_TRANSLATE -->
<!ENTITY mainWindow.title "&brandShortName; {&buildId.label;}">
<!-- LOCALIZATION NOTE (mainWindow.titlemodifier) : DONT_TRANSLATE -->
<!ENTITY mainWindow.titlemodifier "&brandShortName; {&buildId.label;}">
<!-- LOCALIZATION NOTE (mainWindow.titlemodifiermenuseparator): DONT_TRANSLATE -->
<!ENTITY mainWindow.titlemodifiermenuseparator " - ">
<!ENTITY nothingAvailable.label "(Nothing Available)">
<!ENTITY browserCmd.label "New Navigator Window">
<!ENTITY browserCmd.accesskey "N">
<!ENTITY tabCmd.label "Navigator Tab">
<!ENTITY tabCmd.accesskey "T">
<!ENTITY tabCmd.commandkey "t">
<!ENTITY openCmd.label "Open Web Location...">
<!ENTITY openCmd.accesskey "l">
<!ENTITY openCmd.commandkey "l">
<!ENTITY openFileCmd.label "Open File...">
<!ENTITY openFileCmd.accesskey "o">
<!ENTITY openFileCmd.commandkey "o">
<!ENTITY editPageCmd.label "Edit Page">
<!ENTITY editPageCmd.accesskey "E">
<!ENTITY editPageCmd.commandkey "e">
<!ENTITY editFrameCmd.label "Edit Frame">
<!ENTITY editFrameCmd.accesskey "m">
<!ENTITY editFrameSetCmd.label "Edit Frameset">
<!ENTITY editFrameSetCmd.accesskey "t">
<!ENTITY uploadFile.label "Upload File...">
<!ENTITY uploadFile.accesskey "F">
<!ENTITY printSetupCmd.label "Page Setup...">
<!ENTITY printSetupCmd.accesskey "u">
<!ENTITY printPreviewCmd.label "Print Preview">
<!ENTITY printPreviewCmd.accesskey "v">
<!ENTITY printCmd.label "Print...">
<!ENTITY printCmd.accesskey "p">
<!ENTITY printCmd.commandkey "p">
<!ENTITY viewMenu.label "View">
<!ENTITY viewMenu.accesskey "v">
<!ENTITY toolbarsCmd.label "Show/Hide">
<!ENTITY toolbarsCmd.accesskey "w">
<!ENTITY navbarCmd.label "Navigation Toolbar">
<!ENTITY navbarCmd.accesskey "N">
<!ENTITY personalbarCmd.label "Personal Toolbar">
<!ENTITY personalbarCmd.accesskey "p">
<!ENTITY tabbarCmd.label "Tab Bar">
<!ENTITY tabbarCmd.accesskey "T">
<!ENTITY taskbarCmd.label "Status Bar">
<!ENTITY taskbarCmd.accesskey "S">
<!ENTITY componentbarCmd.label "Component Bar">
<!ENTITY componentbarCmd.accesskey "C">
<!ENTITY useStyleSheetMenu.label "Use Style">
<!ENTITY useStyleSheetMenu.accesskey "u">
<!ENTITY useStyleSheetNone.label "None">
<!ENTITY useStyleSheetNone.accesskey "N">
<!ENTITY useStyleSheetPersistentOnly.label "Default Style">
<!ENTITY useStyleSheetPersistentOnly.accesskey "d">
<!ENTITY pageSourceCmd.label "Page Source">
<!ENTITY pageSourceCmd.accesskey "o">
<!ENTITY pageSourceCmd.commandkey "u">
<!ENTITY pageInfoCmd.label "Page Info">
<!ENTITY pageInfoCmd.accesskey "i">
<!ENTITY pageInfoCmd.commandkey "i">
<!ENTITY fullScreenCmd.label "Full Screen">
<!ENTITY fullScreenCmd.accesskey "f">
<!ENTITY translateMenu.label "Translate Page">
<!ENTITY translateMenu.accesskey "T">
<!ENTITY translate.commandKey "t">
<!ENTITY closeOtherTabs.label "Close Other Tabs">
<!ENTITY closeWindow.label "Close Window">
<!ENTITY minimizeButton.tooltip "Minimize">
<!ENTITY restoreButton.tooltip "Restore">
<!-- I'd like all this to move to an overlay or something -->
<!ENTITY bidiMenu.label "Bidi Options">
<!ENTITY directionBidiMenu.label "Default Direction">
<!ENTITY directionRTLBidiCmd.label "Right to Left">
<!ENTITY directionLTRBidiCmd.label "Left to Right">
<!ENTITY texttypeBidiMenu.label "Text Type">
<!ENTITY charsettexttypeBidiCmd.label "Based on Character Set">
<!ENTITY logicaltexttypeBidiCmd.label "Logical">
<!ENTITY visualtexttypeBidiCmd.label "Visual">
<!ENTITY numeralBidiMenu.label "Numeral Shape">
<!ENTITY regularcontextnumeralBidiCmd.label "Contextual">
<!ENTITY hindicontextnumeralBidiCmd.label "Hindi Numerals on RTL Document Direction">
<!ENTITY arabicnumeralBidiCmd.label "Arabic">
<!ENTITY hindinumeralBidiCmd.label "Hindi">
<!ENTITY controlstextmodeBidiMenu.label "Text Mode in Controls">
<!ENTITY logicalcontrolstextmodeBidiCmd.label "Logical">
<!ENTITY visiualcontrolstextmodeBidiCmd.label "Visual">
<!ENTITY containercontrolstextmodeBidiCmd.label "Like Containing Document">
<!ENTITY charactersetBidiMenu.label "Character set">
<!ENTITY doccharactersetBidiCmd.label "Use the document specified character set">
<!ENTITY defaultcharactersetBidiCmd.label "Use my default character set, overriding the document-specified character set">
<!ENTITY webContentMenu.label "Languages and Web Content">
<!ENTITY webContentMenu.accesskey "l">
<!ENTITY downloadMore.label "Download More">
<!ENTITY downloadMore.accesskey "D">
<!ENTITY applyTheme.label "Apply Theme">
<!ENTITY applyTheme.accesskey "A">
<!ENTITY getNewThemesCmd.label "Get New Themes">
<!ENTITY getNewThemesCmd.accesskey "G">
<!ENTITY searchMenu.label "Search">
<!ENTITY searchMenu.accesskey "S">
<!ENTITY findOnCmd.label "Find in This Page...">
<!ENTITY findOnCmd.accesskey "f">
<!ENTITY findOnCmd.commandkey "f">
<!ENTITY findAgainCmd.label "Find Again">
<!ENTITY findAgainCmd.accesskey "g">
<!ENTITY findAgainCmd.commandkey "g">
<!ENTITY findPrevCmd.label "Find Previous">
<!ENTITY findPrevCmd.accesskey "v">
<!ENTITY findPrevCmd.commandkey "g">
<!ENTITY findAgainCmd.commandkey2 "VK_F3">
<!ENTITY findPrevCmd.commandkey2 "VK_F3">
<!ENTITY searchInternetCmd.label "Search the Web">
<!ENTITY searchInternetCmd.accesskey "S">
<!ENTITY searchInternet.commandKey "s">
<!ENTITY goMenu.label "Go">
<!ENTITY goMenu.accesskey "g">
<!ENTITY goHomeCmd.label "Home">
<!ENTITY goHomeCmd.accesskey "h">
<!ENTITY bookmarksMenu.label "Bookmarks">
<!ENTITY bookmarksMenu.accesskey "B">
<!ENTITY addCurPageCmd.label "Bookmark This Page">
<!ENTITY addCurPageCmd.accesskey "B">
<!ENTITY addCurPageAsCmd.label "File Bookmark...">
<!ENTITY addCurPageAsCmd.accesskey "F">
<!ENTITY addCurPageAsCmd.commandkey "d">
<!ENTITY addCurTabsAsCmd.label "Bookmark This Group of Tabs...">
<!ENTITY addCurTabsAsCmd.accesskey "G">
<!ENTITY manBookmarksCmd.label "Manage Bookmarks...">
<!ENTITY manBookmarksCmd.accesskey "M">
<!ENTITY manBookmarksCmd.commandkey "b">
<!ENTITY emptyItem.label "(Empty)">
<!ENTITY helpMenuCmd.label "Help">
<!ENTITY helpMenuCmd.accesskey "h">
<!ENTITY helpContentsCmd.label "Help Contents">
<!ENTITY softwareUpdatesCmd.label "Software Updates">
<!ENTITY technicalSupportCmd.label "Technical Support">
<!ENTITY releaseNotesCmd.label "Release Notes">
<!ENTITY menuBar.tooltip "Menu Bar">
<!ENTITY personalToolbar.tooltip "Personal Toolbar">
<!ENTITY navigationToolbar.tooltip "Navigation Toolbar">
<!-- Toolbar items -->
<!ENTITY backButton.label "Back">
<!ENTITY backButton.tooltip "Go back one page">
<!ENTITY forwardButton.label "Forward">
<!ENTITY forwardButton.tooltip "Go forward one page">
<!ENTITY reloadButton.label "Reload">
<!ENTITY reloadButton.tooltip "Reload current page">
<!ENTITY stopButton.label "Stop">
<!ENTITY stopButton.tooltip "Stop loading this page">
<!ENTITY searchButton.label "Search">
<!ENTITY searchButton.tooltip "Type a word in the field to the left, then click Search">
<!ENTITY goButton.label "Go">
<!ENTITY goButton.tooltip "Type a location in the field to the left, then click Go">
<!ENTITY printButton.label "Print">
<!ENTITY printButton.tooltip "Print this page">
<!ENTITY throbber.tooltip "Go to the &vendorShortName; home page">
<!ENTITY locationBar.tooltip "Enter search term, keyword, or web address">
<!ENTITY locationBar.accesskey "d">
<!ENTITY proxyIcon.tooltip "Drag and drop this icon to create a link to this page">
<!ENTITY internetKeyword.tooltip "Return to previously viewed page or choose keyword">
<!-- Toolbar items -->
<!ENTITY bookmarksButton.label "Bookmarks">
<!ENTITY bookmarksButton.tooltip "Bookmarks list">
<!ENTITY homeButton.label "Home">
<!-- Statusbar -->
<!ENTITY statusText.label "Done">
<!ENTITY historyCmd.label "History">
<!ENTITY historyCmd.accesskey "i">
<!ENTITY history.commandKey "h">
<!ENTITY popupIcon.tooltiptext "Unblock this site's popups">
<!ENTITY bidiSwitchPageDirectionItem.label "Switch Page Direction">
<!ENTITY bidiSwitchPageDirectionItem.accesskey "g">