gecko/accessible/base/nsAccessibilityService.cpp
Birunthan Mohanathas 4d4d058012 Bug 1028563 - Part 1: Flatten accessible/src/ directory. rs=surkov
--HG--
rename : accessible/src/atk/ARIAGridAccessibleWrap.h => accessible/atk/ARIAGridAccessibleWrap.h
rename : accessible/src/atk/AccessibleWrap.cpp => accessible/atk/AccessibleWrap.cpp
rename : accessible/src/atk/AccessibleWrap.h => accessible/atk/AccessibleWrap.h
rename : accessible/src/atk/ApplicationAccessibleWrap.cpp => accessible/atk/ApplicationAccessibleWrap.cpp
rename : accessible/src/atk/ApplicationAccessibleWrap.h => accessible/atk/ApplicationAccessibleWrap.h
rename : accessible/src/atk/AtkSocketAccessible.cpp => accessible/atk/AtkSocketAccessible.cpp
rename : accessible/src/atk/AtkSocketAccessible.h => accessible/atk/AtkSocketAccessible.h
rename : accessible/src/atk/DocAccessibleWrap.cpp => accessible/atk/DocAccessibleWrap.cpp
rename : accessible/src/atk/DocAccessibleWrap.h => accessible/atk/DocAccessibleWrap.h
rename : accessible/src/atk/HTMLTableAccessibleWrap.h => accessible/atk/HTMLTableAccessibleWrap.h
rename : accessible/src/atk/HyperTextAccessibleWrap.h => accessible/atk/HyperTextAccessibleWrap.h
rename : accessible/src/atk/ImageAccessibleWrap.h => accessible/atk/ImageAccessibleWrap.h
rename : accessible/src/atk/InterfaceInitFuncs.h => accessible/atk/InterfaceInitFuncs.h
rename : accessible/src/atk/Makefile.in => accessible/atk/Makefile.in
rename : accessible/src/atk/Platform.cpp => accessible/atk/Platform.cpp
rename : accessible/src/atk/RootAccessibleWrap.cpp => accessible/atk/RootAccessibleWrap.cpp
rename : accessible/src/atk/RootAccessibleWrap.h => accessible/atk/RootAccessibleWrap.h
rename : accessible/src/atk/TextLeafAccessibleWrap.h => accessible/atk/TextLeafAccessibleWrap.h
rename : accessible/src/atk/UtilInterface.cpp => accessible/atk/UtilInterface.cpp
rename : accessible/src/atk/XULListboxAccessibleWrap.h => accessible/atk/XULListboxAccessibleWrap.h
rename : accessible/src/atk/XULMenuAccessibleWrap.h => accessible/atk/XULMenuAccessibleWrap.h
rename : accessible/src/atk/XULTreeGridAccessibleWrap.h => accessible/atk/XULTreeGridAccessibleWrap.h
rename : accessible/src/atk/moz.build => accessible/atk/moz.build
rename : accessible/src/atk/nsMai.h => accessible/atk/nsMai.h
rename : accessible/src/atk/nsMaiHyperlink.cpp => accessible/atk/nsMaiHyperlink.cpp
rename : accessible/src/atk/nsMaiHyperlink.h => accessible/atk/nsMaiHyperlink.h
rename : accessible/src/atk/nsMaiInterfaceAction.cpp => accessible/atk/nsMaiInterfaceAction.cpp
rename : accessible/src/atk/nsMaiInterfaceComponent.cpp => accessible/atk/nsMaiInterfaceComponent.cpp
rename : accessible/src/atk/nsMaiInterfaceDocument.cpp => accessible/atk/nsMaiInterfaceDocument.cpp
rename : accessible/src/atk/nsMaiInterfaceEditableText.cpp => accessible/atk/nsMaiInterfaceEditableText.cpp
rename : accessible/src/atk/nsMaiInterfaceHyperlinkImpl.cpp => accessible/atk/nsMaiInterfaceHyperlinkImpl.cpp
rename : accessible/src/atk/nsMaiInterfaceHypertext.cpp => accessible/atk/nsMaiInterfaceHypertext.cpp
rename : accessible/src/atk/nsMaiInterfaceImage.cpp => accessible/atk/nsMaiInterfaceImage.cpp
rename : accessible/src/atk/nsMaiInterfaceSelection.cpp => accessible/atk/nsMaiInterfaceSelection.cpp
rename : accessible/src/atk/nsMaiInterfaceTable.cpp => accessible/atk/nsMaiInterfaceTable.cpp
rename : accessible/src/atk/nsMaiInterfaceText.cpp => accessible/atk/nsMaiInterfaceText.cpp
rename : accessible/src/atk/nsMaiInterfaceValue.cpp => accessible/atk/nsMaiInterfaceValue.cpp
rename : accessible/src/atk/nsStateMap.h => accessible/atk/nsStateMap.h
rename : accessible/src/base/ARIAMap.cpp => accessible/base/ARIAMap.cpp
rename : accessible/src/base/ARIAMap.h => accessible/base/ARIAMap.h
rename : accessible/src/base/ARIAStateMap.cpp => accessible/base/ARIAStateMap.cpp
rename : accessible/src/base/ARIAStateMap.h => accessible/base/ARIAStateMap.h
rename : accessible/src/base/AccCollector.cpp => accessible/base/AccCollector.cpp
rename : accessible/src/base/AccCollector.h => accessible/base/AccCollector.h
rename : accessible/src/base/AccEvent.cpp => accessible/base/AccEvent.cpp
rename : accessible/src/base/AccEvent.h => accessible/base/AccEvent.h
rename : accessible/src/base/AccGroupInfo.cpp => accessible/base/AccGroupInfo.cpp
rename : accessible/src/base/AccGroupInfo.h => accessible/base/AccGroupInfo.h
rename : accessible/src/base/AccIterator.cpp => accessible/base/AccIterator.cpp
rename : accessible/src/base/AccIterator.h => accessible/base/AccIterator.h
rename : accessible/src/base/AccTypes.h => accessible/base/AccTypes.h
rename : accessible/src/base/Asserts.cpp => accessible/base/Asserts.cpp
rename : accessible/src/base/DocManager.cpp => accessible/base/DocManager.cpp
rename : accessible/src/base/DocManager.h => accessible/base/DocManager.h
rename : accessible/src/base/EventQueue.cpp => accessible/base/EventQueue.cpp
rename : accessible/src/base/EventQueue.h => accessible/base/EventQueue.h
rename : accessible/src/base/Filters.cpp => accessible/base/Filters.cpp
rename : accessible/src/base/Filters.h => accessible/base/Filters.h
rename : accessible/src/base/FocusManager.cpp => accessible/base/FocusManager.cpp
rename : accessible/src/base/FocusManager.h => accessible/base/FocusManager.h
rename : accessible/src/base/Logging.cpp => accessible/base/Logging.cpp
rename : accessible/src/base/Logging.h => accessible/base/Logging.h
rename : accessible/src/base/Makefile.in => accessible/base/Makefile.in
rename : accessible/src/base/NotificationController.cpp => accessible/base/NotificationController.cpp
rename : accessible/src/base/NotificationController.h => accessible/base/NotificationController.h
rename : accessible/src/base/Platform.h => accessible/base/Platform.h
rename : accessible/src/base/Relation.h => accessible/base/Relation.h
rename : accessible/src/base/RelationType.h => accessible/base/RelationType.h
rename : accessible/src/base/RelationTypeMap.h => accessible/base/RelationTypeMap.h
rename : accessible/src/base/Role.h => accessible/base/Role.h
rename : accessible/src/base/RoleMap.h => accessible/base/RoleMap.h
rename : accessible/src/base/SelectionManager.cpp => accessible/base/SelectionManager.cpp
rename : accessible/src/base/SelectionManager.h => accessible/base/SelectionManager.h
rename : accessible/src/base/States.h => accessible/base/States.h
rename : accessible/src/base/Statistics.h => accessible/base/Statistics.h
rename : accessible/src/base/StyleInfo.cpp => accessible/base/StyleInfo.cpp
rename : accessible/src/base/StyleInfo.h => accessible/base/StyleInfo.h
rename : accessible/src/base/TextAttrs.cpp => accessible/base/TextAttrs.cpp
rename : accessible/src/base/TextAttrs.h => accessible/base/TextAttrs.h
rename : accessible/src/base/TextRange.cpp => accessible/base/TextRange.cpp
rename : accessible/src/base/TextRange.h => accessible/base/TextRange.h
rename : accessible/src/base/TextUpdater.cpp => accessible/base/TextUpdater.cpp
rename : accessible/src/base/TextUpdater.h => accessible/base/TextUpdater.h
rename : accessible/src/base/TreeWalker.cpp => accessible/base/TreeWalker.cpp
rename : accessible/src/base/TreeWalker.h => accessible/base/TreeWalker.h
rename : accessible/src/base/moz.build => accessible/base/moz.build
rename : accessible/src/base/nsAccCache.h => accessible/base/nsAccCache.h
rename : accessible/src/base/nsAccUtils.cpp => accessible/base/nsAccUtils.cpp
rename : accessible/src/base/nsAccUtils.h => accessible/base/nsAccUtils.h
rename : accessible/src/base/nsAccessibilityService.cpp => accessible/base/nsAccessibilityService.cpp
rename : accessible/src/base/nsAccessibilityService.h => accessible/base/nsAccessibilityService.h
rename : accessible/src/base/nsAccessiblePivot.cpp => accessible/base/nsAccessiblePivot.cpp
rename : accessible/src/base/nsAccessiblePivot.h => accessible/base/nsAccessiblePivot.h
rename : accessible/src/base/nsCoreUtils.cpp => accessible/base/nsCoreUtils.cpp
rename : accessible/src/base/nsCoreUtils.h => accessible/base/nsCoreUtils.h
rename : accessible/src/base/nsEventShell.cpp => accessible/base/nsEventShell.cpp
rename : accessible/src/base/nsEventShell.h => accessible/base/nsEventShell.h
rename : accessible/src/base/nsTextEquivUtils.cpp => accessible/base/nsTextEquivUtils.cpp
rename : accessible/src/base/nsTextEquivUtils.h => accessible/base/nsTextEquivUtils.h
rename : accessible/src/generic/ARIAGridAccessible-inl.h => accessible/generic/ARIAGridAccessible-inl.h
rename : accessible/src/generic/ARIAGridAccessible.cpp => accessible/generic/ARIAGridAccessible.cpp
rename : accessible/src/generic/ARIAGridAccessible.h => accessible/generic/ARIAGridAccessible.h
rename : accessible/src/generic/Accessible-inl.h => accessible/generic/Accessible-inl.h
rename : accessible/src/generic/Accessible.cpp => accessible/generic/Accessible.cpp
rename : accessible/src/generic/Accessible.h => accessible/generic/Accessible.h
rename : accessible/src/generic/ApplicationAccessible.cpp => accessible/generic/ApplicationAccessible.cpp
rename : accessible/src/generic/ApplicationAccessible.h => accessible/generic/ApplicationAccessible.h
rename : accessible/src/generic/BaseAccessibles.cpp => accessible/generic/BaseAccessibles.cpp
rename : accessible/src/generic/BaseAccessibles.h => accessible/generic/BaseAccessibles.h
rename : accessible/src/generic/DocAccessible-inl.h => accessible/generic/DocAccessible-inl.h
rename : accessible/src/generic/DocAccessible.cpp => accessible/generic/DocAccessible.cpp
rename : accessible/src/generic/DocAccessible.h => accessible/generic/DocAccessible.h
rename : accessible/src/generic/FormControlAccessible.cpp => accessible/generic/FormControlAccessible.cpp
rename : accessible/src/generic/FormControlAccessible.h => accessible/generic/FormControlAccessible.h
rename : accessible/src/generic/HyperTextAccessible-inl.h => accessible/generic/HyperTextAccessible-inl.h
rename : accessible/src/generic/HyperTextAccessible.cpp => accessible/generic/HyperTextAccessible.cpp
rename : accessible/src/generic/HyperTextAccessible.h => accessible/generic/HyperTextAccessible.h
rename : accessible/src/generic/ImageAccessible.cpp => accessible/generic/ImageAccessible.cpp
rename : accessible/src/generic/ImageAccessible.h => accessible/generic/ImageAccessible.h
rename : accessible/src/generic/OuterDocAccessible.cpp => accessible/generic/OuterDocAccessible.cpp
rename : accessible/src/generic/OuterDocAccessible.h => accessible/generic/OuterDocAccessible.h
rename : accessible/src/generic/RootAccessible.cpp => accessible/generic/RootAccessible.cpp
rename : accessible/src/generic/RootAccessible.h => accessible/generic/RootAccessible.h
rename : accessible/src/generic/TableAccessible.h => accessible/generic/TableAccessible.h
rename : accessible/src/generic/TableCellAccessible.cpp => accessible/generic/TableCellAccessible.cpp
rename : accessible/src/generic/TableCellAccessible.h => accessible/generic/TableCellAccessible.h
rename : accessible/src/generic/TextLeafAccessible.cpp => accessible/generic/TextLeafAccessible.cpp
rename : accessible/src/generic/TextLeafAccessible.h => accessible/generic/TextLeafAccessible.h
rename : accessible/src/generic/moz.build => accessible/generic/moz.build
rename : accessible/src/html/HTMLCanvasAccessible.cpp => accessible/html/HTMLCanvasAccessible.cpp
rename : accessible/src/html/HTMLCanvasAccessible.h => accessible/html/HTMLCanvasAccessible.h
rename : accessible/src/html/HTMLElementAccessibles.cpp => accessible/html/HTMLElementAccessibles.cpp
rename : accessible/src/html/HTMLElementAccessibles.h => accessible/html/HTMLElementAccessibles.h
rename : accessible/src/html/HTMLFormControlAccessible.cpp => accessible/html/HTMLFormControlAccessible.cpp
rename : accessible/src/html/HTMLFormControlAccessible.h => accessible/html/HTMLFormControlAccessible.h
rename : accessible/src/html/HTMLImageMapAccessible.cpp => accessible/html/HTMLImageMapAccessible.cpp
rename : accessible/src/html/HTMLImageMapAccessible.h => accessible/html/HTMLImageMapAccessible.h
rename : accessible/src/html/HTMLLinkAccessible.cpp => accessible/html/HTMLLinkAccessible.cpp
rename : accessible/src/html/HTMLLinkAccessible.h => accessible/html/HTMLLinkAccessible.h
rename : accessible/src/html/HTMLListAccessible.cpp => accessible/html/HTMLListAccessible.cpp
rename : accessible/src/html/HTMLListAccessible.h => accessible/html/HTMLListAccessible.h
rename : accessible/src/html/HTMLSelectAccessible.cpp => accessible/html/HTMLSelectAccessible.cpp
rename : accessible/src/html/HTMLSelectAccessible.h => accessible/html/HTMLSelectAccessible.h
rename : accessible/src/html/HTMLTableAccessible.cpp => accessible/html/HTMLTableAccessible.cpp
rename : accessible/src/html/HTMLTableAccessible.h => accessible/html/HTMLTableAccessible.h
rename : accessible/src/html/moz.build => accessible/html/moz.build
rename : accessible/src/jsat/AccessFu.css => accessible/jsat/AccessFu.css
rename : accessible/src/jsat/AccessFu.jsm => accessible/jsat/AccessFu.jsm
rename : accessible/src/jsat/Constants.jsm => accessible/jsat/Constants.jsm
rename : accessible/src/jsat/ContentControl.jsm => accessible/jsat/ContentControl.jsm
rename : accessible/src/jsat/EventManager.jsm => accessible/jsat/EventManager.jsm
rename : accessible/src/jsat/Gestures.jsm => accessible/jsat/Gestures.jsm
rename : accessible/src/jsat/OutputGenerator.jsm => accessible/jsat/OutputGenerator.jsm
rename : accessible/src/jsat/PointerAdapter.jsm => accessible/jsat/PointerAdapter.jsm
rename : accessible/src/jsat/Presentation.jsm => accessible/jsat/Presentation.jsm
rename : accessible/src/jsat/TraversalRules.jsm => accessible/jsat/TraversalRules.jsm
rename : accessible/src/jsat/Utils.jsm => accessible/jsat/Utils.jsm
rename : accessible/src/jsat/content-script.js => accessible/jsat/content-script.js
rename : accessible/src/jsat/jar.mn => accessible/jsat/jar.mn
rename : accessible/src/jsat/moz.build => accessible/jsat/moz.build
rename : accessible/src/jsat/sounds/clicked.ogg => accessible/jsat/sounds/clicked.ogg
rename : accessible/src/jsat/sounds/virtual_cursor_key.ogg => accessible/jsat/sounds/virtual_cursor_key.ogg
rename : accessible/src/jsat/sounds/virtual_cursor_move.ogg => accessible/jsat/sounds/virtual_cursor_move.ogg
rename : accessible/src/mac/ARIAGridAccessibleWrap.h => accessible/mac/ARIAGridAccessibleWrap.h
rename : accessible/src/mac/AccessibleWrap.h => accessible/mac/AccessibleWrap.h
rename : accessible/src/mac/AccessibleWrap.mm => accessible/mac/AccessibleWrap.mm
rename : accessible/src/mac/ApplicationAccessibleWrap.h => accessible/mac/ApplicationAccessibleWrap.h
rename : accessible/src/mac/DocAccessibleWrap.h => accessible/mac/DocAccessibleWrap.h
rename : accessible/src/mac/DocAccessibleWrap.mm => accessible/mac/DocAccessibleWrap.mm
rename : accessible/src/mac/HTMLTableAccessibleWrap.h => accessible/mac/HTMLTableAccessibleWrap.h
rename : accessible/src/mac/HyperTextAccessibleWrap.h => accessible/mac/HyperTextAccessibleWrap.h
rename : accessible/src/mac/ImageAccessibleWrap.h => accessible/mac/ImageAccessibleWrap.h
rename : accessible/src/mac/MacUtils.h => accessible/mac/MacUtils.h
rename : accessible/src/mac/MacUtils.mm => accessible/mac/MacUtils.mm
rename : accessible/src/mac/Platform.mm => accessible/mac/Platform.mm
rename : accessible/src/mac/RootAccessibleWrap.h => accessible/mac/RootAccessibleWrap.h
rename : accessible/src/mac/RootAccessibleWrap.mm => accessible/mac/RootAccessibleWrap.mm
rename : accessible/src/mac/TextLeafAccessibleWrap.h => accessible/mac/TextLeafAccessibleWrap.h
rename : accessible/src/mac/XULListboxAccessibleWrap.h => accessible/mac/XULListboxAccessibleWrap.h
rename : accessible/src/mac/XULMenuAccessibleWrap.h => accessible/mac/XULMenuAccessibleWrap.h
rename : accessible/src/mac/XULTreeGridAccessibleWrap.h => accessible/mac/XULTreeGridAccessibleWrap.h
rename : accessible/src/mac/moz.build => accessible/mac/moz.build
rename : accessible/src/mac/mozAccessible.h => accessible/mac/mozAccessible.h
rename : accessible/src/mac/mozAccessible.mm => accessible/mac/mozAccessible.mm
rename : accessible/src/mac/mozAccessibleProtocol.h => accessible/mac/mozAccessibleProtocol.h
rename : accessible/src/mac/mozActionElements.h => accessible/mac/mozActionElements.h
rename : accessible/src/mac/mozActionElements.mm => accessible/mac/mozActionElements.mm
rename : accessible/src/mac/mozDocAccessible.h => accessible/mac/mozDocAccessible.h
rename : accessible/src/mac/mozDocAccessible.mm => accessible/mac/mozDocAccessible.mm
rename : accessible/src/mac/mozHTMLAccessible.h => accessible/mac/mozHTMLAccessible.h
rename : accessible/src/mac/mozHTMLAccessible.mm => accessible/mac/mozHTMLAccessible.mm
rename : accessible/src/mac/mozTextAccessible.h => accessible/mac/mozTextAccessible.h
rename : accessible/src/mac/mozTextAccessible.mm => accessible/mac/mozTextAccessible.mm
rename : accessible/src/other/ARIAGridAccessibleWrap.h => accessible/other/ARIAGridAccessibleWrap.h
rename : accessible/src/other/AccessibleWrap.cpp => accessible/other/AccessibleWrap.cpp
rename : accessible/src/other/AccessibleWrap.h => accessible/other/AccessibleWrap.h
rename : accessible/src/other/ApplicationAccessibleWrap.h => accessible/other/ApplicationAccessibleWrap.h
rename : accessible/src/other/DocAccessibleWrap.h => accessible/other/DocAccessibleWrap.h
rename : accessible/src/other/HTMLTableAccessibleWrap.h => accessible/other/HTMLTableAccessibleWrap.h
rename : accessible/src/other/HyperTextAccessibleWrap.h => accessible/other/HyperTextAccessibleWrap.h
rename : accessible/src/other/ImageAccessibleWrap.h => accessible/other/ImageAccessibleWrap.h
rename : accessible/src/other/Platform.cpp => accessible/other/Platform.cpp
rename : accessible/src/other/RootAccessibleWrap.h => accessible/other/RootAccessibleWrap.h
rename : accessible/src/other/TextLeafAccessibleWrap.h => accessible/other/TextLeafAccessibleWrap.h
rename : accessible/src/other/XULListboxAccessibleWrap.h => accessible/other/XULListboxAccessibleWrap.h
rename : accessible/src/other/XULMenuAccessibleWrap.h => accessible/other/XULMenuAccessibleWrap.h
rename : accessible/src/other/XULTreeGridAccessibleWrap.h => accessible/other/XULTreeGridAccessibleWrap.h
rename : accessible/src/other/moz.build => accessible/other/moz.build
rename : accessible/src/windows/ia2/Makefile.in => accessible/windows/ia2/Makefile.in
rename : accessible/src/windows/ia2/ia2Accessible.cpp => accessible/windows/ia2/ia2Accessible.cpp
rename : accessible/src/windows/ia2/ia2Accessible.h => accessible/windows/ia2/ia2Accessible.h
rename : accessible/src/windows/ia2/ia2AccessibleAction.cpp => accessible/windows/ia2/ia2AccessibleAction.cpp
rename : accessible/src/windows/ia2/ia2AccessibleAction.h => accessible/windows/ia2/ia2AccessibleAction.h
rename : accessible/src/windows/ia2/ia2AccessibleComponent.cpp => accessible/windows/ia2/ia2AccessibleComponent.cpp
rename : accessible/src/windows/ia2/ia2AccessibleComponent.h => accessible/windows/ia2/ia2AccessibleComponent.h
rename : accessible/src/windows/ia2/ia2AccessibleEditableText.cpp => accessible/windows/ia2/ia2AccessibleEditableText.cpp
rename : accessible/src/windows/ia2/ia2AccessibleEditableText.h => accessible/windows/ia2/ia2AccessibleEditableText.h
rename : accessible/src/windows/ia2/ia2AccessibleHyperlink.cpp => accessible/windows/ia2/ia2AccessibleHyperlink.cpp
rename : accessible/src/windows/ia2/ia2AccessibleHyperlink.h => accessible/windows/ia2/ia2AccessibleHyperlink.h
rename : accessible/src/windows/ia2/ia2AccessibleHypertext.cpp => accessible/windows/ia2/ia2AccessibleHypertext.cpp
rename : accessible/src/windows/ia2/ia2AccessibleHypertext.h => accessible/windows/ia2/ia2AccessibleHypertext.h
rename : accessible/src/windows/ia2/ia2AccessibleImage.cpp => accessible/windows/ia2/ia2AccessibleImage.cpp
rename : accessible/src/windows/ia2/ia2AccessibleImage.h => accessible/windows/ia2/ia2AccessibleImage.h
rename : accessible/src/windows/ia2/ia2AccessibleRelation.cpp => accessible/windows/ia2/ia2AccessibleRelation.cpp
rename : accessible/src/windows/ia2/ia2AccessibleRelation.h => accessible/windows/ia2/ia2AccessibleRelation.h
rename : accessible/src/windows/ia2/ia2AccessibleTable.cpp => accessible/windows/ia2/ia2AccessibleTable.cpp
rename : accessible/src/windows/ia2/ia2AccessibleTable.h => accessible/windows/ia2/ia2AccessibleTable.h
rename : accessible/src/windows/ia2/ia2AccessibleTableCell.cpp => accessible/windows/ia2/ia2AccessibleTableCell.cpp
rename : accessible/src/windows/ia2/ia2AccessibleTableCell.h => accessible/windows/ia2/ia2AccessibleTableCell.h
rename : accessible/src/windows/ia2/ia2AccessibleText.cpp => accessible/windows/ia2/ia2AccessibleText.cpp
rename : accessible/src/windows/ia2/ia2AccessibleText.h => accessible/windows/ia2/ia2AccessibleText.h
rename : accessible/src/windows/ia2/ia2AccessibleValue.cpp => accessible/windows/ia2/ia2AccessibleValue.cpp
rename : accessible/src/windows/ia2/ia2AccessibleValue.h => accessible/windows/ia2/ia2AccessibleValue.h
rename : accessible/src/windows/ia2/moz.build => accessible/windows/ia2/moz.build
rename : accessible/src/windows/moz.build => accessible/windows/moz.build
rename : accessible/src/windows/msaa/ARIAGridAccessibleWrap.cpp => accessible/windows/msaa/ARIAGridAccessibleWrap.cpp
rename : accessible/src/windows/msaa/ARIAGridAccessibleWrap.h => accessible/windows/msaa/ARIAGridAccessibleWrap.h
rename : accessible/src/windows/msaa/AccessibleWrap.cpp => accessible/windows/msaa/AccessibleWrap.cpp
rename : accessible/src/windows/msaa/AccessibleWrap.h => accessible/windows/msaa/AccessibleWrap.h
rename : accessible/src/windows/msaa/ApplicationAccessibleWrap.cpp => accessible/windows/msaa/ApplicationAccessibleWrap.cpp
rename : accessible/src/windows/msaa/ApplicationAccessibleWrap.h => accessible/windows/msaa/ApplicationAccessibleWrap.h
rename : accessible/src/windows/msaa/Compatibility.cpp => accessible/windows/msaa/Compatibility.cpp
rename : accessible/src/windows/msaa/Compatibility.h => accessible/windows/msaa/Compatibility.h
rename : accessible/src/windows/msaa/DocAccessibleWrap.cpp => accessible/windows/msaa/DocAccessibleWrap.cpp
rename : accessible/src/windows/msaa/DocAccessibleWrap.h => accessible/windows/msaa/DocAccessibleWrap.h
rename : accessible/src/windows/msaa/EnumVariant.cpp => accessible/windows/msaa/EnumVariant.cpp
rename : accessible/src/windows/msaa/EnumVariant.h => accessible/windows/msaa/EnumVariant.h
rename : accessible/src/windows/msaa/HTMLTableAccessibleWrap.cpp => accessible/windows/msaa/HTMLTableAccessibleWrap.cpp
rename : accessible/src/windows/msaa/HTMLTableAccessibleWrap.h => accessible/windows/msaa/HTMLTableAccessibleWrap.h
rename : accessible/src/windows/msaa/HTMLWin32ObjectAccessible.cpp => accessible/windows/msaa/HTMLWin32ObjectAccessible.cpp
rename : accessible/src/windows/msaa/HTMLWin32ObjectAccessible.h => accessible/windows/msaa/HTMLWin32ObjectAccessible.h
rename : accessible/src/windows/msaa/HyperTextAccessibleWrap.cpp => accessible/windows/msaa/HyperTextAccessibleWrap.cpp
rename : accessible/src/windows/msaa/HyperTextAccessibleWrap.h => accessible/windows/msaa/HyperTextAccessibleWrap.h
rename : accessible/src/windows/msaa/IUnknownImpl.cpp => accessible/windows/msaa/IUnknownImpl.cpp
rename : accessible/src/windows/msaa/IUnknownImpl.h => accessible/windows/msaa/IUnknownImpl.h
rename : accessible/src/windows/msaa/ImageAccessibleWrap.cpp => accessible/windows/msaa/ImageAccessibleWrap.cpp
rename : accessible/src/windows/msaa/ImageAccessibleWrap.h => accessible/windows/msaa/ImageAccessibleWrap.h
rename : accessible/src/windows/msaa/Platform.cpp => accessible/windows/msaa/Platform.cpp
rename : accessible/src/windows/msaa/RootAccessibleWrap.cpp => accessible/windows/msaa/RootAccessibleWrap.cpp
rename : accessible/src/windows/msaa/RootAccessibleWrap.h => accessible/windows/msaa/RootAccessibleWrap.h
rename : accessible/src/windows/msaa/ServiceProvider.cpp => accessible/windows/msaa/ServiceProvider.cpp
rename : accessible/src/windows/msaa/ServiceProvider.h => accessible/windows/msaa/ServiceProvider.h
rename : accessible/src/windows/msaa/TextLeafAccessibleWrap.cpp => accessible/windows/msaa/TextLeafAccessibleWrap.cpp
rename : accessible/src/windows/msaa/TextLeafAccessibleWrap.h => accessible/windows/msaa/TextLeafAccessibleWrap.h
rename : accessible/src/windows/msaa/XULListboxAccessibleWrap.cpp => accessible/windows/msaa/XULListboxAccessibleWrap.cpp
rename : accessible/src/windows/msaa/XULListboxAccessibleWrap.h => accessible/windows/msaa/XULListboxAccessibleWrap.h
rename : accessible/src/windows/msaa/XULMenuAccessibleWrap.cpp => accessible/windows/msaa/XULMenuAccessibleWrap.cpp
rename : accessible/src/windows/msaa/XULMenuAccessibleWrap.h => accessible/windows/msaa/XULMenuAccessibleWrap.h
rename : accessible/src/windows/msaa/XULTreeGridAccessibleWrap.cpp => accessible/windows/msaa/XULTreeGridAccessibleWrap.cpp
rename : accessible/src/windows/msaa/XULTreeGridAccessibleWrap.h => accessible/windows/msaa/XULTreeGridAccessibleWrap.h
rename : accessible/src/windows/msaa/moz.build => accessible/windows/msaa/moz.build
rename : accessible/src/windows/msaa/nsEventMap.h => accessible/windows/msaa/nsEventMap.h
rename : accessible/src/windows/msaa/nsWinUtils.cpp => accessible/windows/msaa/nsWinUtils.cpp
rename : accessible/src/windows/msaa/nsWinUtils.h => accessible/windows/msaa/nsWinUtils.h
rename : accessible/src/windows/sdn/moz.build => accessible/windows/sdn/moz.build
rename : accessible/src/windows/sdn/sdnAccessible-inl.h => accessible/windows/sdn/sdnAccessible-inl.h
rename : accessible/src/windows/sdn/sdnAccessible.cpp => accessible/windows/sdn/sdnAccessible.cpp
rename : accessible/src/windows/sdn/sdnAccessible.h => accessible/windows/sdn/sdnAccessible.h
rename : accessible/src/windows/sdn/sdnDocAccessible.cpp => accessible/windows/sdn/sdnDocAccessible.cpp
rename : accessible/src/windows/sdn/sdnDocAccessible.h => accessible/windows/sdn/sdnDocAccessible.h
rename : accessible/src/windows/sdn/sdnTextAccessible.cpp => accessible/windows/sdn/sdnTextAccessible.cpp
rename : accessible/src/windows/sdn/sdnTextAccessible.h => accessible/windows/sdn/sdnTextAccessible.h
rename : accessible/src/windows/uia/Makefile.in => accessible/windows/uia/Makefile.in
rename : accessible/src/windows/uia/moz.build => accessible/windows/uia/moz.build
rename : accessible/src/windows/uia/uiaRawElmProvider.cpp => accessible/windows/uia/uiaRawElmProvider.cpp
rename : accessible/src/windows/uia/uiaRawElmProvider.h => accessible/windows/uia/uiaRawElmProvider.h
rename : accessible/src/xpcom/AccEventGen.py => accessible/xpcom/AccEventGen.py
rename : accessible/src/xpcom/AccEvents.conf => accessible/xpcom/AccEvents.conf
rename : accessible/src/xpcom/Makefile.in => accessible/xpcom/Makefile.in
rename : accessible/src/xpcom/moz.build => accessible/xpcom/moz.build
rename : accessible/src/xpcom/nsAccessibleRelation.cpp => accessible/xpcom/nsAccessibleRelation.cpp
rename : accessible/src/xpcom/nsAccessibleRelation.h => accessible/xpcom/nsAccessibleRelation.h
rename : accessible/src/xpcom/xpcAccessibleHyperText.cpp => accessible/xpcom/xpcAccessibleHyperText.cpp
rename : accessible/src/xpcom/xpcAccessibleHyperText.h => accessible/xpcom/xpcAccessibleHyperText.h
rename : accessible/src/xpcom/xpcAccessibleSelectable.cpp => accessible/xpcom/xpcAccessibleSelectable.cpp
rename : accessible/src/xpcom/xpcAccessibleSelectable.h => accessible/xpcom/xpcAccessibleSelectable.h
rename : accessible/src/xpcom/xpcAccessibleTable.cpp => accessible/xpcom/xpcAccessibleTable.cpp
rename : accessible/src/xpcom/xpcAccessibleTable.h => accessible/xpcom/xpcAccessibleTable.h
rename : accessible/src/xpcom/xpcAccessibleTableCell.cpp => accessible/xpcom/xpcAccessibleTableCell.cpp
rename : accessible/src/xpcom/xpcAccessibleTableCell.h => accessible/xpcom/xpcAccessibleTableCell.h
rename : accessible/src/xpcom/xpcAccessibleTextRange.cpp => accessible/xpcom/xpcAccessibleTextRange.cpp
rename : accessible/src/xpcom/xpcAccessibleTextRange.h => accessible/xpcom/xpcAccessibleTextRange.h
rename : accessible/src/xpcom/xpcAccessibleValue.cpp => accessible/xpcom/xpcAccessibleValue.cpp
rename : accessible/src/xpcom/xpcAccessibleValue.h => accessible/xpcom/xpcAccessibleValue.h
rename : accessible/src/xul/XULAlertAccessible.cpp => accessible/xul/XULAlertAccessible.cpp
rename : accessible/src/xul/XULAlertAccessible.h => accessible/xul/XULAlertAccessible.h
rename : accessible/src/xul/XULColorPickerAccessible.cpp => accessible/xul/XULColorPickerAccessible.cpp
rename : accessible/src/xul/XULColorPickerAccessible.h => accessible/xul/XULColorPickerAccessible.h
rename : accessible/src/xul/XULComboboxAccessible.cpp => accessible/xul/XULComboboxAccessible.cpp
rename : accessible/src/xul/XULComboboxAccessible.h => accessible/xul/XULComboboxAccessible.h
rename : accessible/src/xul/XULElementAccessibles.cpp => accessible/xul/XULElementAccessibles.cpp
rename : accessible/src/xul/XULElementAccessibles.h => accessible/xul/XULElementAccessibles.h
rename : accessible/src/xul/XULFormControlAccessible.cpp => accessible/xul/XULFormControlAccessible.cpp
rename : accessible/src/xul/XULFormControlAccessible.h => accessible/xul/XULFormControlAccessible.h
rename : accessible/src/xul/XULListboxAccessible.cpp => accessible/xul/XULListboxAccessible.cpp
rename : accessible/src/xul/XULListboxAccessible.h => accessible/xul/XULListboxAccessible.h
rename : accessible/src/xul/XULMenuAccessible.cpp => accessible/xul/XULMenuAccessible.cpp
rename : accessible/src/xul/XULMenuAccessible.h => accessible/xul/XULMenuAccessible.h
rename : accessible/src/xul/XULSelectControlAccessible.cpp => accessible/xul/XULSelectControlAccessible.cpp
rename : accessible/src/xul/XULSelectControlAccessible.h => accessible/xul/XULSelectControlAccessible.h
rename : accessible/src/xul/XULSliderAccessible.cpp => accessible/xul/XULSliderAccessible.cpp
rename : accessible/src/xul/XULSliderAccessible.h => accessible/xul/XULSliderAccessible.h
rename : accessible/src/xul/XULTabAccessible.cpp => accessible/xul/XULTabAccessible.cpp
rename : accessible/src/xul/XULTabAccessible.h => accessible/xul/XULTabAccessible.h
rename : accessible/src/xul/XULTreeAccessible.cpp => accessible/xul/XULTreeAccessible.cpp
rename : accessible/src/xul/XULTreeAccessible.h => accessible/xul/XULTreeAccessible.h
rename : accessible/src/xul/XULTreeGridAccessible.cpp => accessible/xul/XULTreeGridAccessible.cpp
rename : accessible/src/xul/XULTreeGridAccessible.h => accessible/xul/XULTreeGridAccessible.h
rename : accessible/src/xul/moz.build => accessible/xul/moz.build
2014-06-22 10:15:19 -07:00

