Backing out bug 407359 because of orange

This commit is contained in:
aaronleventhal%moonset.net 2008-01-22 22:26:59 +00:00
Родитель b338518753
Коммит c7bc4e44de
24 изменённых файлов: 111 добавлений и 260 удалений

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

@ -52,12 +52,6 @@ interface nsIAccessibleProvider : nsISupports
* Constants set of common use. * Constants set of common use.
*/ */
/** Do not create an accessible for this object
* This is useful if an ancestor binding already implements nsIAccessibleProvider,
* but no accessible is desired for the inheriting binding
*/
const long NoAccessible = 0;
/** For elements that spawn a new document. For example now it is used by /** For elements that spawn a new document. For example now it is used by
<xul:iframe>, <xul:browser> and <xul:editor>. */ <xul:iframe>, <xul:browser> and <xul:editor>. */
const long OuterDoc = 0x00000001; const long OuterDoc = 0x00000001;
@ -84,33 +78,32 @@ interface nsIAccessibleProvider : nsISupports
const long XULMenuitem = 0x0000100E; const long XULMenuitem = 0x0000100E;
const long XULMenupopup = 0x0000100F; const long XULMenupopup = 0x0000100F;
const long XULMenuSeparator = 0x00001010; const long XULMenuSeparator = 0x00001010;
const long XULPane = 0x00001011; const long XULProgressMeter = 0x00001011;
const long XULProgressMeter = 0x00001012; const long XULScale = 0x00001012;
const long XULScale = 0x00001013; const long XULStatusBar = 0x00001013;
const long XULStatusBar = 0x00001014; const long XULRadioButton = 0x00001014;
const long XULRadioButton = 0x00001015; const long XULRadioGroup = 0x00001015;
const long XULRadioGroup = 0x00001016;
/** The single tab in a dialog or tabbrowser/editor interface */ /** The single tab in a dialog or tabbrowser/editor interface */
const long XULTab = 0x00001017; const long XULTab = 0x00001016;
/** A combination of a tabs object and a tabpanels object */ /** A combination of a tabs object and a tabpanels object */
const long XULTabBox = 0x00001018; const long XULTabBox = 0x00001017;
/** The collection of tab objects, useable in the TabBox and independant of /** The collection of tab objects, useable in the TabBox and independant of
as well */ as well */
const long XULTabs = 0x00001019; const long XULTabs = 0x00001018;
const long XULText = 0x0000101A; const long XULText = 0x00001019;
const long XULTextBox = 0x0000101B; const long XULTextBox = 0x0000101A;
const long XULThumb = 0x0000101C; const long XULThumb = 0x0000101B;
const long XULTree = 0x0000101D; const long XULTree = 0x0000101C;
const long XULTreeColumns = 0x0000101E; const long XULTreeColumns = 0x0000101D;
const long XULTreeColumnItem = 0x0000101F; const long XULTreeColumnItem = 0x0000101E;
const long XULToolbar = 0x00001020; const long XULToolbar = 0x0000101F;
const long XULToolbarSeparator = 0x00001021; const long XULToolbarSeparator = 0x00001020;
const long XULTooltip = 0x00001022; const long XULTooltip = 0x00001021;
const long XULToolbarButton = 0x00001023; const long XULToolbarButton = 0x00001022;
/** /**

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

@ -110,9 +110,9 @@ interface nsIAccessibleRole : nsISupports
const unsigned long ROLE_WINDOW = 9; const unsigned long ROLE_WINDOW = 9;
/** /**
* A sub-document (<frame> or <iframe>) * XXX: document this.
*/ */
const unsigned long ROLE_INTERNAL_FRAME = 10; const unsigned long ROLE_CLIENT = 10;
/** /**
* Represents a menu, which presents a list of options from which the user can * Represents a menu, which presents a list of options from which the user can

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

@ -56,7 +56,7 @@ static const PRUint32 atkRoleMap[] = {
ATK_ROLE_UNKNOWN, // nsIAccessibleRole::ROLE_CARET 7 ATK_ROLE_UNKNOWN, // nsIAccessibleRole::ROLE_CARET 7
ATK_ROLE_ALERT, // nsIAccessibleRole::ROLE_ALERT 8 ATK_ROLE_ALERT, // nsIAccessibleRole::ROLE_ALERT 8
ATK_ROLE_WINDOW, // nsIAccessibleRole::ROLE_WINDOW 9 ATK_ROLE_WINDOW, // nsIAccessibleRole::ROLE_WINDOW 9
ATK_ROLE_INTERNAL_FRAME, // nsIAccessibleRole::ROLE_INTERNAL_FRAME 10 ATK_ROLE_PANEL, // nsIAccessibleRole::ROLE_CLIENT 10
ATK_ROLE_MENU, // nsIAccessibleRole::ROLE_MENUPOPUP 11 ATK_ROLE_MENU, // nsIAccessibleRole::ROLE_MENUPOPUP 11
ATK_ROLE_MENU_ITEM, // nsIAccessibleRole::ROLE_MENUITEM 12 ATK_ROLE_MENU_ITEM, // nsIAccessibleRole::ROLE_MENUITEM 12
ATK_ROLE_TOOL_TIP, // nsIAccessibleRole::ROLE_TOOLTIP 13 ATK_ROLE_TOOL_TIP, // nsIAccessibleRole::ROLE_TOOLTIP 13

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

@ -1630,8 +1630,6 @@ nsresult nsAccessibilityService::GetAccessibleByType(nsIDOMNode *aNode,
switch (type) switch (type)
{ {
#ifdef MOZ_XUL #ifdef MOZ_XUL
case nsIAccessibleProvider::NoAccessible:
return NS_OK;
// XUL controls // XUL controls
case nsIAccessibleProvider::XULAlert: case nsIAccessibleProvider::XULAlert:
*aAccessible = new nsXULAlertAccessible(aNode, weakShell); *aAccessible = new nsXULAlertAccessible(aNode, weakShell);
@ -1716,9 +1714,6 @@ nsresult nsAccessibilityService::GetAccessibleByType(nsIDOMNode *aNode,
case nsIAccessibleProvider::XULMenuSeparator: case nsIAccessibleProvider::XULMenuSeparator:
*aAccessible = new nsXULMenuSeparatorAccessible(aNode, weakShell); *aAccessible = new nsXULMenuSeparatorAccessible(aNode, weakShell);
break; break;
case nsIAccessibleProvider::XULPane:
*aAccessible = new nsEnumRoleAccessible(aNode, weakShell, nsIAccessibleRole::ROLE_PANE);
break;
case nsIAccessibleProvider::XULProgressMeter: case nsIAccessibleProvider::XULProgressMeter:
*aAccessible = new nsXULProgressMeterAccessible(aNode, weakShell); *aAccessible = new nsXULProgressMeterAccessible(aNode, weakShell);
break; break;

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

@ -152,7 +152,7 @@ static const char kRoleNames[][20] = {
"caret", //ROLE_CARET "caret", //ROLE_CARET
"alert", //ROLE_ALERT "alert", //ROLE_ALERT
"window", //ROLE_WINDOW "window", //ROLE_WINDOW
"internal frame", //ROLE_INTERNAL_FRAME "client", //ROLE_CLIENT
"menupopup", //ROLE_MENUPOPUP "menupopup", //ROLE_MENUPOPUP
"menuitem", //ROLE_MENUITEM "menuitem", //ROLE_MENUITEM
"tooltip", //ROLE_TOOLTIP "tooltip", //ROLE_TOOLTIP

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

@ -171,7 +171,7 @@ NS_IMETHODIMP nsCaretAccessible::NotifySelectionChanged(nsIDOMDocument *aDoc, ns
nsIPresShell *presShell = doc->GetPrimaryShell(); nsIPresShell *presShell = doc->GetPrimaryShell();
NS_ENSURE_TRUE(presShell, NS_OK); NS_ENSURE_TRUE(presShell, NS_OK);
// Get first nsIAccessibleText in parent chain and fire caret-move, selection-change event for it // Get first nnsIAccessibleText in parent chain and fire caret-move, selection-change event for it
nsCOMPtr<nsIAccessible> accessible; nsCOMPtr<nsIAccessible> accessible;
nsIAccessibilityService *accService = mRootAccessible->GetAccService(); nsIAccessibilityService *accService = mRootAccessible->GetAccService();
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE); NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);

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

@ -74,7 +74,7 @@ NS_IMETHODIMP nsOuterDocAccessible::GetName(nsAString& aName)
/* unsigned long getRole (); */ /* unsigned long getRole (); */
NS_IMETHODIMP nsOuterDocAccessible::GetRole(PRUint32 *aRole) NS_IMETHODIMP nsOuterDocAccessible::GetRole(PRUint32 *aRole)
{ {
*aRole = nsIAccessibleRole::ROLE_INTERNAL_FRAME; *aRole = nsIAccessibleRole::ROLE_CLIENT;
return NS_OK; return NS_OK;
} }

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

@ -597,9 +597,6 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
aEvent->GetType(eventType); aEvent->GetType(eventType);
nsAutoString localName; nsAutoString localName;
aTargetNode->GetLocalName(localName); aTargetNode->GetLocalName(localName);
#ifdef MOZ_XUL
PRBool isTree = localName.EqualsLiteral("tree");
#endif
#ifdef DEBUG_A11Y #ifdef DEBUG_A11Y
// Very useful for debugging, please leave this here. // Very useful for debugging, please leave this here.
if (eventType.EqualsLiteral("AlertActive")) { if (eventType.EqualsLiteral("AlertActive")) {
@ -645,9 +642,8 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
return NS_OK; return NS_OK;
} }
#ifdef MOZ_XUL
if (eventType.EqualsLiteral("TreeViewChanged")) { // Always asynch, always from user input if (eventType.EqualsLiteral("TreeViewChanged")) { // Always asynch, always from user input
if (!isTree) if (!localName.EqualsLiteral("tree"))
return NS_OK; return NS_OK;
nsCOMPtr<nsIContent> treeContent = do_QueryInterface(aTargetNode); nsCOMPtr<nsIContent> treeContent = do_QueryInterface(aTargetNode);
@ -655,29 +651,6 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
return accService->InvalidateSubtreeFor(eventShell, treeContent, return accService->InvalidateSubtreeFor(eventShell, treeContent,
nsIAccessibleEvent::EVENT_ASYNCH_SIGNIFICANT_CHANGE); nsIAccessibleEvent::EVENT_ASYNCH_SIGNIFICANT_CHANGE);
} }
#endif
if (eventType.EqualsLiteral("popuphiding")) {
// If accessible focus was on or inside popup that closes,
// then restore it to true current focus.
// This is the case when we've been getting DOMMenuItemActive events
// inside of a combo box that closes. The real focus is on the combo box.
// It's also the case when a popup gets focus in ATK -- when it closes
// we need to fire an event to restore focus to where it was
if (!gLastFocusedNode) {
return NS_OK;
}
if (gLastFocusedNode != aTargetNode) {
// Was not focused on popup
nsCOMPtr<nsIDOMNode> parentOfFocus;
gLastFocusedNode->GetParentNode(getter_AddRefs(parentOfFocus));
if (parentOfFocus != aTargetNode) {
return NS_OK; // And was not focused on an item inside the popup
}
}
// Focus was on or inside of a popup that's being hidden
FireCurrentFocusEvent();
}
nsCOMPtr<nsIAccessible> accessible; nsCOMPtr<nsIAccessible> accessible;
accService->GetAccessibleInShell(aTargetNode, eventShell, accService->GetAccessibleInShell(aTargetNode, eventShell,
@ -686,9 +659,8 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
if (!privAcc) if (!privAcc)
return NS_OK; return NS_OK;
#ifdef MOZ_XUL
if (eventType.EqualsLiteral("TreeRowCountChanged")) { if (eventType.EqualsLiteral("TreeRowCountChanged")) {
if (!isTree) if (!localName.EqualsLiteral("tree"))
return NS_OK; return NS_OK;
nsCOMPtr<nsIDOMDataContainerEvent> dataEvent(do_QueryInterface(aEvent)); nsCOMPtr<nsIDOMDataContainerEvent> dataEvent(do_QueryInterface(aEvent));
@ -713,7 +685,6 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
return treeAccCache->InvalidateCache(index, count); return treeAccCache->InvalidateCache(index, count);
} }
#endif
if (eventType.EqualsLiteral("RadioStateChange")) { if (eventType.EqualsLiteral("RadioStateChange")) {
PRUint32 state = State(accessible); PRUint32 state = State(accessible);
@ -752,7 +723,7 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
nsCOMPtr<nsIAccessible> treeItemAccessible; nsCOMPtr<nsIAccessible> treeItemAccessible;
#ifdef MOZ_XUL #ifdef MOZ_XUL
// If it's a tree element, need the currently selected item // If it's a tree element, need the currently selected item
if (isTree) { if (localName.EqualsLiteral("tree")) {
nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelect = nsCOMPtr<nsIDOMXULMultiSelectControlElement> multiSelect =
do_QueryInterface(aTargetNode); do_QueryInterface(aTargetNode);
if (multiSelect) { if (multiSelect) {
@ -876,6 +847,28 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
nsAccUtils::FireAccEvent(event, accessible); nsAccUtils::FireAccEvent(event, accessible);
} }
} }
else if (eventType.EqualsLiteral("popuphiding")) {
// If accessible focus was on or inside popup that closes,
// then restore it to true current focus.
// This is the case when we've been getting DOMMenuItemActive events
// inside of a combo box that closes. The real focus is on the combo box.
// It's also the case when a popup gets focus in ATK -- when it closes
// we need to fire an event to restore focus to where it was
if (!gLastFocusedNode) {
return NS_OK;
}
if (gLastFocusedNode != aTargetNode) {
// Was not focused on popup
nsCOMPtr<nsIDOMNode> parentOfFocus;
gLastFocusedNode->GetParentNode(getter_AddRefs(parentOfFocus));
if (parentOfFocus != aTargetNode) {
return NS_OK; // And was not focused on an item inside the popup
}
}
// Focus was on or inside of a popup that's being hidden
FireCurrentFocusEvent();
}
else if (eventType.EqualsLiteral("DOMMenuInactive")) { else if (eventType.EqualsLiteral("DOMMenuInactive")) {
if (Role(accessible) == nsIAccessibleRole::ROLE_MENUPOPUP) { if (Role(accessible) == nsIAccessibleRole::ROLE_MENUPOPUP) {
nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END, nsAccUtils::FireAccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
@ -884,11 +877,6 @@ nsresult nsRootAccessible::HandleEventWithTarget(nsIDOMEvent* aEvent,
} }
else if (eventType.EqualsLiteral("DOMMenuItemActive")) { else if (eventType.EqualsLiteral("DOMMenuItemActive")) {
if (!treeItemAccessible) { if (!treeItemAccessible) {
#ifdef MOZ_XUL
if (isTree) {
return NS_OK; // Tree with nothing selected
}
#endif
nsCOMPtr<nsPIAccessNode> menuAccessNode = do_QueryInterface(accessible); nsCOMPtr<nsPIAccessNode> menuAccessNode = do_QueryInterface(accessible);
NS_ENSURE_TRUE(menuAccessNode, NS_ERROR_FAILURE); NS_ENSURE_TRUE(menuAccessNode, NS_ERROR_FAILURE);
nsIFrame* menuFrame = menuAccessNode->GetFrame(); nsIFrame* menuFrame = menuAccessNode->GetFrame();

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

@ -52,7 +52,7 @@ static const NSString* AXRoles [] = {
NSAccessibilityUnknownRole, // ROLE_CARET. unused on OS X NSAccessibilityUnknownRole, // ROLE_CARET. unused on OS X
NSAccessibilityWindowRole, // ROLE_ALERT NSAccessibilityWindowRole, // ROLE_ALERT
NSAccessibilityWindowRole, // ROLE_WINDOW. irrelevant on OS X; all window a11y is handled by the system. NSAccessibilityWindowRole, // ROLE_WINDOW. irrelevant on OS X; all window a11y is handled by the system.
@"AXWebArea", // ROLE_INTERNAL_FRAME @"AXWebArea", // ROLE_CLIENT
NSAccessibilityMenuRole, // ROLE_MENUPOPUP. the parent of menuitems NSAccessibilityMenuRole, // ROLE_MENUPOPUP. the parent of menuitems
NSAccessibilityMenuItemRole, // ROLE_MENUITEM. NSAccessibilityMenuItemRole, // ROLE_MENUITEM.
@"AXHelpTag", // ROLE_TOOLTIP. 10.4+ only, so we re-define the constant. @"AXHelpTag", // ROLE_TOOLTIP. 10.4+ only, so we re-define the constant.

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

@ -95,8 +95,8 @@ static const WindowsRoleMapItem gWindowsRoleMap[] = {
// nsIAccessibleRole::ROLE_WINDOW // nsIAccessibleRole::ROLE_WINDOW
{ ROLE_SYSTEM_WINDOW, ROLE_SYSTEM_WINDOW }, { ROLE_SYSTEM_WINDOW, ROLE_SYSTEM_WINDOW },
// nsIAccessibleRole::ROLE_INTERNAL_FRAME // nsIAccessibleRole::ROLE_CLIENT
{ USE_ROLE_STRING, IA2_ROLE_INTERNAL_FRAME}, { USE_ROLE_STRING, IA2_ROLE_UNKNOWN},
// nsIAccessibleRole::ROLE_MENUPOPUP // nsIAccessibleRole::ROLE_MENUPOPUP
{ ROLE_SYSTEM_MENUPOPUP, ROLE_SYSTEM_MENUPOPUP }, { ROLE_SYSTEM_MENUPOPUP, ROLE_SYSTEM_MENUPOPUP },
@ -429,7 +429,7 @@ static const WindowsRoleMapItem gWindowsRoleMap[] = {
{ ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM }, { ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
// nsIAccessibleRole::ROLE_RICH_OPTION // nsIAccessibleRole::ROLE_RICH_OPTION
{ ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM }, { ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },
// nsIAccessibleRole::ROLE_LISTBOX // nsIAccessibleRole::ROLE_LISTBOX
{ ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST }, { ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },

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

@ -64,11 +64,3 @@ nsXULAlertAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
return NS_OK; return NS_OK;
} }
NS_IMETHODIMP
nsXULAlertAccessible::GetName(nsAString& aName)
{
// Screen readers need to read contents of alert, not the accessible name.
// If we have both some screen readers will read the alert twice.
aName.Truncate();
return NS_OK;
}

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

@ -50,7 +50,6 @@ public:
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD GetRole(PRUint32 *aRole); NS_IMETHOD GetRole(PRUint32 *aRole);
NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState); NS_IMETHOD GetState(PRUint32 *aState, PRUint32 *aExtraState);
NS_IMETHOD GetName(nsAString& aName);
}; };
#endif #endif

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

@ -486,9 +486,7 @@ NS_IMETHODIMP nsXULMenuitemAccessible::GetRole(PRUint32 *aRole)
return NS_OK; return NS_OK;
} }
nsCOMPtr<nsIAccessible> parent; if (mParent && Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX_LIST) {
GetParent(getter_AddRefs(parent));
if (parent && Role(parent) == nsIAccessibleRole::ROLE_COMBOBOX_LIST) {
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION; *aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
return NS_OK; return NS_OK;
} }
@ -718,18 +716,14 @@ NS_IMETHODIMP nsXULMenupopupAccessible::GetRole(PRUint32 *aRole)
if (!content) { if (!content) {
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
nsCOMPtr<nsIAccessible> parent; if ((mParent && Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX) ||
GetParent(getter_AddRefs(parent)); content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
if (parent) { nsAccessibilityAtoms::autocomplete, eIgnoreCase)) {
// Some widgets like the search bar have several popups, owned by buttons *aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
PRUint32 role = Role(parent); }
if (role == nsIAccessibleRole::ROLE_COMBOBOX || else {
role == nsIAccessibleRole::ROLE_PUSHBUTTON) { *aRole = nsIAccessibleRole::ROLE_MENUPOPUP;
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
return NS_OK;
}
} }
*aRole = nsIAccessibleRole::ROLE_MENUPOPUP;
return NS_OK; return NS_OK;
} }

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

@ -41,7 +41,6 @@
#include "nsAccessibilityService.h" #include "nsAccessibilityService.h"
#include "nsIContent.h" #include "nsIContent.h"
#include "nsIDOMXULMenuListElement.h" #include "nsIDOMXULMenuListElement.h"
#include "nsIDOMXULPopupElement.h"
#include "nsIDOMXULSelectCntrlItemEl.h" #include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDOMXULSelectCntrlEl.h" #include "nsIDOMXULSelectCntrlEl.h"
#include "nsIDOMXULTextboxElement.h" #include "nsIDOMXULTextboxElement.h"
@ -195,20 +194,9 @@ NS_IMETHODIMP nsXULListboxAccessible::GetValue(nsAString& _retval)
return NS_ERROR_FAILURE; return NS_ERROR_FAILURE;
} }
NS_IMETHODIMP nsXULListboxAccessible::GetRole(PRUint32 *aRole) NS_IMETHODIMP nsXULListboxAccessible::GetRole(PRUint32 *_retval)
{ {
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode); *_retval = nsIAccessibleRole::ROLE_LIST;
if (content) {
// A richlistbox is used with the new autocomplete URL bar,
// and has a parent popup <panel>
nsCOMPtr<nsIDOMXULPopupElement> xulPopup =
do_QueryInterface(content->GetParent());
if (xulPopup) {
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
return NS_OK;
}
}
*aRole = nsIAccessibleRole::ROLE_LIST;
return NS_OK; return NS_OK;
} }
@ -262,8 +250,6 @@ NS_IMETHODIMP nsXULListitemAccessible::GetRole(PRUint32 *aRole)
{ {
if (mIsCheckbox) if (mIsCheckbox)
*aRole = nsIAccessibleRole::ROLE_CHECKBUTTON; *aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
else if (mParent && Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
*aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
else else
*aRole = nsIAccessibleRole::ROLE_RICH_OPTION; *aRole = nsIAccessibleRole::ROLE_RICH_OPTION;
return NS_OK; return NS_OK;

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

@ -61,9 +61,13 @@ NS_IMETHODIMP nsXULTextAccessible::GetName(nsAString& aName)
if (!content) { if (!content) {
return NS_ERROR_FAILURE; // Node shut down return NS_ERROR_FAILURE; // Node shut down
} }
// if the value attr doesn't exist, the screen reader must get the accessible text if (!content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::value,
// from the accessible text interface or from the children aName)) {
return content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::value, aName); // if the value doesn't exist, flatten the inner content as the name (for descriptions)
return AppendFlatStringFromSubtree(content, &aName);
}
// otherwise, use the value attribute as the name (for labels)
return NS_OK;
} }
NS_IMETHODIMP NS_IMETHODIMP
@ -172,9 +176,13 @@ NS_IMETHODIMP nsXULLinkAccessible::GetName(nsAString& aName)
NS_IMETHODIMP nsXULLinkAccessible::GetRole(PRUint32 *aRole) NS_IMETHODIMP nsXULLinkAccessible::GetRole(PRUint32 *aRole)
{ {
// We used to say ROLE_BUTTON if there was no href, but then screen readers if (mIsLink) {
// would tell users to hit the space bar for activation, which is wrong for a link *aRole = nsIAccessibleRole::ROLE_LINK;
*aRole = nsIAccessibleRole::ROLE_LINK; } else {
// default to calling the link a button; might have javascript
*aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
}
// should there be a third case where it becomes just text?
return NS_OK; return NS_OK;
} }

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

@ -97,8 +97,11 @@ var PlacesCommandHook = {
break; break;
case "keypress": case "keypress":
if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE || if (aEvent.keyCode == KeyEvent.DOM_VK_ESCAPE ||
aEvent.keyCode == KeyEvent.DOM_VK_RETURN) aEvent.keyCode == KeyEvent.DOM_VK_RETURN) {
this.panel.hidePopup(); // hide the panel // focus the content area and hide the panel
window.content.focus();
this.panel.hidePopup();
}
break; break;
} }
}, },

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