1756 lines
56 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsAccessibilityService.h"
// NOTE: alphabetically ordered
#include "ApplicationAccessibleWrap.h"
#include "ARIAGridAccessibleWrap.h"
#include "ARIAMap.h"
#include "DocAccessible-inl.h"
#include "FocusManager.h"
#include "HTMLCanvasAccessible.h"
#include "HTMLElementAccessibles.h"
#include "HTMLImageMapAccessible.h"
#include "HTMLLinkAccessible.h"
#include "HTMLListAccessible.h"
#include "HTMLSelectAccessible.h"
#include "HTMLTableAccessibleWrap.h"
#include "HyperTextAccessibleWrap.h"
#include "RootAccessible.h"
#include "nsAccessiblePivot.h"
#include "nsAccUtils.h"
#include "nsAttrName.h"
#include "nsEventShell.h"
#include "nsIURI.h"
#include "OuterDocAccessible.h"
#include "Platform.h"
#include "Role.h"
#ifdef MOZ_ACCESSIBILITY_ATK
#include "RootAccessibleWrap.h"
#endif
#include "States.h"
#include "Statistics.h"
#include "TextLeafAccessibleWrap.h"
#ifdef MOZ_ACCESSIBILITY_ATK
#include "AtkSocketAccessible.h"
#endif
#ifdef XP_WIN
#include "mozilla/a11y/Compatibility.h"
#include "HTMLWin32ObjectAccessible.h"
#include "mozilla/StaticPtr.h"
#endif
#ifdef A11Y_LOG
#include "Logging.h"
#endif
#ifdef MOZ_CRASHREPORTER
#include "nsExceptionHandler.h"
#endif
#include "nsImageFrame.h"
#include "nsIObserverService.h"
#include "nsLayoutUtils.h"
#include "nsObjectFrame.h"
#include "nsSVGPathGeometryFrame.h"
#include "nsTreeBodyFrame.h"
#include "nsTreeColumns.h"
#include "nsTreeUtils.h"
#include "nsXBLPrototypeBinding.h"
#include "nsXBLBinding.h"
#include "mozilla/ArrayUtils.h"
#include "mozilla/dom/DOMStringList.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "nsDeckFrame.h"
#ifdef MOZ_XUL
#include "XULAlertAccessible.h"
#include "XULColorPickerAccessible.h"
#include "XULComboboxAccessible.h"
#include "XULElementAccessibles.h"
#include "XULFormControlAccessible.h"
#include "XULListboxAccessibleWrap.h"
#include "XULMenuAccessibleWrap.h"
#include "XULSliderAccessible.h"
#include "XULTabAccessible.h"
#include "XULTreeGridAccessibleWrap.h"
#endif
#if defined(XP_WIN) || defined(MOZ_ACCESSIBILITY_ATK)
#include "nsNPAPIPluginInstance.h"
#endif
using namespace mozilla;
using namespace mozilla::a11y;
using namespace mozilla::dom;
////////////////////////////////////////////////////////////////////////////////
// Statics
////////////////////////////////////////////////////////////////////////////////
/**
* Return true if the element must be accessible.
*/
static bool
MustBeAccessible(nsIContent* aContent, DocAccessible* aDocument)
{
if (aContent->GetPrimaryFrame()->IsFocusable())
return true;
uint32_t attrCount = aContent->GetAttrCount();
for (uint32_t attrIdx = 0; attrIdx < attrCount; attrIdx++) {
const nsAttrName* attr = aContent->GetAttrNameAt(attrIdx);
if (attr->NamespaceEquals(kNameSpaceID_None)) {
nsIAtom* attrAtom = attr->Atom();
nsDependentAtomString attrStr(attrAtom);
if (!StringBeginsWith(attrStr, NS_LITERAL_STRING("aria-")))
continue; // not ARIA
// A global state or a property and in case of token defined.
uint8_t attrFlags = aria::AttrCharacteristicsFor(attrAtom);
if ((attrFlags & ATTR_GLOBAL) && (!(attrFlags & ATTR_VALTOKEN) ||
nsAccUtils::HasDefinedARIAToken(aContent, attrAtom))) {
return true;
}
}
}
// If the given ID is referred by relation attribute then create an accessible
// for it.
nsAutoString id;
if (nsCoreUtils::GetID(aContent, id) && !id.IsEmpty())
return aDocument->IsDependentID(id);
return false;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccessibilityService
////////////////////////////////////////////////////////////////////////////////
nsAccessibilityService *nsAccessibilityService::gAccessibilityService = nullptr;
ApplicationAccessible* nsAccessibilityService::gApplicationAccessible = nullptr;
bool nsAccessibilityService::gIsShutdown = true;
nsAccessibilityService::nsAccessibilityService() :
DocManager(), FocusManager()
{
}
nsAccessibilityService::~nsAccessibilityService()
{
NS_ASSERTION(gIsShutdown, "Accessibility wasn't shutdown!");
gAccessibilityService = nullptr;
}
////////////////////////////////////////////////////////////////////////////////
// nsISupports
NS_IMPL_ISUPPORTS_INHERITED(nsAccessibilityService,
DocManager,
nsIAccessibilityService,
nsIAccessibleRetrieval,
nsIObserver,
nsISelectionListener) // from SelectionManager
////////////////////////////////////////////////////////////////////////////////
// nsIObserver
NS_IMETHODIMP
nsAccessibilityService::Observe(nsISupports *aSubject, const char *aTopic,
const char16_t *aData)
{
if (!nsCRT::strcmp(aTopic, NS_XPCOM_SHUTDOWN_OBSERVER_ID))
Shutdown();
return NS_OK;
}
// nsIAccessibilityService
void
nsAccessibilityService::NotifyOfAnchorJumpTo(nsIContent* aTargetNode)
{
nsIDocument* documentNode = aTargetNode->GetCurrentDoc();
if (documentNode) {
DocAccessible* document = GetDocAccessible(documentNode);
if (document)
document->SetAnchorJump(aTargetNode);
}
}
// nsIAccessibilityService
void
nsAccessibilityService::FireAccessibleEvent(uint32_t aEvent,
Accessible* aTarget)
{
nsEventShell::FireEvent(aEvent, aTarget);
}
////////////////////////////////////////////////////////////////////////////////
// nsIAccessibilityService
Accessible*
nsAccessibilityService::GetRootDocumentAccessible(nsIPresShell* aPresShell,
bool aCanCreate)
{
nsIPresShell* ps = aPresShell;
nsIDocument* documentNode = aPresShell->GetDocument();
if (documentNode) {
nsCOMPtr<nsIDocShellTreeItem> treeItem(documentNode->GetDocShell());
if (treeItem) {
nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
if (treeItem != rootTreeItem) {
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(rootTreeItem));
ps = docShell->GetPresShell();
}
return aCanCreate ? GetDocAccessible(ps) : ps->GetDocAccessible();
}
}
return nullptr;
}
#ifdef XP_WIN
static StaticAutoPtr<nsTArray<nsCOMPtr<nsIContent> > > sPendingPlugins;
static StaticAutoPtr<nsTArray<nsCOMPtr<nsITimer> > > sPluginTimers;
class PluginTimerCallBack MOZ_FINAL : public nsITimerCallback
{
public:
PluginTimerCallBack(nsIContent* aContent) : mContent(aContent) {}
NS_DECL_ISUPPORTS
NS_IMETHODIMP Notify(nsITimer* aTimer) MOZ_FINAL
{
if (!mContent->IsInDoc())
return NS_OK;
nsIPresShell* ps = mContent->OwnerDoc()->GetShell();
if (ps) {
DocAccessible* doc = ps->GetDocAccessible();
if (doc) {
// Make sure that if we created an accessible for the plugin that wasn't
// a plugin accessible we remove it before creating the right accessible.
doc->RecreateAccessible(mContent);
sPluginTimers->RemoveElement(aTimer);
return NS_OK;
}
}
// We couldn't get a doc accessible so presumably the document went away.
// In this case don't leak our ref to the content or timer.
sPendingPlugins->RemoveElement(mContent);
sPluginTimers->RemoveElement(aTimer);
return NS_OK;
}
private:
nsCOMPtr<nsIContent> mContent;
};
NS_IMPL_ISUPPORTS(PluginTimerCallBack, nsITimerCallback)
#endif
already_AddRefed<Accessible>
nsAccessibilityService::CreatePluginAccessible(nsObjectFrame* aFrame,
nsIContent* aContent,
Accessible* aContext)
{
// nsObjectFrame means a plugin, so we need to use the accessibility support
// of the plugin.
if (aFrame->GetRect().IsEmpty())
return nullptr;
#if defined(XP_WIN) || defined(MOZ_ACCESSIBILITY_ATK)
nsRefPtr<nsNPAPIPluginInstance> pluginInstance;
if (NS_SUCCEEDED(aFrame->GetPluginInstance(getter_AddRefs(pluginInstance))) &&
pluginInstance) {
#ifdef XP_WIN
if (!sPendingPlugins->Contains(aContent) &&
(Preferences::GetBool("accessibility.delay_plugins") ||
Compatibility::IsJAWS() || Compatibility::IsWE())) {
nsCOMPtr<nsITimer> timer = do_CreateInstance(NS_TIMER_CONTRACTID);
nsRefPtr<PluginTimerCallBack> cb = new PluginTimerCallBack(aContent);
timer->InitWithCallback(cb, Preferences::GetUint("accessibility.delay_plugin_time"),
nsITimer::TYPE_ONE_SHOT);
sPluginTimers->AppendElement(timer);
sPendingPlugins->AppendElement(aContent);
return nullptr;
}
// We need to remove aContent from the pending plugins here to avoid
// reentrancy. When the timer fires it calls
// DocAccessible::ContentInserted() which does the work async.
sPendingPlugins->RemoveElement(aContent);
// Note: pluginPort will be null if windowless.
HWND pluginPort = nullptr;
aFrame->GetPluginPort(&pluginPort);
nsRefPtr<Accessible> accessible =
new HTMLWin32ObjectOwnerAccessible(aContent, aContext->Document(),
pluginPort);
return accessible.forget();
#elif MOZ_ACCESSIBILITY_ATK
if (!AtkSocketAccessible::gCanEmbed)
return nullptr;
// Note this calls into the plugin, so crazy things may happen and aFrame
// may go away.
nsCString plugId;
nsresult rv = pluginInstance->GetValueFromPlugin(
NPPVpluginNativeAccessibleAtkPlugId, &plugId);
if (NS_SUCCEEDED(rv) && !plugId.IsEmpty()) {
nsRefPtr<AtkSocketAccessible> socketAccessible =
new AtkSocketAccessible(aContent, aContext->Document(), plugId);
return socketAccessible.forget();
}
#endif
}
#endif
return nullptr;
}
void
nsAccessibilityService::DeckPanelSwitched(nsIPresShell* aPresShell,
nsIContent* aDeckNode,
nsIFrame* aPrevBoxFrame,
nsIFrame* aCurrentBoxFrame)
{
// Ignore tabpanels elements (a deck having an accessible) since their
// children are accessible not depending on selected tab.
DocAccessible* document = GetDocAccessible(aPresShell);
if (!document || document->HasAccessible(aDeckNode))
return;
if (aPrevBoxFrame) {
nsIContent* panelNode = aPrevBoxFrame->GetContent();
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eTree)) {
logging::MsgBegin("TREE", "deck panel unselected");
logging::Node("container", panelNode);
logging::Node("content", aDeckNode);
logging::MsgEnd();
}
#endif
document->ContentRemoved(aDeckNode, panelNode);
}
if (aCurrentBoxFrame) {
nsIContent* panelNode = aCurrentBoxFrame->GetContent();
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eTree)) {
logging::MsgBegin("TREE", "deck panel selected");
logging::Node("container", panelNode);
logging::Node("content", aDeckNode);
logging::MsgEnd();
}
#endif
document->ContentInserted(aDeckNode, panelNode, panelNode->GetNextSibling());
}
}
void
nsAccessibilityService::ContentRangeInserted(nsIPresShell* aPresShell,
nsIContent* aContainer,
nsIContent* aStartChild,
nsIContent* aEndChild)
{
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eTree)) {
logging::MsgBegin("TREE", "content inserted");
logging::Node("container", aContainer);
for (nsIContent* child = aStartChild; child != aEndChild;
child = child->GetNextSibling()) {
logging::Node("content", child);
}
logging::MsgEnd();
logging::Stack();
}
#endif
DocAccessible* docAccessible = GetDocAccessible(aPresShell);
if (docAccessible)
docAccessible->ContentInserted(aContainer, aStartChild, aEndChild);
}
void
nsAccessibilityService::ContentRemoved(nsIPresShell* aPresShell,
nsIContent* aContainer,
nsIContent* aChild)
{
#ifdef A11Y_LOG
if (logging::IsEnabled(logging::eTree)) {
logging::MsgBegin("TREE", "content removed");
logging::Node("container", aContainer);
logging::Node("content", aChild);
logging::MsgEnd();
logging::Stack();
}
#endif
DocAccessible* docAccessible = GetDocAccessible(aPresShell);
if (docAccessible)
docAccessible->ContentRemoved(aContainer, aChild);
}
void
nsAccessibilityService::UpdateText(nsIPresShell* aPresShell,
nsIContent* aContent)
{
DocAccessible* document = GetDocAccessible(aPresShell);
if (document)
document->UpdateText(aContent);
}
void
nsAccessibilityService::TreeViewChanged(nsIPresShell* aPresShell,
nsIContent* aContent,
nsITreeView* aView)
{
DocAccessible* document = GetDocAccessible(aPresShell);
if (document) {
Accessible* accessible = document->GetAccessible(aContent);
if (accessible) {
XULTreeAccessible* treeAcc = accessible->AsXULTree();
if (treeAcc)
treeAcc->TreeViewChanged(aView);
}
}
}
void
nsAccessibilityService::RangeValueChanged(nsIPresShell* aPresShell,
nsIContent* aContent)
{
DocAccessible* document = GetDocAccessible(aPresShell);
if (document) {
Accessible* accessible = document->GetAccessible(aContent);
if (accessible) {
document->FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
accessible);
}
}
}
void
nsAccessibilityService::UpdateListBullet(nsIPresShell* aPresShell,
nsIContent* aHTMLListItemContent,
bool aHasBullet)
{
DocAccessible* document = GetDocAccessible(aPresShell);
if (document) {
Accessible* accessible = document->GetAccessible(aHTMLListItemContent);
if (accessible) {
HTMLLIAccessible* listItem = accessible->AsHTMLListItem();
if (listItem)
listItem->UpdateBullet(aHasBullet);
}
}
}
void
nsAccessibilityService::UpdateImageMap(nsImageFrame* aImageFrame)
{
nsIPresShell* presShell = aImageFrame->PresContext()->PresShell();
DocAccessible* document = GetDocAccessible(presShell);
if (document) {
Accessible* accessible =
document->GetAccessible(aImageFrame->GetContent());
if (accessible) {
HTMLImageMapAccessible* imageMap = accessible->AsImageMap();
if (imageMap) {
imageMap->UpdateChildAreas();
return;
}
// If image map was initialized after we created an accessible (that'll
// be an image accessible) then recreate it.
RecreateAccessible(presShell, aImageFrame->GetContent());
}
}
}
void
nsAccessibilityService::UpdateLabelValue(nsIPresShell* aPresShell,
nsIContent* aLabelElm,
const nsString& aNewValue)
{
DocAccessible* document = GetDocAccessible(aPresShell);
if (document) {
Accessible* accessible = document->GetAccessible(aLabelElm);
if (accessible) {
XULLabelAccessible* xulLabel = accessible->AsXULLabel();
NS_ASSERTION(xulLabel,
"UpdateLabelValue was called for wrong accessible!");
if (xulLabel)
xulLabel->UpdateLabelValue(aNewValue);
}
}
}
void
nsAccessibilityService::PresShellActivated(nsIPresShell* aPresShell)
{
DocAccessible* document = aPresShell->GetDocAccessible();
if (document) {
RootAccessible* rootDocument = document->RootAccessible();
NS_ASSERTION(rootDocument, "Entirely broken tree: no root document!");
if (rootDocument)
rootDocument->DocumentActivated(document);
}
}
void
nsAccessibilityService::RecreateAccessible(nsIPresShell* aPresShell,
nsIContent* aContent)
{
DocAccessible* document = GetDocAccessible(aPresShell);
if (document)
document->RecreateAccessible(aContent);
}
////////////////////////////////////////////////////////////////////////////////
// nsIAccessibleRetrieval
NS_IMETHODIMP
nsAccessibilityService::GetApplicationAccessible(nsIAccessible** aAccessibleApplication)
{
NS_ENSURE_ARG_POINTER(aAccessibleApplication);
NS_IF_ADDREF(*aAccessibleApplication = ApplicationAcc());
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::GetAccessibleFor(nsIDOMNode *aNode,
nsIAccessible **aAccessible)
{
NS_ENSURE_ARG_POINTER(aAccessible);
*aAccessible = nullptr;
if (!aNode)
return NS_OK;
nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
if (!node)
return NS_ERROR_INVALID_ARG;
DocAccessible* document = GetDocAccessible(node->OwnerDoc());
if (document)
NS_IF_ADDREF(*aAccessible = document->GetAccessible(node));
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::GetStringRole(uint32_t aRole, nsAString& aString)
{
#define ROLE(geckoRole, stringRole, atkRole, \
macRole, msaaRole, ia2Role, nameRule) \
case roles::geckoRole: \
CopyUTF8toUTF16(stringRole, aString); \
return NS_OK;
switch (aRole) {
#include "RoleMap.h"
default:
aString.AssignLiteral("unknown");
return NS_OK;
}
#undef ROLE
}
NS_IMETHODIMP
nsAccessibilityService::GetStringStates(uint32_t aState, uint32_t aExtraState,
nsISupports **aStringStates)
{
nsRefPtr<DOMStringList> stringStates = new DOMStringList();
uint64_t state = nsAccUtils::To64State(aState, aExtraState);
// states
if (state & states::UNAVAILABLE)
stringStates->Add(NS_LITERAL_STRING("unavailable"));
if (state & states::SELECTED)
stringStates->Add(NS_LITERAL_STRING("selected"));
if (state & states::FOCUSED)
stringStates->Add(NS_LITERAL_STRING("focused"));
if (state & states::PRESSED)
stringStates->Add(NS_LITERAL_STRING("pressed"));
if (state & states::CHECKED)
stringStates->Add(NS_LITERAL_STRING("checked"));
if (state & states::MIXED)
stringStates->Add(NS_LITERAL_STRING("mixed"));
if (state & states::READONLY)
stringStates->Add(NS_LITERAL_STRING("readonly"));
if (state & states::HOTTRACKED)
stringStates->Add(NS_LITERAL_STRING("hottracked"));
if (state & states::DEFAULT)
stringStates->Add(NS_LITERAL_STRING("default"));
if (state & states::EXPANDED)
stringStates->Add(NS_LITERAL_STRING("expanded"));
if (state & states::COLLAPSED)
stringStates->Add(NS_LITERAL_STRING("collapsed"));
if (state & states::BUSY)
stringStates->Add(NS_LITERAL_STRING("busy"));
if (state & states::FLOATING)
stringStates->Add(NS_LITERAL_STRING("floating"));
if (state & states::ANIMATED)
stringStates->Add(NS_LITERAL_STRING("animated"));
if (state & states::INVISIBLE)
stringStates->Add(NS_LITERAL_STRING("invisible"));
if (state & states::OFFSCREEN)
stringStates->Add(NS_LITERAL_STRING("offscreen"));
if (state & states::SIZEABLE)
stringStates->Add(NS_LITERAL_STRING("sizeable"));
if (state & states::MOVEABLE)
stringStates->Add(NS_LITERAL_STRING("moveable"));
if (state & states::SELFVOICING)
stringStates->Add(NS_LITERAL_STRING("selfvoicing"));
if (state & states::FOCUSABLE)
stringStates->Add(NS_LITERAL_STRING("focusable"));
if (state & states::SELECTABLE)
stringStates->Add(NS_LITERAL_STRING("selectable"));
if (state & states::LINKED)
stringStates->Add(NS_LITERAL_STRING("linked"));
if (state & states::TRAVERSED)
stringStates->Add(NS_LITERAL_STRING("traversed"));
if (state & states::MULTISELECTABLE)
stringStates->Add(NS_LITERAL_STRING("multiselectable"));
if (state & states::EXTSELECTABLE)
stringStates->Add(NS_LITERAL_STRING("extselectable"));
if (state & states::PROTECTED)
stringStates->Add(NS_LITERAL_STRING("protected"));
if (state & states::HASPOPUP)
stringStates->Add(NS_LITERAL_STRING("haspopup"));
if (state & states::REQUIRED)
stringStates->Add(NS_LITERAL_STRING("required"));
if (state & states::ALERT)
stringStates->Add(NS_LITERAL_STRING("alert"));
if (state & states::INVALID)
stringStates->Add(NS_LITERAL_STRING("invalid"));
if (state & states::CHECKABLE)
stringStates->Add(NS_LITERAL_STRING("checkable"));
// extraStates
if (state & states::SUPPORTS_AUTOCOMPLETION)
stringStates->Add(NS_LITERAL_STRING("autocompletion"));
if (state & states::DEFUNCT)
stringStates->Add(NS_LITERAL_STRING("defunct"));
if (state & states::SELECTABLE_TEXT)
stringStates->Add(NS_LITERAL_STRING("selectable text"));
if (state & states::EDITABLE)
stringStates->Add(NS_LITERAL_STRING("editable"));
if (state & states::ACTIVE)
stringStates->Add(NS_LITERAL_STRING("active"));
if (state & states::MODAL)
stringStates->Add(NS_LITERAL_STRING("modal"));
if (state & states::MULTI_LINE)
stringStates->Add(NS_LITERAL_STRING("multi line"));
if (state & states::HORIZONTAL)
stringStates->Add(NS_LITERAL_STRING("horizontal"));
if (state & states::OPAQUE1)
stringStates->Add(NS_LITERAL_STRING("opaque"));
if (state & states::SINGLE_LINE)
stringStates->Add(NS_LITERAL_STRING("single line"));
if (state & states::TRANSIENT)
stringStates->Add(NS_LITERAL_STRING("transient"));
if (state & states::VERTICAL)
stringStates->Add(NS_LITERAL_STRING("vertical"));
if (state & states::STALE)
stringStates->Add(NS_LITERAL_STRING("stale"));
if (state & states::ENABLED)
stringStates->Add(NS_LITERAL_STRING("enabled"));
if (state & states::SENSITIVE)
stringStates->Add(NS_LITERAL_STRING("sensitive"));
if (state & states::EXPANDABLE)
stringStates->Add(NS_LITERAL_STRING("expandable"));
//unknown states
if (!stringStates->Length())
stringStates->Add(NS_LITERAL_STRING("unknown"));
stringStates.forget(aStringStates);
return NS_OK;
}
// nsIAccessibleRetrieval::getStringEventType()
NS_IMETHODIMP
nsAccessibilityService::GetStringEventType(uint32_t aEventType,
nsAString& aString)
{
NS_ASSERTION(nsIAccessibleEvent::EVENT_LAST_ENTRY == ArrayLength(kEventTypeNames),
"nsIAccessibleEvent constants are out of sync to kEventTypeNames");
if (aEventType >= ArrayLength(kEventTypeNames)) {
aString.AssignLiteral("unknown");
return NS_OK;
}
CopyUTF8toUTF16(kEventTypeNames[aEventType], aString);
return NS_OK;
}
// nsIAccessibleRetrieval::getStringRelationType()
NS_IMETHODIMP
nsAccessibilityService::GetStringRelationType(uint32_t aRelationType,
nsAString& aString)
{
NS_ENSURE_ARG(aRelationType <= static_cast<uint32_t>(RelationType::LAST));
#define RELATIONTYPE(geckoType, geckoTypeName, atkType, msaaType, ia2Type) \
case RelationType::geckoType: \
aString.AssignLiteral(geckoTypeName); \
return NS_OK;
RelationType relationType = static_cast<RelationType>(aRelationType);
switch (relationType) {
#include "RelationTypeMap.h"
default:
aString.AssignLiteral("unknown");
return NS_OK;
}
#undef RELATIONTYPE
}
NS_IMETHODIMP
nsAccessibilityService::GetAccessibleFromCache(nsIDOMNode* aNode,
nsIAccessible** aAccessible)
{
NS_ENSURE_ARG_POINTER(aAccessible);
*aAccessible = nullptr;
if (!aNode)
return NS_OK;
nsCOMPtr<nsINode> node(do_QueryInterface(aNode));
if (!node)
return NS_ERROR_INVALID_ARG;
// Search for an accessible in each of our per document accessible object
// caches. If we don't find it, and the given node is itself a document, check
// our cache of document accessibles (document cache). Note usually shutdown
// document accessibles are not stored in the document cache, however an
// "unofficially" shutdown document (i.e. not from DocManager) can still
// exist in the document cache.
Accessible* accessible = FindAccessibleInCache(node);
if (!accessible) {
nsCOMPtr<nsIDocument> document(do_QueryInterface(node));
if (document)
accessible = GetExistingDocAccessible(document);
}
NS_IF_ADDREF(*aAccessible = accessible);
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::CreateAccessiblePivot(nsIAccessible* aRoot,
nsIAccessiblePivot** aPivot)
{
NS_ENSURE_ARG_POINTER(aPivot);
NS_ENSURE_ARG(aRoot);
*aPivot = nullptr;
nsRefPtr<Accessible> accessibleRoot(do_QueryObject(aRoot));
NS_ENSURE_TRUE(accessibleRoot, NS_ERROR_INVALID_ARG);
nsAccessiblePivot* pivot = new nsAccessiblePivot(accessibleRoot);
NS_ADDREF(*aPivot = pivot);
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::SetLogging(const nsACString& aModules)
{
#ifdef A11Y_LOG
logging::Enable(PromiseFlatCString(aModules));
#endif
return NS_OK;
}
NS_IMETHODIMP
nsAccessibilityService::IsLogged(const nsAString& aModule, bool* aIsLogged)
{
NS_ENSURE_ARG_POINTER(aIsLogged);
*aIsLogged = false;
#ifdef A11Y_LOG
*aIsLogged = logging::IsEnabled(aModule);
#endif
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccessibilityService public
Accessible*
nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
Accessible* aContext,
bool* aIsSubtreeHidden)
{
NS_PRECONDITION(aContext && aNode && !gIsShutdown,
"Maybe let'd do a crash? Oh, yes, baby!");
if (aIsSubtreeHidden)
*aIsSubtreeHidden = false;
DocAccessible* document = aContext->Document();
// Check to see if we already have an accessible for this node in the cache.
// XXX: we don't have context check here. It doesn't really necessary until
// we have in-law children adoption.
Accessible* cachedAccessible = document->GetAccessible(aNode);
if (cachedAccessible)
return cachedAccessible;
// No cache entry, so we must create the accessible.
if (aNode->IsNodeOfType(nsINode::eDOCUMENT)) {
// If it's document node then ask accessible document loader for
// document accessible, otherwise return null.
nsCOMPtr<nsIDocument> document(do_QueryInterface(aNode));
return GetDocAccessible(document);
}
// We have a content node.
if (!aNode->GetCrossShadowCurrentDoc()) {
NS_WARNING("Creating accessible for node with no document");
return nullptr;
}
if (aNode->OwnerDoc() != document->DocumentNode()) {
NS_ERROR("Creating accessible for wrong document");
return nullptr;
}
if (!aNode->IsContent())
return nullptr;
nsIContent* content = aNode->AsContent();
nsIFrame* frame = content->GetPrimaryFrame();
// Check frame and its visibility. Note, hidden frame allows visible
// elements in subtree.
if (!frame || !frame->StyleVisibility()->IsVisible()) {
if (aIsSubtreeHidden && !frame)
*aIsSubtreeHidden = true;
return nullptr;
}
if (frame->GetContent() != content) {
// Not the main content for this frame. This happens because <area>
// elements return the image frame as their primary frame. The main content
// for the image frame is the image content. If the frame is not an image
// frame or the node is not an area element then null is returned.
// This setup will change when bug 135040 is fixed. Make sure we don't
// create area accessible here. Hopefully assertion below will handle that.
#ifdef DEBUG
nsImageFrame* imageFrame = do_QueryFrame(frame);
NS_ASSERTION(imageFrame && content->IsHTML() && content->Tag() == nsGkAtoms::area,
"Unknown case of not main content for the frame!");
#endif
return nullptr;
}
#ifdef DEBUG
nsImageFrame* imageFrame = do_QueryFrame(frame);
NS_ASSERTION(!imageFrame || !content->IsHTML() || content->Tag() != nsGkAtoms::area,
"Image map manages the area accessible creation!");
#endif
// Attempt to create an accessible based on what we know.
nsRefPtr<Accessible> newAcc;
// Create accessible for visible text frames.
if (content->IsNodeOfType(nsINode::eTEXT)) {
nsAutoString text;
frame->GetRenderedText(&text, nullptr, nullptr, 0, UINT32_MAX);
// Ignore not rendered text nodes and whitespace text nodes between table
// cells.
if (text.IsEmpty() ||
(aContext->IsTableRow() && nsCoreUtils::IsWhitespaceString(text))) {
if (aIsSubtreeHidden)
*aIsSubtreeHidden = true;
return nullptr;
}
newAcc = CreateAccessibleByFrameType(frame, content, aContext);
if (!aContext->IsAcceptableChild(newAcc))
return nullptr;
document->BindToDocument(newAcc, nullptr);
newAcc->AsTextLeaf()->SetText(text);
return newAcc;
}
bool isHTML = content->IsHTML();
if (isHTML && content->Tag() == nsGkAtoms::map) {
// Create hyper text accessible for HTML map if it is used to group links
// (see http://www.w3.org/TR/WCAG10-HTML-TECHS/#group-bypass). If the HTML
// map rect is empty then it is used for links grouping. Otherwise it should
// be used in conjunction with HTML image element and in this case we don't
// create any accessible for it and don't walk into it. The accessibles for
// HTML area (HTMLAreaAccessible) the map contains are attached as
// children of the appropriate accessible for HTML image
// (ImageAccessible).
if (nsLayoutUtils::GetAllInFlowRectsUnion(frame,
frame->GetParent()).IsEmpty()) {
if (aIsSubtreeHidden)
*aIsSubtreeHidden = true;
return nullptr;
}
newAcc = new HyperTextAccessibleWrap(content, document);
if (!aContext->IsAcceptableChild(newAcc))
return nullptr;
document->BindToDocument(newAcc, aria::GetRoleMap(aNode));
return newAcc;
}
nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aNode);
// If the element is focusable or global ARIA attribute is applied to it or
// it is referenced by ARIA relationship then treat role="presentation" on
// the element as the role is not there.
if (roleMapEntry && roleMapEntry->Is(nsGkAtoms::presentation)) {
if (!MustBeAccessible(content, document))
return nullptr;
roleMapEntry = nullptr;
}
if (!newAcc && isHTML) { // HTML accessibles
if (roleMapEntry) {
// Create pure ARIA grid/treegrid related accessibles if they weren't used
// on accessible HTML table elements.
if ((roleMapEntry->accTypes & eTableCell)) {
if (aContext->IsTableRow() &&
(frame->AccessibleType() != eHTMLTableCellType ||
aContext->GetContent() != content->GetParent())) {
newAcc = new ARIAGridCellAccessibleWrap(content, document);
}
} else if ((roleMapEntry->IsOfType(eTable)) &&
frame->AccessibleType() != eHTMLTableType) {
newAcc = new ARIAGridAccessibleWrap(content, document);
}
}
if (!newAcc) {
// Prefer to use markup (mostly tag name, perhaps attributes) to decide if
// and what kind of accessible to create.
newAcc = CreateHTMLAccessibleByMarkup(frame, content, aContext);
// Try using frame to do it.
if (!newAcc)
newAcc = CreateAccessibleByFrameType(frame, content, aContext);
// If table has strong ARIA role then all table descendants shouldn't
// expose their native roles.
if (!roleMapEntry && newAcc) {
if (frame->AccessibleType() == eHTMLTableRowType) {
nsRoleMapEntry* contextRoleMap = aContext->ARIARoleMap();
if (contextRoleMap && !(contextRoleMap->IsOfType(eTable)))
roleMapEntry = &aria::gEmptyRoleMap;
} else if (frame->AccessibleType() == eHTMLTableCellType &&
aContext->ARIARoleMap() == &aria::gEmptyRoleMap) {
roleMapEntry = &aria::gEmptyRoleMap;
} else if (content->Tag() == nsGkAtoms::dt ||
content->Tag() == nsGkAtoms::li ||
content->Tag() == nsGkAtoms::dd ||
frame->AccessibleType() == eHTMLLiType) {
nsRoleMapEntry* contextRoleMap = aContext->ARIARoleMap();
if (contextRoleMap && !(contextRoleMap->IsOfType(eList)))
roleMapEntry = &aria::gEmptyRoleMap;
}
}
}
}
// Accessible XBL types and deck stuff are used in XUL only currently.
if (!newAcc && content->IsXUL()) {
// No accessible for not selected deck panel and its children.
if (!aContext->IsXULTabpanels()) {
nsDeckFrame* deckFrame = do_QueryFrame(frame->GetParent());
if (deckFrame && deckFrame->GetSelectedBox() != frame) {
if (aIsSubtreeHidden)
*aIsSubtreeHidden = true;
return nullptr;
}
}
// XBL bindings may use @role attribute to point the accessible type
// they belong to.
newAcc = CreateAccessibleByType(content, document);
// Any XUL box can be used as tabpanel, make sure we create a proper
// accessible for it.
if (!newAcc && aContext->IsXULTabpanels() &&
content->GetParent() == aContext->GetContent()) {
nsIAtom* frameType = frame->GetType();
if (frameType == nsGkAtoms::boxFrame ||
frameType == nsGkAtoms::scrollFrame) {
newAcc = new XULTabpanelAccessible(content, document);
}
}
}
if (!newAcc) {
if (content->IsSVG()) {
nsSVGPathGeometryFrame* pathGeometryFrame = do_QueryFrame(frame);
if (pathGeometryFrame) {
// A graphic elements: rect, circle, ellipse, line, path, polygon,
// polyline and image. A 'use' and 'text' graphic elements require
// special support.
newAcc = new EnumRoleAccessible(content, document, roles::GRAPHIC);
} else if (content->Tag() == nsGkAtoms::svg) {
newAcc = new EnumRoleAccessible(content, document, roles::DIAGRAM);
}
} else if (content->IsMathML()){
if (content->Tag() == nsGkAtoms::math)
newAcc = new EnumRoleAccessible(content, document, roles::EQUATION);
else
newAcc = new HyperTextAccessible(content, document);
}
}
// If no accessible, see if we need to create a generic accessible because
// of some property that makes this object interesting
// We don't do this for <body>, <html>, <window>, <dialog> etc. which
// correspond to the doc accessible and will be created in any case
if (!newAcc && content->Tag() != nsGkAtoms::body && content->GetParent() &&
(roleMapEntry || MustBeAccessible(content, document) ||
(isHTML && nsCoreUtils::HasClickListener(content)))) {
// This content is focusable or has an interesting dynamic content accessibility property.
// If it's interesting we need it in the accessibility hierarchy so that events or
// other accessibles can point to it, or so that it can hold a state, etc.
if (isHTML) {
// Interesting HTML container which may have selectable text and/or embedded objects
newAcc = new HyperTextAccessibleWrap(content, document);
} else { // XUL, SVG, MathML etc.
// Interesting generic non-HTML container
newAcc = new AccessibleWrap(content, document);
}
}
if (!newAcc || !aContext->IsAcceptableChild(newAcc))
return nullptr;
document->BindToDocument(newAcc, roleMapEntry);
return newAcc;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccessibilityService private
bool
nsAccessibilityService::Init()
{
// Initialize accessible document manager.
if (!DocManager::Init())
return false;
// Add observers.
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
if (!observerService)
return false;
observerService->AddObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
static const char16_t kInitIndicator[] = { '1', 0 };
observerService->NotifyObservers(nullptr, "a11y-init-or-shutdown", kInitIndicator);
#ifdef A11Y_LOG
logging::CheckEnv();
#endif
gApplicationAccessible = new ApplicationAccessibleWrap();
NS_ADDREF(gApplicationAccessible); // will release in Shutdown()
#ifdef MOZ_CRASHREPORTER
CrashReporter::
AnnotateCrashReport(NS_LITERAL_CSTRING("Accessibility"),
NS_LITERAL_CSTRING("Active"));
#endif
#ifdef XP_WIN
sPendingPlugins = new nsTArray<nsCOMPtr<nsIContent> >;
sPluginTimers = new nsTArray<nsCOMPtr<nsITimer> >;
#endif
gIsShutdown = false;
// Now its safe to start platform accessibility.
PlatformInit();
return true;
}
void
nsAccessibilityService::Shutdown()
{
// Remove observers.
nsCOMPtr<nsIObserverService> observerService =
mozilla::services::GetObserverService();
if (observerService) {
observerService->RemoveObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
static const char16_t kShutdownIndicator[] = { '0', 0 };
observerService->NotifyObservers(nullptr, "a11y-init-or-shutdown", kShutdownIndicator);
}
// Stop accessible document loader.
DocManager::Shutdown();
SelectionManager::Shutdown();
#ifdef XP_WIN
sPendingPlugins = nullptr;
uint32_t timerCount = sPluginTimers->Length();
for (uint32_t i = 0; i < timerCount; i++)
sPluginTimers->ElementAt(i)->Cancel();
sPluginTimers = nullptr;
#endif
// Application is going to be closed, shutdown accessibility and mark
// accessibility service as shutdown to prevent calls of its methods.
// Don't null accessibility service static member at this point to be safe
// if someone will try to operate with it.
NS_ASSERTION(!gIsShutdown, "Accessibility was shutdown already");
gIsShutdown = true;
PlatformShutdown();
gApplicationAccessible->Shutdown();
NS_RELEASE(gApplicationAccessible);
gApplicationAccessible = nullptr;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateAccessibleByType(nsIContent* aContent,
DocAccessible* aDoc)
{
nsAutoString role;
for (const nsXBLBinding* binding = aContent->GetXBLBinding(); binding; binding = binding->GetBaseBinding()) {
nsIContent* bindingElm = binding->PrototypeBinding()->GetBindingElement();
bindingElm->GetAttr(kNameSpaceID_None, nsGkAtoms::role, role);
if (!role.IsEmpty())
break;
}
if (role.IsEmpty() || role.EqualsLiteral("none"))
return nullptr;
if (role.EqualsLiteral("outerdoc")) {
nsRefPtr<Accessible> accessible = new OuterDocAccessible(aContent, aDoc);
return accessible.forget();
}
nsRefPtr<Accessible> accessible;
#ifdef MOZ_XUL
// XUL controls
if (role.EqualsLiteral("xul:alert")) {
accessible = new XULAlertAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:button")) {
accessible = new XULButtonAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:checkbox")) {
accessible = new XULCheckboxAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:colorpicker")) {
accessible = new XULColorPickerAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:colorpickertile")) {
accessible = new XULColorPickerTileAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:combobox")) {
accessible = new XULComboboxAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:tabpanels")) {
accessible = new XULTabpanelsAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:dropmarker")) {
accessible = new XULDropmarkerAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:groupbox")) {
accessible = new XULGroupboxAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:image")) {
if (aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::onclick)) {
accessible = new XULToolbarButtonAccessible(aContent, aDoc);
} else {
// Don't include nameless images in accessible tree.
if (!aContent->HasAttr(kNameSpaceID_None,
nsGkAtoms::tooltiptext))
return nullptr;
accessible = new ImageAccessibleWrap(aContent, aDoc);
}
} else if (role.EqualsLiteral("xul:link")) {
accessible = new XULLinkAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:listbox")) {
accessible = new XULListboxAccessibleWrap(aContent, aDoc);
} else if (role.EqualsLiteral("xul:listcell")) {
// Only create cells if there's more than one per row.
nsIContent* listItem = aContent->GetParent();
if (!listItem)
return nullptr;
for (nsIContent* child = listItem->GetFirstChild(); child;
child = child->GetNextSibling()) {
if (child->IsXUL(nsGkAtoms::listcell) && child != aContent) {
accessible = new XULListCellAccessibleWrap(aContent, aDoc);
break;
}
}
} else if (role.EqualsLiteral("xul:listhead")) {
accessible = new XULColumAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:listheader")) {
accessible = new XULColumnItemAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:listitem")) {
accessible = new XULListitemAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:menubar")) {
accessible = new XULMenubarAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:menulist")) {
accessible = new XULComboboxAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:menuitem")) {
accessible = new XULMenuitemAccessibleWrap(aContent, aDoc);
} else if (role.EqualsLiteral("xul:menupopup")) {
#ifdef MOZ_ACCESSIBILITY_ATK
// ATK considers this node to be redundant when within menubars, and it makes menu
// navigation with assistive technologies more difficult
// XXX In the future we will should this for consistency across the nsIAccessible
// implementations on each platform for a consistent scripting environment, but
// then strip out redundant accessibles in the AccessibleWrap class for each platform.
nsIContent *parent = aContent->GetParent();
if (parent && parent->IsXUL() && parent->Tag() == nsGkAtoms::menu)
return nullptr;
#endif
accessible = new XULMenupopupAccessible(aContent, aDoc);
} else if(role.EqualsLiteral("xul:menuseparator")) {
accessible = new XULMenuSeparatorAccessible(aContent, aDoc);
} else if(role.EqualsLiteral("xul:pane")) {
accessible = new EnumRoleAccessible(aContent, aDoc, roles::PANE);
} else if (role.EqualsLiteral("xul:panel")) {
if (aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::noautofocus,
nsGkAtoms::_true, eCaseMatters))
accessible = new XULAlertAccessible(aContent, aDoc);
else
accessible = new EnumRoleAccessible(aContent, aDoc, roles::PANE);
} else if (role.EqualsLiteral("xul:progressmeter")) {
accessible = new XULProgressMeterAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xulstatusbar")) {
accessible = new XULStatusBarAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:scale")) {
accessible = new XULSliderAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:radiobutton")) {
accessible = new XULRadioButtonAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:radiogroup")) {
accessible = new XULRadioGroupAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:tab")) {
accessible = new XULTabAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:tabs")) {
accessible = new XULTabsAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:text")) {
accessible = new XULLabelAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:textbox")) {
accessible = new EnumRoleAccessible(aContent, aDoc, roles::SECTION);
} else if (role.EqualsLiteral("xul:thumb")) {
accessible = new XULThumbAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:tree")) {
accessible = CreateAccessibleForXULTree(aContent, aDoc);
} else if (role.EqualsLiteral("xul:treecolumns")) {
accessible = new XULTreeColumAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:treecolumnitem")) {
accessible = new XULColumnItemAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:toolbar")) {
accessible = new XULToolbarAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:toolbarseparator")) {
accessible = new XULToolbarSeparatorAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:tooltip")) {
accessible = new XULTooltipAccessible(aContent, aDoc);
} else if (role.EqualsLiteral("xul:toolbarbutton")) {
accessible = new XULToolbarButtonAccessible(aContent, aDoc);
}
#endif // MOZ_XUL
return accessible.forget();
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame* aFrame,
nsIContent* aContent,
Accessible* aContext)
{
DocAccessible* document = aContext->Document();
if (aContext->IsTableRow()) {
if (nsCoreUtils::IsHTMLTableHeader(aContent) &&
aContext->GetContent() == aContent->GetParent()) {
nsRefPtr<Accessible> accessible =
new HTMLTableHeaderCellAccessibleWrap(aContent, document);
return accessible.forget();
}
return nullptr;
}
// This method assumes we're in an HTML namespace.
nsIAtom* tag = aContent->Tag();
if (tag == nsGkAtoms::figcaption) {
nsRefPtr<Accessible> accessible =
new HTMLFigcaptionAccessible(aContent, document);
return accessible.forget();
}
if (tag == nsGkAtoms::figure) {
nsRefPtr<Accessible> accessible =
new HTMLFigureAccessible(aContent, document);
return accessible.forget();
}
if (tag == nsGkAtoms::legend) {
nsRefPtr<Accessible> accessible =
new HTMLLegendAccessible(aContent, document);
return accessible.forget();
}
if (tag == nsGkAtoms::option) {
nsRefPtr<Accessible> accessible =
new HTMLSelectOptionAccessible(aContent, document);
return accessible.forget();
}
if (tag == nsGkAtoms::optgroup) {
nsRefPtr<Accessible> accessible =
new HTMLSelectOptGroupAccessible(aContent, document);
return accessible.forget();
}
if (tag == nsGkAtoms::ul || tag == nsGkAtoms::ol ||
tag == nsGkAtoms::dl) {
nsRefPtr<Accessible> accessible =
new HTMLListAccessible(aContent, document);
return accessible.forget();
}
if (tag == nsGkAtoms::a) {
// Only some roles truly enjoy life as HTMLLinkAccessibles, for details
// see closed bug 494807.
nsRoleMapEntry* roleMapEntry = aria::GetRoleMap(aContent);
if (roleMapEntry && roleMapEntry->role != roles::NOTHING &&
roleMapEntry->role != roles::LINK) {
nsRefPtr<Accessible> accessible =
new HyperTextAccessibleWrap(aContent, document);
return accessible.forget();
}
nsRefPtr<Accessible> accessible =
new HTMLLinkAccessible(aContent, document);
return accessible.forget();
}
if (aContext->IsList()) {
// If list item is a child of accessible list then create an accessible for
// it unconditionally by tag name. nsBlockFrame creates the list item
// accessible for other elements styled as list items.
if (aContext->GetContent() == aContent->GetParent()) {
if (tag == nsGkAtoms::dt || tag == nsGkAtoms::li) {
nsRefPtr<Accessible> accessible =
new HTMLLIAccessible(aContent, document);
return accessible.forget();
}
if (tag == nsGkAtoms::dd) {
nsRefPtr<Accessible> accessible =
new HyperTextAccessibleWrap(aContent, document);
return accessible.forget();
}
}
return nullptr;
}
if (tag == nsGkAtoms::abbr ||
tag == nsGkAtoms::acronym ||
tag == nsGkAtoms::article ||
tag == nsGkAtoms::aside ||
tag == nsGkAtoms::blockquote ||
tag == nsGkAtoms::form ||
tag == nsGkAtoms::footer ||
tag == nsGkAtoms::header ||
tag == nsGkAtoms::h1 ||
tag == nsGkAtoms::h2 ||
tag == nsGkAtoms::h3 ||
tag == nsGkAtoms::h4 ||
tag == nsGkAtoms::h5 ||
tag == nsGkAtoms::h6 ||
tag == nsGkAtoms::nav ||
tag == nsGkAtoms::q ||
tag == nsGkAtoms::section) {
nsRefPtr<Accessible> accessible =
new HyperTextAccessibleWrap(aContent, document);
return accessible.forget();
}
if (tag == nsGkAtoms::label) {
nsRefPtr<Accessible> accessible =
new HTMLLabelAccessible(aContent, document);
return accessible.forget();
}
if (tag == nsGkAtoms::output) {
nsRefPtr<Accessible> accessible =
new HTMLOutputAccessible(aContent, document);
return accessible.forget();
}
if (tag == nsGkAtoms::progress) {
nsRefPtr<Accessible> accessible =
new HTMLProgressMeterAccessible(aContent, document);
return accessible.forget();
}
return nullptr;
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame,
nsIContent* aContent,
Accessible* aContext)
{
DocAccessible* document = aContext->Document();
nsRefPtr<Accessible> newAcc;
switch (aFrame->AccessibleType()) {
case eNoType:
return nullptr;
case eHTMLBRType:
newAcc = new HTMLBRAccessible(aContent, document);
break;
case eHTMLButtonType:
newAcc = new HTMLButtonAccessible(aContent, document);
break;
case eHTMLCanvasType:
newAcc = new HTMLCanvasAccessible(aContent, document);
break;
case eHTMLCaptionType:
if (aContext->IsTable() &&
aContext->GetContent() == aContent->GetParent()) {
newAcc = new HTMLCaptionAccessible(aContent, document);
}
break;
case eHTMLCheckboxType:
newAcc = new HTMLCheckboxAccessible(aContent, document);
break;
case eHTMLComboboxType:
newAcc = new HTMLComboboxAccessible(aContent, document);
break;
case eHTMLFileInputType:
newAcc = new HTMLFileInputAccessible(aContent, document);
break;
case eHTMLGroupboxType:
newAcc = new HTMLGroupboxAccessible(aContent, document);
break;
case eHTMLHRType:
newAcc = new HTMLHRAccessible(aContent, document);
break;
case eHTMLImageMapType:
newAcc = new HTMLImageMapAccessible(aContent, document);
break;
case eHTMLLiType:
if (aContext->IsList() &&
aContext->GetContent() == aContent->GetParent()) {
newAcc = new HTMLLIAccessible(aContent, document);
}
break;
case eHTMLSelectListType:
newAcc = new HTMLSelectListAccessible(aContent, document);
break;
case eHTMLMediaType:
newAcc = new EnumRoleAccessible(aContent, document, roles::GROUPING);
break;
case eHTMLRadioButtonType:
newAcc = new HTMLRadioButtonAccessible(aContent, document);
break;
case eHTMLRangeType:
newAcc = new HTMLRangeAccessible(aContent, document);
break;
case eHTMLSpinnerType:
newAcc = new HTMLSpinnerAccessible(aContent, document);
break;
case eHTMLTableType:
newAcc = new HTMLTableAccessibleWrap(aContent, document);
break;
case eHTMLTableCellType:
// Accessible HTML table cell should be a child of accessible HTML table
// or its row (CSS HTML tables are polite to the used markup at
// certain degree).
// Otherwise create a generic text accessible to avoid text jamming
// when reading by AT.
if (aContext->IsHTMLTableRow() || aContext->IsHTMLTable())
newAcc = new HTMLTableCellAccessibleWrap(aContent, document);
else
newAcc = new HyperTextAccessibleWrap(aContent, document);
break;
case eHTMLTableRowType: {
// Accessible HTML table row may be a child of tbody/tfoot/thead of
// accessible HTML table or a direct child of accessible of HTML table.
Accessible* table = aContext->IsTable() ?
aContext :
(aContext->Parent()->IsTable() ? aContext->Parent() : nullptr);
if (table) {
nsIContent* parentContent = aContent->GetParent();
nsIFrame* parentFrame = parentContent->GetPrimaryFrame();
if (parentFrame->GetType() != nsGkAtoms::tableOuterFrame) {
parentContent = parentContent->GetParent();
parentFrame = parentContent->GetPrimaryFrame();
}
if (parentFrame->GetType() == nsGkAtoms::tableOuterFrame &&
table->GetContent() == parentContent) {
newAcc = new HTMLTableRowAccessible(aContent, document);
}
}
break;
}
case eHTMLTextFieldType:
newAcc = new HTMLTextFieldAccessible(aContent, document);
break;
case eHyperTextType:
if (aContent->Tag() != nsGkAtoms::dt && aContent->Tag() != nsGkAtoms::dd)
newAcc = new HyperTextAccessibleWrap(aContent, document);
break;
case eImageType:
newAcc = new ImageAccessibleWrap(aContent, document);
break;
case eOuterDocType:
newAcc = new OuterDocAccessible(aContent, document);
break;
case ePluginType: {
nsObjectFrame* objectFrame = do_QueryFrame(aFrame);
newAcc = CreatePluginAccessible(objectFrame, aContent, aContext);
break;
}
case eTextLeafType:
newAcc = new TextLeafAccessibleWrap(aContent, document);
break;
default:
MOZ_ASSERT(false);
break;
}
return newAcc.forget();
}
////////////////////////////////////////////////////////////////////////////////
// nsIAccessibilityService (DON'T put methods here)
Accessible*
nsAccessibilityService::AddNativeRootAccessible(void* aAtkAccessible)
{
#ifdef MOZ_ACCESSIBILITY_ATK
ApplicationAccessible* applicationAcc = ApplicationAcc();
if (!applicationAcc)
return nullptr;
GtkWindowAccessible* nativeWnd =
new GtkWindowAccessible(static_cast<AtkObject*>(aAtkAccessible));
if (applicationAcc->AppendChild(nativeWnd))
return nativeWnd;
#endif
return nullptr;
}
void
nsAccessibilityService::RemoveNativeRootAccessible(Accessible* aAccessible)
{
#ifdef MOZ_ACCESSIBILITY_ATK
ApplicationAccessible* applicationAcc = ApplicationAcc();
if (applicationAcc)
applicationAcc->RemoveChild(aAccessible);
#endif
}
////////////////////////////////////////////////////////////////////////////////
// NS_GetAccessibilityService
////////////////////////////////////////////////////////////////////////////////
/**
* Return accessibility service; creating one if necessary.
*/
nsresult
NS_GetAccessibilityService(nsIAccessibilityService** aResult)
{
NS_ENSURE_TRUE(aResult, NS_ERROR_NULL_POINTER);
*aResult = nullptr;
if (nsAccessibilityService::gAccessibilityService) {
NS_ADDREF(*aResult = nsAccessibilityService::gAccessibilityService);
return NS_OK;
}
nsRefPtr<nsAccessibilityService> service = new nsAccessibilityService();
NS_ENSURE_TRUE(service, NS_ERROR_OUT_OF_MEMORY);
if (!service->Init()) {
service->Shutdown();
return NS_ERROR_FAILURE;
}
statistics::A11yInitialized();
nsAccessibilityService::gAccessibilityService = service;
NS_ADDREF(*aResult = service);
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccessibilityService private (DON'T put methods here)
#ifdef MOZ_XUL
already_AddRefed<Accessible>
nsAccessibilityService::CreateAccessibleForXULTree(nsIContent* aContent,
DocAccessible* aDoc)
{
nsIContent* child = nsTreeUtils::GetDescendantChild(aContent,
nsGkAtoms::treechildren);
if (!child)
return nullptr;
nsTreeBodyFrame* treeFrame = do_QueryFrame(child->GetPrimaryFrame());
if (!treeFrame)
return nullptr;
nsRefPtr<nsTreeColumns> treeCols = treeFrame->Columns();
int32_t count = 0;
treeCols->GetCount(&count);
// Outline of list accessible.
if (count == 1) {
nsRefPtr<Accessible> accessible =
new XULTreeAccessible(aContent, aDoc, treeFrame);
return accessible.forget();
}
// Table or tree table accessible.
nsRefPtr<Accessible> accessible =
new XULTreeGridAccessibleWrap(aContent, aDoc, treeFrame);
return accessible.forget();
}
#endif
////////////////////////////////////////////////////////////////////////////////
// Services
////////////////////////////////////////////////////////////////////////////////
namespace mozilla {
namespace a11y {
FocusManager*
FocusMgr()
{
return nsAccessibilityService::gAccessibilityService;
}
SelectionManager*
SelectionMgr()
{
return nsAccessibilityService::gAccessibilityService;
}
ApplicationAccessible*
ApplicationAcc()
{
return nsAccessibilityService::gApplicationAccessible;
}
EPlatformDisabledState
PlatformDisabledState()
{
static int disabledState = 0xff;
if (disabledState == 0xff) {
disabledState = Preferences::GetInt("accessibility.force_disabled", 0);
if (disabledState < ePlatformIsForceEnabled)
disabledState = ePlatformIsForceEnabled;
else if (disabledState > ePlatformIsDisabled)
disabledState = ePlatformIsDisabled;
}
return (EPlatformDisabledState)disabledState;
}
}
}