@ -1503,20 +1503,13 @@ function loadOneOrMoreURIs(aURIString)
} }
} }
function focusAndSelectUrlBar() function openLocation()
{ {
if (gURLBar && isElementVisible(gURLBar) && !gURLBar.readOnly) { if (gURLBar && isElementVisible(gURLBar) && !gURLBar.readOnly) {
gURLBar.focus(); gURLBar.focus();
gURLBar.select(); gURLBar.select();
return true;
}
return false;
}
function openLocation()
{
if (focusAndSelectUrlBar())
return; return;
}
#ifdef XP_MACOSX #ifdef XP_MACOSX
if (window.location.href != getBrowserURL()) { if (window.location.href != getBrowserURL()) {
var win = getTopWin(); var win = getTopWin();
@ -5758,23 +5751,16 @@ IdentityHandler.prototype = {
this._identityPopupContentSupp.textContent = supplemental; this._identityPopupContentSupp.textContent = supplemental;
this._identityPopupContentVerif.textContent = verifier; this._identityPopupContentVerif.textContent = verifier;
}, },
hideIdentityPopup : function() {
this._identityPopup.hidePopup();
},
/** /**
* Click handler for the identity-box element in primary chrome. * Click handler for the identity-box element in primary chrome.
*/ */
handleIdentityButtonEvent : function(event) { handleIdentityClick : function(event) {
event.stopPropagation(); event.stopPropagation();
if ((event.type == "click" && event.button != 0) ||
(event.type == "keypress" && event.charCode != KeyEvent.DOM_VK_SPACE &&
event.keyCode != KeyEvent.DOM_VK_RETURN))
return; // Left click, space or enter only
if (event.button != 0)
return; // We only want left-clicks
// Make sure that the display:none style we set in xul is removed now that // Make sure that the display:none style we set in xul is removed now that
// the popup is actually needed // the popup is actually needed
this._identityPopup.hidden = false; this._identityPopup.hidden = false;

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

@ -106,8 +106,7 @@
<panel type="autocomplete-richlistbox" chromedir="&locale.dir;" id="PopupAutoCompleteRichResult" noautofocus="true" hidden="true"/> <panel type="autocomplete-richlistbox" chromedir="&locale.dir;" id="PopupAutoCompleteRichResult" noautofocus="true" hidden="true"/>
<panel id="editBookmarkPanel" orient="vertical" hidden="true" <panel id="editBookmarkPanel" orient="vertical" hidden="true"
onpopupshown="PlacesCommandHook.editBookmarkPanelShown();" onpopupshown="PlacesCommandHook.editBookmarkPanelShown();">
label="&bookmarkPageCmd2.label;">
<vbox id="editBookmarkPanelContent" flex="1"/> <vbox id="editBookmarkPanelContent" flex="1"/>
<hbox flex="1"> <hbox flex="1">
<spacer flex="1"/> <spacer flex="1"/>
@ -146,14 +145,12 @@
<popup id="placesContext"/> <popup id="placesContext"/>
<!-- Popup for site identity information --> <!-- Popup for site identity information -->
<panel id="identity-popup" position="after_start" hidden="true" noautofocus="true" <panel id="identity-popup" position="after_start" hidden="true" noautofocus="true">
onpopupshown="document.getElementById('identity-popup-more-info-link').focus();"
onpopuphidden="focusAndSelectUrlBar();" norestorefocus="true">
<hbox id="identity-popup-container" align="top"> <hbox id="identity-popup-container" align="top">
<image id="identity-popup-icon"/> <image id="identity-popup-icon"/>
<vbox id="identity-popup-content-box"> <vbox id="identity-popup-content-box">
<!-- Title Bar --> <!-- Title Bar -->
<label id="identity-popup-title" control="identity-popup"/> <label id="identity-popup-title"/>
<!-- Content area --> <!-- Content area -->
<description id="identity-popup-content"/> <description id="identity-popup-content"/>
<description id="identity-popup-content-supplemental"/> <description id="identity-popup-content-supplemental"/>
@ -170,7 +167,6 @@
<label id="identity-popup-more-info-link" <label id="identity-popup-more-info-link"
class="text-link plain" class="text-link plain"
value="&identity.moreInfoLinkText;" value="&identity.moreInfoLinkText;"
onblur="getIdentityHandler().hideIdentityPopup();"
onclick="getIdentityHandler().handleMoreInfoClick(event);"/> onclick="getIdentityHandler().handleMoreInfoClick(event);"/>
</vbox> </vbox>
</hbox> </hbox>
@ -273,9 +269,8 @@
pageproxystate="invalid"> pageproxystate="invalid">
<!-- Use onclick instead of normal popup= syntax since the popup <!-- Use onclick instead of normal popup= syntax since the popup
code fires onmousedown, and hence eats our favicon drag events --> code fires onmousedown, and hence eats our favicon drag events -->
<box id="identity-box" role="button" <box id="identity-box"
onclick="getIdentityHandler().handleIdentityButtonEvent(event);" onclick="getIdentityHandler().handleIdentityClick(event);">
onkeypress="getIdentityHandler().handleIdentityButtonEvent(event);">
<hbox align="center"> <hbox align="center">
<deck id="page-proxy-deck" onclick="PageProxyClickHandler(event);"> <deck id="page-proxy-deck" onclick="PageProxyClickHandler(event);">
<image id="page-proxy-button" <image id="page-proxy-button"

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

@ -846,11 +846,6 @@ toolbar[iconsize="small"] #paste-button[disabled="true"] {
#identity-box { #identity-box {
background-color: -moz-dialog; background-color: -moz-dialog;
-moz-border-end: 1px solid ThreeDShadow; -moz-border-end: 1px solid ThreeDShadow;
-moz-user-focus: normal;
}
#identity-box:focus {
outline: 1px dotted -moz-DialogText;
} }
#identity-icon-label { #identity-icon-label {

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

@ -1635,11 +1635,6 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
border-right: 1px solid #888; border-right: 1px solid #888;
background-color: white; background-color: white;
opacity: 0.9; opacity: 0.9;
-moz-user-focus: normal;
}
#identity-box:focus {
outline: 1.4pt solid -moz-mac-focusring;
} }
#identity-box:hover { #identity-box:hover {

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

@ -1592,11 +1592,6 @@ toolbarbutton.bookmark-item[dragover="true"][open="true"] {
/* currently, the identity box is always LTR */ /* currently, the identity box is always LTR */
-moz-outline-radius-topleft: 2px; -moz-outline-radius-topleft: 2px;
-moz-outline-radius-bottomleft: 2px; -moz-outline-radius-bottomleft: 2px;
-moz-user-focus: normal;
}
#identity-box:focus {
outline: 1px dotted -moz-DialogText;
} }
#identity-box:hover { #identity-box:hover {

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

@ -386,9 +386,6 @@
<method name="onKeyPress"> <method name="onKeyPress">
<parameter name="aEvent"/> <parameter name="aEvent"/>
<body><![CDATA[ <body><![CDATA[
if (aEvent.target.localName != "textbox")
return; // Let child buttons of autocomplete take input
//XXXpch this is so bogus... //XXXpch this is so bogus...
if (aEvent.getPreventDefault()) if (aEvent.getPreventDefault())
return false; return false;
@ -539,7 +536,7 @@
</resources> </resources>
<content ignorekeys="true"> <content ignorekeys="true">
<xul:tree anonid="tree" class="autocomplete-tree plain" hidecolumnpicker="true" flex="1" seltype="single"> <xul:tree anonid="tree" class="autocomplete-tree plain" hidecolumnpicker="true" flex="1">
<xul:treecols anonid="treecols"> <xul:treecols anonid="treecols">
<xul:treecol id="treecolAutoCompleteValue" class="autocomplete-treecol" flex="1" overflow="true"/> <xul:treecol id="treecolAutoCompleteValue" class="autocomplete-treecol" flex="1" overflow="true"/>
</xul:treecols> </xul:treecols>
@ -744,10 +741,6 @@
<binding id="autocomplete-base-popup" extends="chrome://global/content/bindings/popup.xml#popup"> <binding id="autocomplete-base-popup" extends="chrome://global/content/bindings/popup.xml#popup">
<implementation implements="nsIAutoCompletePopup"> <implementation implements="nsIAutoCompletePopup">
<!-- nsIAccessible from #popup -->
<property name="accessibleType" readonly="true"
onget="return Components.interfaces.nsIAccessibleProvider.NoAccessible;"/>
<field name="mInput">null</field> <field name="mInput">null</field>
<field name="mPopupOpen">false</field> <field name="mPopupOpen">false</field>
@ -842,9 +835,6 @@
]]></handler> ]]></handler>
<handler event="popuphiding"><![CDATA[ <handler event="popuphiding"><![CDATA[
var isListActive = true;
if (this.selectedIndex == -1)
isListActive = false;
var controller = this.view.QueryInterface(Components.interfaces.nsIAutoCompleteController); var controller = this.view.QueryInterface(Components.interfaces.nsIAutoCompleteController);
controller.stopSearch(); controller.stopSearch();
@ -860,10 +850,6 @@
// when the popupshowing handler runs. // when the popupshowing handler runs.
this.mInput.maxRows = this._normalMaxRows; this.mInput.maxRows = this._normalMaxRows;
this._normalMaxRows = -1; this._normalMaxRows = -1;
// If the list was being navigated and then closed, make sure
// we fire accessible focus event back to textbox
if (isListActive)
this.mInput._focus();
]]></handler> ]]></handler>
</handlers> </handlers>
</binding> </binding>

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

@ -9,8 +9,20 @@
<resources> <resources>
<stylesheet src="chrome://global/skin/popup.css"/> <stylesheet src="chrome://global/skin/popup.css"/>
</resources> </resources>
</binding>
<binding id="panel"
extends="chrome://global/content/bindings/popup.xml#popup-base">
<implementation implements="nsIDOMXULPopupElement, nsIAccessibleProvider">
<property name="accessibleType" readonly="true">
<getter>
<![CDATA[
return Components.interfaces.nsIAccessibleProvider.XULMenupopup;
]]>
</getter>
</property>
<implementation implements="nsIDOMXULPopupElement">
<property name="position" onget="return this.getAttribute('position');" <property name="position" onget="return this.getAttribute('position');"
onset="this.setAttribute('position', val); return val;"/> onset="this.setAttribute('position', val); return val;"/>
<property name="popupBoxObject"> <property name="popupBoxObject">
@ -155,24 +167,13 @@
</binding> </binding>
<binding id="popup" <binding id="popup"
extends="chrome://global/content/bindings/popup.xml#popup-base"> extends="chrome://global/content/bindings/popup.xml#panel">
<content> <content>
<xul:arrowscrollbox class="popup-internal-box" flex="1" orient="vertical"> <xul:arrowscrollbox class="popup-internal-box" flex="1" orient="vertical">
<children/> <children/>
</xul:arrowscrollbox> </xul:arrowscrollbox>
</content> </content>
<implementation implements="nsIAccessibleProvider">
<property name="accessibleType" readonly="true">
<getter>
<![CDATA[
return Components.interfaces.nsIAccessibleProvider.XULMenupopup;
]]>
</getter>
</property>
</implementation>
<handlers> <handlers>
<handler event="contextmenu" action="event.preventDefault();"/> <handler event="contextmenu" action="event.preventDefault();"/>
@ -197,64 +198,6 @@
</handlers> </handlers>
</binding> </binding>
<binding id="panel"
extends="chrome://global/content/bindings/popup.xml#popup-base">
<!-- This separate binding for dialog-like panels - not menu, list or autocomplete popups
exposes the popup as an alert or a pane, depending on whether it is always intended
to get keyboard navigation when it opens -->
<implementation implements="nsIDOMXULPopupElement, nsIAccessibleProvider">
<property name="accessibleType" readonly="true">
<getter>
<![CDATA[
return (this.getAttribute("noautofocus") == "true") ?
Components.interfaces.nsIAccessibleProvider.XULAlert :
Components.interfaces.nsIAccessibleProvider.XULPane;
]]></getter>
</property>
<field name="_prevFocus">0</field>
</implementation>
<handlers>
<handler event="popupshowing"><![CDATA[
// Capture the previous focus before has a chance to get set inside the panel
try {
this._prevFocus = document.commandDispatcher.focusedElement;
if (!this._prevFocus) // Content window has focus
this._prevFocus = document.commandDispatcher.focusedWindow;
} catch (ex) {}
]]></handler>
<handler event="popupshown"><![CDATA[
// Fire event for accessibility APIs
var alertEvent = document.createEvent("Events");
alertEvent.initEvent("AlertActive", true, true);
this.dispatchEvent(alertEvent);
]]></handler>
<handler event="popuphiding"><![CDATA[
function restoreFocusIfInPanel(aPanel, currentFocus, prevFocus) {
try {
if (document.commandDispatcher.focusedWindow != window)
return; // Focus has already been set to a window outside of this panel
} catch(ex) {}
var ancestorOfFocus = currentFocus;
while (ancestorOfFocus) {
if (ancestorOfFocus == aPanel) {
// Focus was set on an element inside this panel,
// so we need to move it back to where it was previously
prevFocus.focus();
return;
}
ancestorOfFocus = ancestorOfFocus.parentNode;
}
}
try {
if (this._prevFocus && this.getAttribute("norestorefocus") != "true")
setTimeout(restoreFocusIfInPanel, 0, this, document.commandDispatcher.focusedElement,
this._prevFocus);
} catch(ex) { }
]]></handler>
</handlers>
</binding>
<binding id="tooltip" extends="chrome://global/content/bindings/popup.xml#popup"> <binding id="tooltip" extends="chrome://global/content/bindings/popup.xml#popup">
<content> <content>
<children> <children>

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

@ -157,10 +157,8 @@
<handler event="focus" phase="capturing"> <handler event="focus" phase="capturing">
<![CDATA[ <![CDATA[
if (!this.hasAttribute("focused")) { if (!this.hasAttribute("focused")) {
if (event.originalTarget == this) if (event.originalTarget != this.inputField)
this.inputField.focus(); // Forward focus to actual HTML input this.inputField.focus();
else if (event.originalTarget != this.inputField)
return; // Allow other children (e.g. URL bar buttons) to get focus
else if (this.mIgnoreFocus) else if (this.mIgnoreFocus)
this.mIgnoreFocus = false; this.mIgnoreFocus = false;
else if (this.clickSelectsAll) else if (this.clickSelectsAll)