author | Alexander Surkov <surkov.alexander@gmail.com> |
Fri, 16 Nov 2012 01:43:41 +0900 | |
changeset 121326 | 5c0ce5518c74e413692247db44f556d4dd00d8aa |
parent 121325 | 0f01d41ab835d4c916f2b92f9db75b3d0ede92ef |
child 121327 | 515d35527d4de87903df8bdbae3ca5583753aaf9 |
push id | 1997 |
push user | akeybl@mozilla.com |
push date | Mon, 07 Jan 2013 21:25:26 +0000 |
treeherder | mozilla-beta@4baf45cdcf21 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | tbsaunde |
bugs | 811729 |
milestone | 19.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/accessible/build/Makefile.in +++ b/accessible/build/Makefile.in @@ -24,17 +24,16 @@ CPPSRCS = nsAccessibilityFactory.cpp LOCAL_INCLUDES = -I$(srcdir)/../src SHARED_LIBRARY_LIBS = \ ../src/base/$(LIB_PREFIX)accessibility_base_s.$(LIB_SUFFIX) \ ../src/generic/$(LIB_PREFIX)accessibility_generic_s.$(LIB_SUFFIX) \ ../src/html/$(LIB_PREFIX)accessibility_html_s.$(LIB_SUFFIX) \ ../src/xpcom/$(LIB_PREFIX)accessibility_xpcom_s.$(LIB_SUFFIX) \ ../src/$(LIB_PREFIX)accessibility_toolkit_s.$(LIB_SUFFIX) \ - ../src/xforms/$(LIB_PREFIX)accessibility_xforms_s.$(LIB_SUFFIX) \ $(NULL) ifeq ($(MOZ_WIDGET_TOOLKIT),windows) SHARED_LIBRARY_LIBS += \ ../src/windows/ia2/$(LIB_PREFIX)accessibility_toolkit_ia2_s.$(LIB_SUFFIX) \ ../src/windows/uia/$(LIB_PREFIX)accessibility_toolkit_uia_s.$(LIB_SUFFIX) \ $(NULL) endif
--- a/accessible/public/nsIAccessibleProvider.idl +++ b/accessible/public/nsIAccessibleProvider.idl @@ -6,17 +6,17 @@ #include "nsISupports.idl" /** * nsIAccessibleProvider interface is used to link element and accessible object. For that XBL binding of element should implement the interface. */ -[scriptable, uuid(ac0639d5-f95b-4e2b-970c-9eab281fb6a5)] +[scriptable, uuid(f7e531b6-bc29-4d3d-8c91-60fc2b71eb40)] interface nsIAccessibleProvider : nsISupports { /** * Constants set of common use. */ /** Do not create an accessible for this object * This is useful if an ancestor binding already implements nsIAccessibleProvider, @@ -71,68 +71,13 @@ interface nsIAccessibleProvider : nsISup const long XULTree = 0x0000101D; const long XULTreeColumns = 0x0000101E; const long XULTreeColumnItem = 0x0000101F; const long XULToolbar = 0x00001020; const long XULToolbarSeparator = 0x00001021; const long XULTooltip = 0x00001022; const long XULToolbarButton = 0x00001023; - - /** - * Constants set is used by XForms elements. - */ - - /** Used for xforms elements that provide accessible object for itself as - * well for anonymous content. This property are used for upload, - * input[type="xsd:gDay"] and input[type="xsd:gMonth"] */ - const long XFormsContainer = 0x00002000; - - /** Used for label element */ - const long XFormsLabel = 0x00002001; - /** Used for output element */ - const long XFormsOutput = 0x00002002; - /** Used for trigger and submit elements */ - const long XFormsTrigger = 0x00002003; - /** Used for input and textarea elements */ - const long XFormsInput = 0x00002004; - /** Used for input[xsd:boolean] element */ - const long XFormsInputBoolean = 0x00002005; - /** Used for input[xsd:date] element */ - const long XFormsInputDate = 0x00002006; - /** Used for secret element */ - const long XFormsSecret = 0x00002007; - /** Used for range element represented by slider */ - const long XFormsSliderRange = 0x00002008; - - /** Used for select and select1 that are implemented using host document's - * native widget. For example, a select1 in a xhtml document may be - * represented by the native html control html:select */ - const long XFormsSelect = 0x00002009; - /** Used for xforms choices element */ - const long XFormsChoices = 0x00002010; - /** Used for xforms full select/select1 elements that may be represented by - * group of checkboxes and radiogroup */ - const long XFormsSelectFull = 0x00002011; - /** Used for xforms item element that is used inside xforms select elements - * represented by group of checkboxes */ - const long XFormsItemCheckgroup = 0x00002012; - /** Used for xforms item element that is used inside xforms select1 elements - * represented by radio group */ - const long XFormsItemRadiogroup = 0x00002013; - /** Used for xforms select1 element that is represented by combobox */ - const long XFormsSelectCombobox = 0x00002014; - /** Used for xforms item element that is used inside xforms select1 - * elements represented by combobox */ - const long XFormsItemCombobox = 0x00002015; - - /** Used for dropmarker widget that is used by xforms elements */ - const long XFormsDropmarkerWidget = 0x00002101; - /** Used for calendar widget that is used by xforms elements */ - const long XFormsCalendarWidget = 0x00002102; - /** Used for popup widget that is used by xforms minimal select1 elements */ - const long XFormsComboboxPopupWidget = 0x00002103; - /** * Return one of constants declared above. */ readonly attribute long accessibleType; };
--- a/accessible/public/nsIAccessibleRole.idl +++ b/accessible/public/nsIAccessibleRole.idl @@ -57,17 +57,17 @@ interface nsIAccessibleRole : nsISupport */ const unsigned long ROLE_CARET = 7; /** * Represents an alert or a condition that a user should be notified about. * Assistive Technologies typically respond to the role by reading the entire * onscreen contents of containers advertising this role. Should be used for * warning dialogs, etc. The role is used by xul:browsermessage, - * role="alert", xforms:message. + * role="alert". */ const unsigned long ROLE_ALERT = 8; /** * Represents the window frame, which contains child objects such as * a title bar, client, and other objects contained in a window. The role * is supported automatically by MS Windows. */ @@ -197,18 +197,17 @@ interface nsIAccessibleRole : nsISupport * Represents a cell within a table. It is used for html:td, * xul:tree cell and xul:listcell. Also, see ROLE_TABLE. */ const unsigned long ROLE_CELL = 29; /** * Represents a link to something else. This object might look like text or * a graphic, but it acts like a button. It is used for - * xul:label@class="text-link", html:a, html:area, - * xforms:trigger@appearance="minimal". + * xul:label@class="text-link", html:a, html:area. */ const unsigned long ROLE_LINK = 30; /** * Displays a Help topic in the form of a ToolTip or Help balloon. */ const unsigned long ROLE_HELPBALLOON = 31; @@ -264,35 +263,34 @@ interface nsIAccessibleRole : nsISupport /** * Represents a picture. Is is used for xul:image, html:img. */ const unsigned long ROLE_GRAPHIC = 40; /** * Represents read-only text, such as labels for other controls or * instructions in a dialog box. Static text cannot be modified or selected. - * Is is used for xul:label, xul:description, html:label, role="label", - * or xforms:output. + * Is is used for xul:label, xul:description, html:label, role="label". */ const unsigned long ROLE_STATICTEXT = 41; /** * Represents selectable text that allows edits or is designated read-only. */ const unsigned long ROLE_TEXT_LEAF = 42; /** * Represents a push button control. It is used for xul:button, html:button, - * role="button", xforms:trigger, xforms:submit. + * role="button". */ const unsigned long ROLE_PUSHBUTTON = 43; /** * Represents a check box control. It is used for xul:checkbox, - * html:input@type="checkbox", role="checkbox", boolean xforms:input. + * html:input@type="checkbox", role="checkbox". */ const unsigned long ROLE_CHECKBUTTON = 44; /** * Represents an option button, also called a radio button. It is one of a * group of mutually exclusive options. All objects sharing a single parent * that have this attribute are assumed to be part of single mutually * exclusive group. It is used for xul:radio, html:input@type="radio", @@ -303,17 +301,17 @@ interface nsIAccessibleRole : nsISupport /** * Represents a combo box; an edit control with an associated list box that * provides a set of predefined choices. It is used for html:select, * xul:menulist, role="combobox". */ const unsigned long ROLE_COMBOBOX = 46; /** - * Represents the calendar control. It is used for date xforms:input. + * Represents the calendar control. */ const unsigned long ROLE_DROPLIST = 47; /** * Represents a progress bar, dynamically showing the user the percent * complete of an operation in progress. It is used for xul:progressmeter, * role="progressbar". */ @@ -328,17 +326,17 @@ interface nsIAccessibleRole : nsISupport * Represents a hot-key field that allows the user to enter a combination or * sequence of keystrokes. */ const unsigned long ROLE_HOTKEYFIELD = 50; /** * Represents a slider, which allows the user to adjust a setting in given * increments between minimum and maximum values. It is used by xul:scale, - * role="slider", xforms:range. + * role="slider". */ const unsigned long ROLE_SLIDER = 51; /** * Represents a spin box, which is a control that allows the user to increment * or decrement the value displayed in a separate "buddy" control associated * with the spin box. It is used for xul:spinbuttons. */
--- a/accessible/src/Makefile.in +++ b/accessible/src/Makefile.in @@ -39,16 +39,15 @@ endif DIRS += $(PLATFORM_DIR) DIRS += \ base \ generic \ html \ jsat \ xpcom \ - xforms \ $(null) ifdef MOZ_XUL DIRS += xul endif include $(topsrcdir)/config/rules.mk
--- a/accessible/src/base/Makefile.in +++ b/accessible/src/base/Makefile.in @@ -74,17 +74,16 @@ FORCE_STATIC_LIB = 1 include $(topsrcdir)/config/rules.mk LOCAL_INCLUDES += \ -I$(srcdir) \ -I$(srcdir)/../generic \ -I$(srcdir)/../html \ -I$(srcdir)/../xpcom \ -I$(srcdir)/../xul \ - -I$(srcdir)/../xforms \ -I$(srcdir)/../../../layout/generic \ -I$(srcdir)/../../../layout/style \ -I$(srcdir)/../../../layout/xul/base/src \ $(NULL) ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2) LOCAL_INCLUDES += \ -I$(srcdir)/../atk \
--- a/accessible/src/base/Role.h +++ b/accessible/src/base/Role.h @@ -64,17 +64,17 @@ enum Role { */ CARET = 7, /** * Represents an alert or a condition that a user should be notified about. * Assistive Technologies typically respond to the role by reading the entire * onscreen contents of containers advertising this role. Should be used for * warning dialogs, etc. The role is used by xul:browsermessage, - * role="alert", xforms:message. + * role="alert". */ ALERT = 8, /** * Represents the window frame, which contains child objects such as * a title bar, client, and other objects contained in a window. The role * is supported automatically by MS Windows. */ @@ -204,18 +204,17 @@ enum Role { * Represents a cell within a table. It is used for html:td, * xul:tree cell and xul:listcell. Also, see TABLE. */ CELL = 29, /** * Represents a link to something else. This object might look like text or * a graphic, but it acts like a button. It is used for - * xul:label@class="text-link", html:a, html:area, - * xforms:trigger@appearance="minimal". + * xul:label@class="text-link", html:a, html:area. */ LINK = 30, /** * Displays a Help topic in the form of a ToolTip or Help balloon. */ HELPBALLOON = 31, @@ -271,35 +270,34 @@ enum Role { /** * Represents a picture. Is is used for xul:image, html:img. */ GRAPHIC = 40, /** * Represents read-only text, such as labels for other controls or * instructions in a dialog box. Static text cannot be modified or selected. - * Is is used for xul:label, xul:description, html:label, role="label", - * or xforms:output. + * Is is used for xul:label, xul:description, html:label, role="label". */ STATICTEXT = 41, /** * Represents selectable text that allows edits or is designated read-only. */ TEXT_LEAF = 42, /** * Represents a push button control. It is used for xul:button, html:button, - * role="button", xforms:trigger, xforms:submit. + * role="button". */ PUSHBUTTON = 43, /** * Represents a check box control. It is used for xul:checkbox, - * html:input@type="checkbox", role="checkbox", boolean xforms:input. + * html:input@type="checkbox", role="checkbox". */ CHECKBUTTON = 44, /** * Represents an option button, also called a radio button. It is one of a * group of mutually exclusive options. All objects sharing a single parent * that have this attribute are assumed to be part of single mutually * exclusive group. It is used for xul:radio, html:input@type="radio", @@ -310,17 +308,17 @@ enum Role { /** * Represents a combo box; an edit control with an associated list box that * provides a set of predefined choices. It is used for html:select, * xul:menulist, role="combobox". */ COMBOBOX = 46, /** - * Represents the calendar control. It is used for date xforms:input. + * Represents the calendar control. */ DROPLIST = 47, /** * Represents a progress bar, dynamically showing the user the percent * complete of an operation in progress. It is used for xul:progressmeter, * role="progressbar". */ @@ -335,17 +333,17 @@ enum Role { * Represents a hot-key field that allows the user to enter a combination or * sequence of keystrokes. */ HOTKEYFIELD = 50, /** * Represents a slider, which allows the user to adjust a setting in given * increments between minimum and maximum values. It is used by xul:scale, - * role="slider", xforms:range. + * role="slider". */ SLIDER = 51, /** * Represents a spin box, which is a control that allows the user to increment * or decrement the value displayed in a separate "buddy" control associated * with the spin box. It is used for xul:spinbuttons. */
--- a/accessible/src/base/Statistics.h +++ b/accessible/src/base/Statistics.h @@ -26,20 +26,14 @@ namespace statistics { { Telemetry::Accumulate(Telemetry::A11Y_ISIMPLEDOM_USAGE_FLAG, true); } /** * Report that IAccessibleTable has been used. */ inline void IAccessibleTableUsed() { Telemetry::Accumulate(Telemetry::A11Y_IATABLE_USAGE_FLAG, true); } - /** - * Report that XForms accessibility has been instantiated. - */ - inline void XFormsAccessibleUsed() - { Telemetry::Accumulate(Telemetry::A11Y_XFORMS_USAGE_FLAG, true); } - } // namespace statistics } // namespace a11y } // namespace mozilla #endif
--- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -19,18 +19,16 @@ #include "HTMLSelectAccessible.h" #include "HTMLTableAccessibleWrap.h" #include "HyperTextAccessibleWrap.h" #include "nsAccessiblePivot.h" #include "nsAccUtils.h" #include "nsARIAMap.h" #include "nsEventShell.h" #include "nsIAccessibleProvider.h" -#include "nsXFormsFormControlsAccessible.h" -#include "nsXFormsWidgetsAccessible.h" #include "OuterDocAccessible.h" #include "Role.h" #include "RootAccessibleWrap.h" #include "States.h" #include "Statistics.h" #include "TextLeafAccessibleWrap.h" #ifdef MOZ_ACCESSIBILITY_ATK @@ -1242,93 +1240,16 @@ nsAccessibilityService::CreateAccessible break; case nsIAccessibleProvider::XULToolbarButton: accessible = new XULToolbarButtonAccessible(aContent, aDoc); break; #endif // MOZ_XUL - // XForms elements - case nsIAccessibleProvider::XFormsContainer: - accessible = new nsXFormsContainerAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsLabel: - accessible = new nsXFormsLabelAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsOutput: - accessible = new nsXFormsOutputAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsTrigger: - accessible = new nsXFormsTriggerAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsInput: - accessible = new nsXFormsInputAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsInputBoolean: - accessible = new nsXFormsInputBooleanAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsInputDate: - accessible = new nsXFormsInputDateAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsSecret: - accessible = new nsXFormsSecretAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsSliderRange: - accessible = new nsXFormsRangeAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsSelect: - accessible = new nsXFormsSelectAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsChoices: - accessible = new nsXFormsChoicesAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsSelectFull: - accessible = new nsXFormsSelectFullAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsItemCheckgroup: - accessible = new nsXFormsItemCheckgroupAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsItemRadiogroup: - accessible = new nsXFormsItemRadiogroupAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsSelectCombobox: - accessible = new nsXFormsSelectComboboxAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsItemCombobox: - accessible = new nsXFormsItemComboboxAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsDropmarkerWidget: - accessible = new nsXFormsDropmarkerWidgetAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsCalendarWidget: - accessible = new nsXFormsCalendarWidgetAccessible(aContent, aDoc); - break; - - case nsIAccessibleProvider::XFormsComboboxPopupWidget: - accessible = new nsXFormsComboboxPopupWidgetAccessible(aContent, aDoc); - break; - default: return nullptr; } NS_IF_ADDREF(accessible); return accessible; }
deleted file mode 100644 --- a/accessible/src/xforms/Makefile.in +++ /dev/null @@ -1,61 +0,0 @@ -# -# 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/. - -DEPTH = @DEPTH@ -topsrcdir = @top_srcdir@ -srcdir = @srcdir@ -VPATH = @srcdir@ - -include $(DEPTH)/config/autoconf.mk - -MODULE = accessibility -LIBRARY_NAME = accessibility_xforms_s -LIBXUL_LIBRARY = 1 - - - -CPPSRCS = \ - nsXFormsAccessible.cpp \ - nsXFormsFormControlsAccessible.cpp \ - nsXFormsWidgetsAccessible.cpp \ - $(NULL) - -# we don't want the shared lib, but we want to force the creation of a static lib. -FORCE_STATIC_LIB = 1 - -include $(topsrcdir)/config/rules.mk - -LOCAL_INCLUDES = \ - -I$(srcdir) \ - -I$(srcdir)/../base \ - -I$(srcdir)/../generic \ - -I$(srcdir)/../html \ - $(NULL) - -ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2) -LOCAL_INCLUDES += \ - -I$(srcdir)/../atk \ - $(NULL) -else -ifeq ($(MOZ_WIDGET_TOOLKIT),windows) -LOCAL_INCLUDES += \ - -I$(srcdir)/../msaa \ - $(NULL) -else -ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) -LOCAL_INCLUDES += \ - -I$(srcdir)/../mac \ - $(NULL) -else -LOCAL_INCLUDES += \ - -I$(srcdir)/../other \ - $(NULL) -endif -endif -endif - -ifneq ($(A11Y_LOG),0) - DEFINES += -DA11Y_LOG -endif
deleted file mode 100644 --- a/accessible/src/xforms/nsXFormsAccessible.cpp +++ /dev/null @@ -1,572 +0,0 @@ -/* -*- 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 "nsXFormsAccessible.h" - -#include "nsAccessibilityService.h" -#include "nsAccUtils.h" -#include "DocAccessible.h" -#include "nsTextEquivUtils.h" -#include "Role.h" -#include "States.h" -#include "Statistics.h" - -#include "nscore.h" -#include "nsServiceManagerUtils.h" -#include "nsIDOMElement.h" -#include "nsIDOMNodeList.h" -#include "nsIEditor.h" -#include "nsIMutableArray.h" -#include "nsIXFormsUtilityService.h" -#include "nsIPlaintextEditor.h" -#include "nsINodeList.h" - -using namespace mozilla::a11y; - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsAccessibleBase -//////////////////////////////////////////////////////////////////////////////// - -nsIXFormsUtilityService *nsXFormsAccessibleBase::sXFormsService = nullptr; - -nsXFormsAccessibleBase::nsXFormsAccessibleBase() -{ - if (!sXFormsService) { - nsresult rv = CallGetService("@mozilla.org/xforms-utility-service;1", - &sXFormsService); - if (NS_FAILED(rv)) - NS_WARNING("No XForms utility service."); - } - statistics::XFormsAccessibleUsed(); -} - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsAccessible:: - nsXFormsAccessible(nsIContent* aContent, DocAccessible* aDoc) : - HyperTextAccessibleWrap(aContent, aDoc) -{ -} - -nsresult -nsXFormsAccessible::GetBoundChildElementValue(const nsAString& aTagName, - nsAString& aValue) -{ - NS_ENSURE_TRUE(sXFormsService, NS_ERROR_FAILURE); - if (IsDefunct()) - return NS_ERROR_FAILURE; - - nsINodeList* nodes = mContent->ChildNodes(); - - uint32_t length; - nsresult rv = nodes->GetLength(&length); - NS_ENSURE_SUCCESS(rv, rv); - - for (uint32_t index = 0; index < length; index++) { - nsIContent* content = nodes->Item(index); - if (content->NodeInfo()->Equals(aTagName) && - content->NodeInfo()->NamespaceEquals(NS_LITERAL_STRING(NS_NAMESPACE_XFORMS))) { - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(content)); - return sXFormsService->GetValue(DOMNode, aValue); - } - } - - aValue.Truncate(); - return NS_OK; -} - -void -nsXFormsAccessible::CacheSelectChildren(nsIDOMNode *aContainerNode) -{ - nsCOMPtr<nsIDOMNode> container(aContainerNode); - if (!container) - container = do_QueryInterface(mContent); - - nsCOMPtr<nsIDOMNodeList> children; - sXFormsService->GetSelectChildrenFor(container, getter_AddRefs(children)); - - if (!children) - return; - - uint32_t length = 0; - children->GetLength(&length); - - for (uint32_t index = 0; index < length; index++) { - nsCOMPtr<nsIDOMNode> DOMChild; - children->Item(index, getter_AddRefs(DOMChild)); - if (!DOMChild) - continue; - - nsCOMPtr<nsIContent> child(do_QueryInterface(DOMChild)); - Accessible* accessible = - GetAccService()->GetOrCreateAccessible(child, mDoc); - if (!accessible) - continue; - - AppendChild(accessible); - } -} - -uint64_t -nsXFormsAccessible::NativeState() -{ - NS_ENSURE_TRUE(sXFormsService, 0); - - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - - bool isReadonly = false; - nsresult rv = sXFormsService->IsReadonly(DOMNode, &isReadonly); - NS_ENSURE_SUCCESS(rv, 0); - - bool isRequired = false; - rv = sXFormsService->IsRequired(DOMNode, &isRequired); - NS_ENSURE_SUCCESS(rv, 0); - - bool isValid = false; - rv = sXFormsService->IsValid(DOMNode, &isValid); - NS_ENSURE_SUCCESS(rv, 0); - - uint64_t states = HyperTextAccessibleWrap::NativeState(); - - if (NativelyUnavailable()) - states |= states::UNAVAILABLE; - - if (isReadonly) - states |= states::READONLY; - - if (isRequired) - states |= states::REQUIRED; - - if (!isValid) - states |= states::INVALID; - - return states; -} - -bool -nsXFormsAccessible::NativelyUnavailable() const -{ - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - - bool isRelevant = false; - sXFormsService->IsRelevant(DOMNode, &isRelevant); - return !isRelevant; -} - -ENameValueFlag -nsXFormsAccessible::NativeName(nsString& aName) -{ - // search the xforms:label element - GetBoundChildElementValue(NS_LITERAL_STRING("label"), aName); - return eNameOK; -} - -void -nsXFormsAccessible::Description(nsString& aDescription) -{ - nsTextEquivUtils:: - GetTextEquivFromIDRefs(this, nsGkAtoms::aria_describedby, - aDescription); - - if (aDescription.IsEmpty()) - GetBoundChildElementValue(NS_LITERAL_STRING("hint"), aDescription); -} - -void -nsXFormsAccessible::Value(nsString& aValue) -{ - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - sXFormsService->GetValue(DOMNode, aValue); -} - -bool -nsXFormsAccessible::CanHaveAnonChildren() -{ - return false; -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsContainerAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsContainerAccessible:: - nsXFormsContainerAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) -{ -} - -role -nsXFormsContainerAccessible::NativeRole() -{ - return roles::GROUPING; -} - -bool -nsXFormsContainerAccessible::CanHaveAnonChildren() -{ - return true; -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsEditableAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsEditableAccessible:: - nsXFormsEditableAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) -{ -} - -uint64_t -nsXFormsEditableAccessible::NativeState() -{ - uint64_t state = nsXFormsAccessible::NativeState(); - - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - - bool isReadonly = false; - nsresult rv = sXFormsService->IsReadonly(DOMNode, &isReadonly); - NS_ENSURE_SUCCESS(rv, state); - - if (!isReadonly) { - bool isRelevant = false; - rv = sXFormsService->IsRelevant(DOMNode, &isRelevant); - NS_ENSURE_SUCCESS(rv, state); - if (isRelevant) { - state |= states::EDITABLE | states::SELECTABLE_TEXT; - } - } - - nsCOMPtr<nsIEditor> editor = GetEditor(); - NS_ENSURE_TRUE(editor, state); - uint32_t flags; - editor->GetFlags(&flags); - if (flags & nsIPlaintextEditor::eEditorSingleLineMask) - state |= states::SINGLE_LINE; - else - state |= states::MULTI_LINE; - - return state; -} - -already_AddRefed<nsIEditor> -nsXFormsEditableAccessible::GetEditor() const -{ - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - - nsCOMPtr<nsIEditor> editor; - sXFormsService->GetEditor(DOMNode, getter_AddRefs(editor)); - return editor.forget(); -} - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsSelectableAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsSelectableAccessible:: - nsXFormsSelectableAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsEditableAccessible(aContent, aDoc), mIsSelect1Element(false) -{ - mFlags |= eSelectAccessible; - mIsSelect1Element = - mContent->NodeInfo()->Equals(nsGkAtoms::select1); -} - -already_AddRefed<nsIArray> -nsXFormsSelectableAccessible::SelectedItems() -{ - nsCOMPtr<nsIMutableArray> selectedItems = - do_CreateInstance(NS_ARRAY_CONTRACTID); - if (!selectedItems) - return nullptr; - - nsresult rv; - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - - if (mIsSelect1Element) { - nsCOMPtr<nsIDOMNode> itemDOMNode; - rv = sXFormsService->GetSelectedItemForSelect1(DOMNode, - getter_AddRefs(itemDOMNode)); - if (NS_FAILED(rv) || !itemDOMNode || !mDoc) - return nullptr; - - nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemDOMNode)); - nsIAccessible* item = mDoc->GetAccessible(itemNode); - if (item) - selectedItems->AppendElement(item, false); - - nsIMutableArray* items = nullptr; - selectedItems.forget(&items); - return items; - } - - nsCOMPtr<nsIDOMNodeList> itemNodeList; - rv = sXFormsService->GetSelectedItemsForSelect(DOMNode, - getter_AddRefs(itemNodeList)); - if (NS_FAILED(rv) || !itemNodeList || !mDoc) - return nullptr; - - uint32_t length = 0; - itemNodeList->GetLength(&length); - - for (uint32_t index = 0; index < length; index++) { - nsCOMPtr<nsIDOMNode> itemDOMNode; - itemNodeList->Item(index, getter_AddRefs(itemDOMNode)); - if (!itemDOMNode) - return nullptr; - - nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemDOMNode)); - nsIAccessible* item = mDoc->GetAccessible(itemNode); - if (item) - selectedItems->AppendElement(item, false); - } - - nsIMutableArray* items = nullptr; - selectedItems.forget(&items); - return items; -} - -uint32_t -nsXFormsSelectableAccessible::SelectedItemCount() -{ - nsresult rv; - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - - if (mIsSelect1Element) { - nsCOMPtr<nsIDOMNode> item; - rv = sXFormsService->GetSelectedItemForSelect1(DOMNode, - getter_AddRefs(item)); - return NS_SUCCEEDED(rv) && item ? 1 : 0; - } - - nsCOMPtr<nsIDOMNodeList> itemNodeList; - rv = sXFormsService->GetSelectedItemsForSelect(DOMNode, - getter_AddRefs(itemNodeList)); - if (NS_FAILED(rv) || !itemNodeList) - return 0; - - uint32_t length = 0; - itemNodeList->GetLength(&length); - return length; -} - -bool -nsXFormsSelectableAccessible::AddItemToSelection(uint32_t aIndex) -{ - nsCOMPtr<nsIDOMNode> itemDOMNode(do_QueryInterface(GetItemByIndex(&aIndex))); - if (!itemDOMNode) - return false; - - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - if (mIsSelect1Element) - sXFormsService->SetSelectedItemForSelect1(DOMNode, itemDOMNode); - else - sXFormsService->AddItemToSelectionForSelect(DOMNode, itemDOMNode); - - return true; -} - -bool -nsXFormsSelectableAccessible::RemoveItemFromSelection(uint32_t aIndex) -{ - nsCOMPtr<nsIDOMNode> itemDOMNode(do_QueryInterface(GetItemByIndex(&aIndex))); - if (!itemDOMNode) - return false; - - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - if (mIsSelect1Element) { - nsCOMPtr<nsIDOMNode> selItemDOMNode; - sXFormsService->GetSelectedItemForSelect1(DOMNode, - getter_AddRefs(selItemDOMNode)); - if (selItemDOMNode == itemDOMNode) - sXFormsService->SetSelectedItemForSelect1(DOMNode, nullptr); - - return true; - } - - sXFormsService->RemoveItemFromSelectionForSelect(DOMNode, itemDOMNode); - return true; -} - -Accessible* -nsXFormsSelectableAccessible::GetSelectedItem(uint32_t aIndex) -{ - if (!mDoc) - return nullptr; - - nsresult rv; - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - if (mIsSelect1Element) { - if (aIndex != 0) - return nullptr; - - nsCOMPtr<nsIDOMNode> itemDOMNode; - rv = sXFormsService->GetSelectedItemForSelect1(DOMNode, - getter_AddRefs(itemDOMNode)); - if (NS_SUCCEEDED(rv) && itemDOMNode) { - nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemDOMNode)); - return mDoc->GetAccessible(itemNode); - } - return nullptr; - } - - nsCOMPtr<nsIDOMNodeList> itemNodeList; - rv = sXFormsService->GetSelectedItemsForSelect(DOMNode, - getter_AddRefs(itemNodeList)); - if (NS_FAILED(rv) || !itemNodeList) - return nullptr; - - nsCOMPtr<nsIDOMNode> itemDOMNode; - itemNodeList->Item(aIndex, getter_AddRefs(itemDOMNode)); - - nsCOMPtr<nsINode> itemNode(do_QueryInterface(itemDOMNode)); - return mDoc->GetAccessible(itemNode); -} - -bool -nsXFormsSelectableAccessible::IsItemSelected(uint32_t aIndex) -{ - nsCOMPtr<nsIDOMNode> itemDOMNode(do_QueryInterface(GetItemByIndex(&aIndex))); - if (!itemDOMNode) - return false; - - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - if (mIsSelect1Element) { - nsCOMPtr<nsIDOMNode> selItemDOMNode; - sXFormsService->GetSelectedItemForSelect1(DOMNode, - getter_AddRefs(selItemDOMNode)); - return selItemDOMNode == itemDOMNode; - } - - bool isSelected = false; - sXFormsService->IsSelectItemSelected(DOMNode, itemDOMNode, &isSelected); - return isSelected; -} - -bool -nsXFormsSelectableAccessible::UnselectAll() -{ - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - if (mIsSelect1Element) - sXFormsService->SetSelectedItemForSelect1(DOMNode, nullptr); - - sXFormsService->ClearSelectionForSelect(DOMNode); - return true; -} - -bool -nsXFormsSelectableAccessible::SelectAll() -{ - if (mIsSelect1Element) - return false; - - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - sXFormsService->SelectAllItemsForSelect(DOMNode); - return true; -} - -nsIContent* -nsXFormsSelectableAccessible::GetItemByIndex(uint32_t* aIndex, - Accessible* aAccessible) -{ - Accessible* accessible = aAccessible ? aAccessible : this; - uint32_t childCount = accessible->ChildCount(); - for (uint32_t childIdx = 0; childIdx < childCount; childIdx++) { - Accessible* child = accessible->GetChildAt(childIdx); - nsIContent* childContent = child->GetContent(); - nsINodeInfo *nodeInfo = childContent->NodeInfo(); - if (nodeInfo->NamespaceEquals(NS_LITERAL_STRING(NS_NAMESPACE_XFORMS))) { - if (nodeInfo->Equals(nsGkAtoms::item)) { - if (!*aIndex) - return childContent; - - --*aIndex; - } else if (nodeInfo->Equals(nsGkAtoms::choices)) { - nsIContent* itemContent = GetItemByIndex(aIndex, child); - if (itemContent) - return itemContent; - } - } - } - - return nullptr; -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsSelectableItemAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsSelectableItemAccessible:: - nsXFormsSelectableItemAccessible(nsIContent* aContent, - DocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) -{ -} - -void -nsXFormsSelectableItemAccessible::Value(nsString& aValue) -{ - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - sXFormsService->GetValue(DOMNode, aValue); -} - -uint8_t -nsXFormsSelectableItemAccessible::ActionCount() -{ - return 1; -} - -NS_IMETHODIMP -nsXFormsSelectableItemAccessible::DoAction(uint8_t aIndex) -{ - if (aIndex != eAction_Click) - return NS_ERROR_INVALID_ARG; - - DoCommand(); - return NS_OK; -} - -bool -nsXFormsSelectableItemAccessible::IsSelected() -{ - nsresult rv; - - nsINode* parent = mContent; - while ((parent = parent->GetParentNode())) { - nsCOMPtr<nsIContent> content(do_QueryInterface(parent)); - if (!content) - return false; - - nsCOMPtr<nsINodeInfo> nodeinfo = content->NodeInfo(); - if (!nodeinfo->NamespaceEquals(NS_LITERAL_STRING(NS_NAMESPACE_XFORMS))) - continue; - - nsCOMPtr<nsIDOMNode> select(do_QueryInterface(parent)); - if (!select) - continue; - - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - if (nodeinfo->Equals(nsGkAtoms::select)) { - bool isSelected = false; - rv = sXFormsService->IsSelectItemSelected(select, DOMNode, &isSelected); - return NS_SUCCEEDED(rv) && isSelected; - } - - if (nodeinfo->Equals(nsGkAtoms::select1)) { - nsCOMPtr<nsIDOMNode> selitem; - rv = sXFormsService->GetSelectedItemForSelect1(select, - getter_AddRefs(selitem)); - return NS_SUCCEEDED(rv) && (selitem == DOMNode); - } - } - - return false; -} -
deleted file mode 100644 --- a/accessible/src/xforms/nsXFormsAccessible.h +++ /dev/null @@ -1,172 +0,0 @@ -/* -*- 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/. */ - -#ifndef _nsXFormsAccessible_H_ -#define _nsXFormsAccessible_H_ - -#include "HyperTextAccessibleWrap.h" -#include "nsIXFormsUtilityService.h" - -#define NS_NAMESPACE_XFORMS "http://www.w3.org/2002/xforms" - -/** - * Utility class that provides access to nsIXFormsUtilityService. - */ -class nsXFormsAccessibleBase -{ -public: - nsXFormsAccessibleBase(); - -protected: - // Used in GetActionName() methods. - enum { eAction_Click = 0 }; - - // Service allows to get some xforms functionality. - static nsIXFormsUtilityService *sXFormsService; -}; - - -/** - * Every XForms element that is bindable to XForms model or is able to contain - * XForms hint and XForms label elements should have accessible object. This - * class is base class for accessible objects for these XForms elements. - */ -class nsXFormsAccessible : public HyperTextAccessibleWrap, - public nsXFormsAccessibleBase -{ -public: - nsXFormsAccessible(nsIContent* aContent, DocAccessible* aDoc); - - // Accessible - // Returns value of child xforms 'hint' element. - virtual void Description(nsString& aDescription); - - // Returns value of instance node that xforms element is bound to. - virtual void Value(nsString& aValue); - - // Returns state of xforms element taking into account state of instance node - // that it is bound to. - virtual uint64_t NativeState(); - virtual bool NativelyUnavailable() const; - - // Denies accessible nodes in anonymous content of xforms element by - // always returning false value. - virtual bool CanHaveAnonChildren(); - - -protected: - // Accessible - // Returns value of child xforms 'label' element. - virtual mozilla::a11y::ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE; - - // Returns value of first child xforms element by tagname that is bound to - // instance node. - nsresult GetBoundChildElementValue(const nsAString& aTagName, - nsAString& aValue); - - // Cache accessible child item/choices elements. For example, the method is - // used for full appearance select/select1 elements or for their child choices - // element. Note, those select/select1 elements that use native widget - // for representation don't use the method since their item/choices elements - // are hidden and therefore aren't accessible. - // - // @param aContainerNode - node that contains item elements - void CacheSelectChildren(nsIDOMNode *aContainerNode = nullptr); -}; - - -/** - * This class is accessible object for XForms elements that provide accessible - * object for itself as well for anonymous content. You should use this class - * if accessible XForms element is complex, i.e. it is composed from elements - * that should be accessible too. Especially for elements that have multiple - * areas that a user can interact with or multiple visual areas. For example, - * objects for XForms input[type="xsd:gMonth"] that contains combobox element - * to choose month. It has an entryfield, a drop-down button and a drop-down - * list, all of which need to be accessible. Another example would be - * an XForms upload element since it is constructed from textfield and - * 'pick up file' and 'clear file' buttons. - */ -class nsXFormsContainerAccessible : public nsXFormsAccessible -{ -public: - nsXFormsContainerAccessible(nsIContent* aContent, DocAccessible* aDoc); - - // Accessible - virtual mozilla::a11y::role NativeRole(); - - // Allows accessible nodes in anonymous content of xforms element by - // always returning true value. - virtual bool CanHaveAnonChildren(); -}; - - -/** - * The class is base for accessible objects for XForms elements that have - * editable area. - */ -class nsXFormsEditableAccessible : public nsXFormsAccessible -{ -public: - nsXFormsEditableAccessible(nsIContent* aContent, DocAccessible* aDoc); - - // HyperTextAccessible - virtual already_AddRefed<nsIEditor> GetEditor() const; - - // Accessible - virtual uint64_t NativeState(); -}; - - -/** - * The class is base for accessible objects for XForms select and XForms - * select1 elements. - */ -class nsXFormsSelectableAccessible : public nsXFormsEditableAccessible -{ -public: - nsXFormsSelectableAccessible(nsIContent* aContent, DocAccessible* aDoc); - - // SelectAccessible - virtual already_AddRefed<nsIArray> SelectedItems(); - virtual uint32_t SelectedItemCount(); - virtual Accessible* GetSelectedItem(uint32_t aIndex); - virtual bool IsItemSelected(uint32_t aIndex); - virtual bool AddItemToSelection(uint32_t aIndex); - virtual bool RemoveItemFromSelection(uint32_t aIndex); - virtual bool SelectAll(); - virtual bool UnselectAll(); - -protected: - nsIContent* GetItemByIndex(uint32_t* aIndex, - Accessible* aAccessible = nullptr); - - bool mIsSelect1Element; -}; - - -/** - * The class is base for accessible objects for XForms item elements. - */ -class nsXFormsSelectableItemAccessible : public nsXFormsAccessible -{ -public: - nsXFormsSelectableItemAccessible(nsIContent* aContent, - DocAccessible* aDoc); - - NS_IMETHOD DoAction(uint8_t aIndex); - - // Accessible - virtual void Value(nsString& aValue); - - // ActionAccessible - virtual uint8_t ActionCount(); - -protected: - bool IsSelected(); -}; - -#endif -
deleted file mode 100644 --- a/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp +++ /dev/null @@ -1,615 +0,0 @@ -/* -*- 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 "nsXFormsFormControlsAccessible.h" - -#include "nsTextEquivUtils.h" -#include "Role.h" -#include "States.h" - -using namespace mozilla::a11y; - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsLabelAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsLabelAccessible:: - nsXFormsLabelAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) -{ -} - -role -nsXFormsLabelAccessible::NativeRole() -{ - return roles::LABEL; -} - -ENameValueFlag -nsXFormsLabelAccessible::NativeName(nsString& aName) -{ - // XXX Correct name calculation for this, see bug 453594. - return eNameOK; -} - -void -nsXFormsLabelAccessible::Description(nsString& aDescription) -{ - nsTextEquivUtils:: - GetTextEquivFromIDRefs(this, nsGkAtoms::aria_describedby, - aDescription); -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsOutputAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsOutputAccessible:: - nsXFormsOutputAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) -{ -} - -role -nsXFormsOutputAccessible::NativeRole() -{ - return roles::STATICTEXT; -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsTriggerAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsTriggerAccessible:: - nsXFormsTriggerAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) -{ -} - -role -nsXFormsTriggerAccessible::NativeRole() -{ - return roles::PUSHBUTTON; -} - -void -nsXFormsTriggerAccessible::Value(nsString& aValue) -{ - aValue.Truncate(); -} - -uint8_t -nsXFormsTriggerAccessible::ActionCount() -{ - return 1; -} - -NS_IMETHODIMP -nsXFormsTriggerAccessible::GetActionName(uint8_t aIndex, nsAString& aName) -{ - if (aIndex == eAction_Click) { - aName.AssignLiteral("press"); - return NS_OK; - } - return NS_ERROR_INVALID_ARG; -} - -NS_IMETHODIMP -nsXFormsTriggerAccessible::DoAction(uint8_t aIndex) -{ - if (aIndex != eAction_Click) - return NS_ERROR_INVALID_ARG; - - DoCommand(); - return NS_OK; -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsInputAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsInputAccessible:: - nsXFormsInputAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsEditableAccessible(aContent, aDoc) -{ -} - -NS_IMPL_ISUPPORTS_INHERITED2(nsXFormsInputAccessible, - Accessible, - nsIAccessibleText, - nsIAccessibleEditableText) - -role -nsXFormsInputAccessible::NativeRole() -{ - return roles::ENTRY; -} - -uint8_t -nsXFormsInputAccessible::ActionCount() -{ - return 1; -} - -NS_IMETHODIMP -nsXFormsInputAccessible::GetActionName(uint8_t aIndex, nsAString& aName) -{ - if (aIndex != eAction_Click) - return NS_ERROR_INVALID_ARG; - - aName.AssignLiteral("activate"); - return NS_OK; -} - -NS_IMETHODIMP -nsXFormsInputAccessible::DoAction(uint8_t aIndex) -{ - if (aIndex != eAction_Click) - return NS_ERROR_INVALID_ARG; - - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - return sXFormsService->Focus(DOMNode); -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsInputBooleanAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsInputBooleanAccessible:: - nsXFormsInputBooleanAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) -{ -} - -role -nsXFormsInputBooleanAccessible::NativeRole() -{ - return roles::CHECKBUTTON; -} - -uint64_t -nsXFormsInputBooleanAccessible::NativeState() -{ - uint64_t state = nsXFormsAccessible::NativeState(); - - nsAutoString value; - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - nsresult rv = sXFormsService->GetValue(DOMNode, value); - NS_ENSURE_SUCCESS(rv, state); - - if (value.EqualsLiteral("true")) - state |= states::CHECKED; - - return state; -} - -uint8_t -nsXFormsInputBooleanAccessible::ActionCount() -{ - return 1; -} - -NS_IMETHODIMP -nsXFormsInputBooleanAccessible::GetActionName(uint8_t aIndex, nsAString& aName) -{ - if (aIndex != eAction_Click) - return NS_ERROR_INVALID_ARG; - - nsAutoString value; - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - nsresult rv = sXFormsService->GetValue(DOMNode, value); - NS_ENSURE_SUCCESS(rv, rv); - - if (value.EqualsLiteral("true")) - aName.AssignLiteral("uncheck"); - else - aName.AssignLiteral("check"); - - return NS_OK; -} - -NS_IMETHODIMP -nsXFormsInputBooleanAccessible::DoAction(uint8_t aIndex) -{ - if (aIndex != eAction_Click) - return NS_ERROR_INVALID_ARG; - - DoCommand(); - return NS_OK; -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsInputDateAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsInputDateAccessible:: - nsXFormsInputDateAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsContainerAccessible(aContent, aDoc) -{ -} - -role -nsXFormsInputDateAccessible::NativeRole() -{ - return roles::DROPLIST; -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsSecretAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsSecretAccessible:: - nsXFormsSecretAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsInputAccessible(aContent, aDoc) -{ -} - -role -nsXFormsSecretAccessible::NativeRole() -{ - return roles::PASSWORD_TEXT; -} - -uint64_t -nsXFormsSecretAccessible::NativeState() -{ - return nsXFormsInputAccessible::NativeState() | states::PROTECTED; -} - -void -nsXFormsSecretAccessible::Value(nsString& aValue) -{ - aValue.Truncate(); -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsRangeAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsRangeAccessible:: - nsXFormsRangeAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) -{ -} - -role -nsXFormsRangeAccessible::NativeRole() -{ - return roles::SLIDER; -} - -uint64_t -nsXFormsRangeAccessible::NativeState() -{ - uint64_t state = nsXFormsAccessible::NativeState(); - - uint32_t isInRange = nsIXFormsUtilityService::STATE_NOT_A_RANGE; - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - nsresult rv = sXFormsService->IsInRange(DOMNode, &isInRange); - NS_ENSURE_SUCCESS(rv, state); - - if (isInRange == nsIXFormsUtilityService::STATE_OUT_OF_RANGE) - state |= states::INVALID; - - return state; -} - -NS_IMETHODIMP -nsXFormsRangeAccessible::GetMaximumValue(double *aMaximumValue) -{ - NS_ENSURE_ARG_POINTER(aMaximumValue); - - nsAutoString value; - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - nsresult rv = sXFormsService->GetRangeEnd(DOMNode, value); - NS_ENSURE_SUCCESS(rv, rv); - - nsresult error = NS_OK; - *aMaximumValue = value.ToDouble(&error); - return error; -} - -NS_IMETHODIMP -nsXFormsRangeAccessible::GetMinimumValue(double *aMinimumValue) -{ - NS_ENSURE_ARG_POINTER(aMinimumValue); - - nsAutoString value; - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - nsresult rv = sXFormsService->GetRangeStart(DOMNode, value); - NS_ENSURE_SUCCESS(rv, rv); - - nsresult error = NS_OK; - *aMinimumValue = value.ToDouble(&error); - return error; -} - -NS_IMETHODIMP -nsXFormsRangeAccessible::GetMinimumIncrement(double *aMinimumIncrement) -{ - NS_ENSURE_ARG_POINTER(aMinimumIncrement); - - nsAutoString value; - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - nsresult rv = sXFormsService->GetRangeStep(DOMNode, value); - NS_ENSURE_SUCCESS(rv, rv); - - nsresult error = NS_OK; - *aMinimumIncrement = value.ToDouble(&error); - return error; -} - -NS_IMETHODIMP -nsXFormsRangeAccessible::GetCurrentValue(double *aCurrentValue) -{ - NS_ENSURE_ARG_POINTER(aCurrentValue); - - nsAutoString value; - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - nsresult rv = sXFormsService->GetValue(DOMNode, value); - NS_ENSURE_SUCCESS(rv, rv); - - nsresult error = NS_OK; - *aCurrentValue = value.ToDouble(&error); - return error; -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsSelectAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsSelectAccessible:: - nsXFormsSelectAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsContainerAccessible(aContent, aDoc) -{ -} - -uint64_t -nsXFormsSelectAccessible::NativeState() -{ - uint64_t state = nsXFormsContainerAccessible::NativeState(); - - uint32_t isInRange = nsIXFormsUtilityService::STATE_NOT_A_RANGE; - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - nsresult rv = sXFormsService->IsInRange(DOMNode, &isInRange); - NS_ENSURE_SUCCESS(rv, state); - - if (isInRange == nsIXFormsUtilityService::STATE_OUT_OF_RANGE) - state |= states::INVALID; - - return state; -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsChoicesAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsChoicesAccessible:: - nsXFormsChoicesAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) -{ -} - -role -nsXFormsChoicesAccessible::NativeRole() -{ - return roles::GROUPING; -} - -void -nsXFormsChoicesAccessible::Value(nsString& aValue) -{ - aValue.Truncate(); -} - -void -nsXFormsChoicesAccessible::CacheChildren() -{ - CacheSelectChildren(); -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsSelectFullAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsSelectFullAccessible:: - nsXFormsSelectFullAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsSelectableAccessible(aContent, aDoc) -{ -} - -role -nsXFormsSelectFullAccessible::NativeRole() -{ - return roles::GROUPING; -} - -void -nsXFormsSelectFullAccessible::CacheChildren() -{ - CacheSelectChildren(); -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsItemCheckgroupAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsItemCheckgroupAccessible:: - nsXFormsItemCheckgroupAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsSelectableItemAccessible(aContent, aDoc) -{ -} - -role -nsXFormsItemCheckgroupAccessible::NativeRole() -{ - return roles::CHECKBUTTON; -} - -uint64_t -nsXFormsItemCheckgroupAccessible::NativeState() -{ - uint64_t state = nsXFormsSelectableItemAccessible::NativeState(); - - if (IsSelected()) - state |= states::CHECKED; - - return state; -} - -NS_IMETHODIMP -nsXFormsItemCheckgroupAccessible::GetActionName(uint8_t aIndex, nsAString& aName) -{ - if (aIndex != eAction_Click) - return NS_ERROR_INVALID_ARG; - - if (IsSelected()) - aName.AssignLiteral("uncheck"); - else - aName.AssignLiteral("check"); - - return NS_OK; -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsItemRadiogroupAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsItemRadiogroupAccessible:: - nsXFormsItemRadiogroupAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsSelectableItemAccessible(aContent, aDoc) -{ -} - -role -nsXFormsItemRadiogroupAccessible::NativeRole() -{ - return roles::RADIOBUTTON; -} - -uint64_t -nsXFormsItemRadiogroupAccessible::NativeState() -{ - uint64_t state = nsXFormsSelectableItemAccessible::NativeState(); - - if (IsSelected()) - state |= states::CHECKED; - - return state; -} - -NS_IMETHODIMP -nsXFormsItemRadiogroupAccessible::GetActionName(uint8_t aIndex, nsAString& aName) -{ - if (aIndex != eAction_Click) - return NS_ERROR_INVALID_ARG; - - aName.AssignLiteral("select"); - return NS_OK; -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsSelectComboboxAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsSelectComboboxAccessible:: - nsXFormsSelectComboboxAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsSelectableAccessible(aContent, aDoc) -{ -} - -role -nsXFormsSelectComboboxAccessible::NativeRole() -{ - return roles::COMBOBOX; -} - -uint64_t -nsXFormsSelectComboboxAccessible::NativeState() -{ - uint64_t state = nsXFormsSelectableAccessible::NativeState(); - - bool isOpen = false; - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - nsresult rv = sXFormsService->IsDropmarkerOpen(DOMNode, &isOpen); - NS_ENSURE_SUCCESS(rv, state); - - if (isOpen) - state |= states::EXPANDED; - else - state |= states::COLLAPSED; - - return state | states::HASPOPUP; -} - -uint64_t -nsXFormsSelectComboboxAccessible::NativeInteractiveState() const -{ - return NativelyUnavailable() ? states::UNAVAILABLE : states::FOCUSABLE; -} - -bool -nsXFormsSelectComboboxAccessible::CanHaveAnonChildren() -{ - return true; -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsItemComboboxAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsItemComboboxAccessible:: - nsXFormsItemComboboxAccessible(nsIContent* aContent, DocAccessible* aDoc) : - nsXFormsSelectableItemAccessible(aContent, aDoc) -{ -} - -role -nsXFormsItemComboboxAccessible::NativeRole() -{ - return roles::LISTITEM; -} - -uint64_t -nsXFormsItemComboboxAccessible::NativeState() -{ - uint64_t state = nsXFormsSelectableItemAccessible::NativeState(); - if (IsSelected()) - state |= states::SELECTED; - - return state; -} - -uint64_t -nsXFormsItemComboboxAccessible::NativeInteractiveState() const -{ - return NativelyUnavailable() ? - states::UNAVAILABLE : states::FOCUSABLE | states::SELECTABLE; -} - -NS_IMETHODIMP -nsXFormsItemComboboxAccessible::GetActionName(uint8_t aIndex, nsAString& aName) -{ - if (aIndex != eAction_Click) - return NS_ERROR_INVALID_ARG; - - aName.AssignLiteral("select"); - return NS_OK; -} -
deleted file mode 100644 --- a/accessible/src/xforms/nsXFormsFormControlsAccessible.h +++ /dev/null @@ -1,294 +0,0 @@ -/* -*- 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/. */ - -#ifndef _nsXFormsFormControlsAccessible_H_ -#define _nsXFormsFormControlsAccessible_H_ - -#include "nsXFormsAccessible.h" - -/** - * Accessible object for xforms:label. - */ - -class nsXFormsLabelAccessible : public nsXFormsAccessible -{ -public: - nsXFormsLabelAccessible(nsIContent* aContent, DocAccessible* aDoc); - - // Accessible - virtual void Description(nsString& aDescription); - virtual mozilla::a11y::role NativeRole(); - -protected: - // Accessible - virtual mozilla::a11y::ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE; -}; - -/** - * Accessible object for xforms:output. - */ - -class nsXFormsOutputAccessible : public nsXFormsAccessible -{ -public: - nsXFormsOutputAccessible(nsIContent* aContent, DocAccessible* aDoc); - - // Accessible - virtual mozilla::a11y::role NativeRole(); -}; - -/** - * Accessible object for xforms:trigger and xforms:submit. - */ - -class nsXFormsTriggerAccessible : public nsXFormsAccessible -{ -public: - nsXFormsTriggerAccessible(nsIContent* aContent, DocAccessible* aDoc); - - // nsIAccessible - NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName); - NS_IMETHOD DoAction(uint8_t aIndex); - - // Accessible - virtual void Value(nsString& aValue); - virtual mozilla::a11y::role NativeRole(); - - // ActionAccessible - virtual uint8_t ActionCount(); -}; - -/** - * Accessible object for xforms:input and xforms:textarea. - */ - -class nsXFormsInputAccessible : public nsXFormsEditableAccessible -{ -public: - nsXFormsInputAccessible(nsIContent* aContent, DocAccessible* aDoc); - - NS_DECL_ISUPPORTS_INHERITED - - // nsIAccessible - NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName); - NS_IMETHOD DoAction(uint8_t aIndex); - - // Accessible - virtual mozilla::a11y::role NativeRole(); - - // ActionAccessible - virtual uint8_t ActionCount(); -}; - -/** - * Accessible object for xforms:input[type="xsd:boolean"]. - */ - -class nsXFormsInputBooleanAccessible : public nsXFormsAccessible -{ -public: - nsXFormsInputBooleanAccessible(nsIContent* aContent, DocAccessible* aDoc); - - // nsIAccessible - NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName); - NS_IMETHOD DoAction(uint8_t aIndex); - - // Accessible - virtual mozilla::a11y::role NativeRole(); - virtual uint64_t NativeState(); - - // ActionAccessible - virtual uint8_t ActionCount(); -}; - -/** - * Accessible object for xforms:input[type="xsd:date"]. - */ - -class nsXFormsInputDateAccessible : public nsXFormsContainerAccessible -{ -public: - nsXFormsInputDateAccessible(nsIContent* aContent, DocAccessible* aDoc); - - // Accessible - virtual mozilla::a11y::role NativeRole(); -}; - -/** - * Accessible object for xforms:secret. - */ - -class nsXFormsSecretAccessible : public nsXFormsInputAccessible -{ -public: - nsXFormsSecretAccessible(nsIContent* aContent, DocAccessible* aDoc); - - // Accessible - virtual void Value(nsString& aValue); - virtual mozilla::a11y::role NativeRole(); - virtual uint64_t NativeState(); -}; - - -/** - * Accessible object for xforms:range. - */ - -class nsXFormsRangeAccessible : public nsXFormsAccessible -{ -public: - nsXFormsRangeAccessible(nsIContent* aContent, DocAccessible* aDoc); - - // nsIAccessibleValue - NS_IMETHOD GetMaximumValue(double *aMaximumValue); - NS_IMETHOD GetMinimumValue(double *aMinimumValue); - NS_IMETHOD GetMinimumIncrement(double *aMinimumIncrement); - NS_IMETHOD GetCurrentValue(double *aCurrentValue); - - // Accessible - virtual mozilla::a11y::role NativeRole(); - virtual uint64_t NativeState(); -}; - - -/** - * Accessible object for xforms:select and xforms:select1 that are implemented - * using host document's native widget. - */ - -class nsXFormsSelectAccessible : public nsXFormsContainerAccessible -{ -public: - nsXFormsSelectAccessible(nsIContent* aContent, DocAccessible* aDoc); - - // Accessible - virtual uint64_t NativeState(); -}; - - -/** - * Accessible object for xforms:choices. - */ - -class nsXFormsChoicesAccessible : public nsXFormsAccessible -{ -public: - nsXFormsChoicesAccessible(nsIContent* aContent, DocAccessible* aDoc); - - // nsIAccessible - - // Accessible - virtual void Value(nsString& aValue); - virtual mozilla::a11y::role NativeRole(); - -protected: - // Accessible - virtual void CacheChildren(); -}; - - -/** - * Accessible object for xforms:select/xforms:select1 of full appearance that - * may be represented by group of checkboxes or radiogroup. - */ - -class nsXFormsSelectFullAccessible : public nsXFormsSelectableAccessible -{ -public: - nsXFormsSelectFullAccessible(nsIContent* aContent, DocAccessible* aDoc); - - // Accessible - virtual mozilla::a11y::role NativeRole(); - -protected: - // Accessible - virtual void CacheChildren(); -}; - - -/** - * Accessible object for a xforms:item when it is represented by a checkbox. - * This occurs when the item is contained in a xforms:select with full - * appearance. Such a xforms:select is represented by a checkgroup. - */ - -class nsXFormsItemCheckgroupAccessible : public nsXFormsSelectableItemAccessible -{ -public: - nsXFormsItemCheckgroupAccessible(nsIContent* aContent, - DocAccessible* aDoc); - - // nsIAccessible - NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName); - - // Accessible - virtual mozilla::a11y::role NativeRole(); - virtual uint64_t NativeState(); -}; - - -/** - * Accessible object for a xforms:item when it is represented by a radiobutton. - * This occurs when the item is contained in a xforms:select1 with full - * appearance. Such a xforms:select1 is represented as a radiogroup. - */ - -class nsXFormsItemRadiogroupAccessible : public nsXFormsSelectableItemAccessible -{ -public: - nsXFormsItemRadiogroupAccessible(nsIContent* aContent, - DocAccessible* aDoc); - - // nsIAccessible - NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName); - - // Accessible - virtual mozilla::a11y::role NativeRole(); - virtual uint64_t NativeState(); -}; - - -/** - * Accessible object for xforms:select1 of minimal appearance that is - * represented by combobox. - */ - -class nsXFormsSelectComboboxAccessible : public nsXFormsSelectableAccessible -{ -public: - nsXFormsSelectComboboxAccessible(nsIContent* aContent, - DocAccessible* aDoc); - - // Accessible - virtual mozilla::a11y::role NativeRole(); - virtual uint64_t NativeState(); - virtual uint64_t NativeInteractiveState() const; - virtual bool CanHaveAnonChildren(); -}; - - -/** - * Accessible object for xforms:item element when it is represented by a - * listitem. This occurs when the item is contained in a xforms:select with - * minimal appearance. Such a xforms:select is represented by a combobox. - */ - -class nsXFormsItemComboboxAccessible : public nsXFormsSelectableItemAccessible -{ -public: - nsXFormsItemComboboxAccessible(nsIContent* aContent, - DocAccessible* aDoc); - - // nsIAccessible - NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName); - - // Accessible - virtual mozilla::a11y::role NativeRole(); - virtual uint64_t NativeState(); - virtual uint64_t NativeInteractiveState() const; -}; - -#endif -
deleted file mode 100644 --- a/accessible/src/xforms/nsXFormsWidgetsAccessible.cpp +++ /dev/null @@ -1,163 +0,0 @@ -/* -*- 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 "nsXFormsWidgetsAccessible.h" - -#include "Role.h" -#include "States.h" - -using namespace mozilla::a11y; - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsDropmarkerWidgetAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsDropmarkerWidgetAccessible:: - nsXFormsDropmarkerWidgetAccessible(nsIContent* aContent, - DocAccessible* aDoc) : - LeafAccessible(aContent, aDoc) -{ -} - -role -nsXFormsDropmarkerWidgetAccessible::NativeRole() -{ - return roles::PUSHBUTTON; -} - -uint64_t -nsXFormsDropmarkerWidgetAccessible::NativeState() -{ - bool isOpen = false; - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - nsresult rv = sXFormsService->IsDropmarkerOpen(DOMNode, &isOpen); - NS_ENSURE_SUCCESS(rv, 0); - - return isOpen ? states::PRESSED: 0; -} - -uint8_t -nsXFormsDropmarkerWidgetAccessible::ActionCount() -{ - return 1; -} - -NS_IMETHODIMP -nsXFormsDropmarkerWidgetAccessible::GetActionName(uint8_t aIndex, - nsAString& aName) -{ - if (aIndex != eAction_Click) - return NS_ERROR_INVALID_ARG; - - bool isOpen = false; - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - nsresult rv = sXFormsService->IsDropmarkerOpen(DOMNode, &isOpen); - NS_ENSURE_SUCCESS(rv, rv); - - if (isOpen) - aName.AssignLiteral("close"); - else - aName.AssignLiteral("open"); - - return NS_OK; -} - -NS_IMETHODIMP -nsXFormsDropmarkerWidgetAccessible::DoAction(uint8_t aIndex) -{ - if (aIndex != eAction_Click) - return NS_ERROR_INVALID_ARG; - - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - return sXFormsService->ToggleDropmarkerState(DOMNode); -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsCalendarWidgetAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsCalendarWidgetAccessible:: - nsXFormsCalendarWidgetAccessible(nsIContent* aContent, DocAccessible* aDoc) : - AccessibleWrap(aContent, aDoc) -{ -} - -role -nsXFormsCalendarWidgetAccessible::NativeRole() -{ - return roles::CALENDAR; -} - - -//////////////////////////////////////////////////////////////////////////////// -// nsXFormsComboboxPopupWidgetAccessible -//////////////////////////////////////////////////////////////////////////////// - -nsXFormsComboboxPopupWidgetAccessible:: - nsXFormsComboboxPopupWidgetAccessible(nsIContent* aContent, - DocAccessible* aDoc) : - nsXFormsAccessible(aContent, aDoc) -{ -} - -role -nsXFormsComboboxPopupWidgetAccessible::NativeRole() -{ - return roles::LIST; -} - -uint64_t -nsXFormsComboboxPopupWidgetAccessible::NativeState() -{ - uint64_t state = nsXFormsAccessible::NativeState(); - - bool isOpen = false; - nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent)); - nsresult rv = sXFormsService->IsDropmarkerOpen(DOMNode, &isOpen); - NS_ENSURE_SUCCESS(rv, state); - - if (isOpen) - state = states::FLOATING; - else - state = states::INVISIBLE; - - return state; -} - -uint64_t -nsXFormsComboboxPopupWidgetAccessible::NativeInteractiveState() const -{ - return NativelyUnavailable() ? states::UNAVAILABLE : states::FOCUSABLE; -} - -ENameValueFlag -nsXFormsComboboxPopupWidgetAccessible::NativeName(nsString& aName) -{ - // Override nsXFormsAccessible::GetName() to prevent name calculation by - // XForms rules. - return eNameOK; -} - -void -nsXFormsComboboxPopupWidgetAccessible::Description(nsString& aDescription) -{ - aDescription.Truncate(); -} - -void -nsXFormsComboboxPopupWidgetAccessible::Value(nsString& aValue) -{ - aValue.Truncate(); -} - -void -nsXFormsComboboxPopupWidgetAccessible::CacheChildren() -{ - nsCOMPtr<nsIDOMNode> parent = do_QueryInterface(mContent->GetParentNode()); - // Parent node must be an xforms:select1 element. - CacheSelectChildren(parent); -} -
deleted file mode 100644 --- a/accessible/src/xforms/nsXFormsWidgetsAccessible.h +++ /dev/null @@ -1,74 +0,0 @@ -/* -*- 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/. */ - -#ifndef _nsXFormsWidgetsAccessible_H_ -#define _nsXFormsWidgetsAccessible_H_ - -#include "BaseAccessibles.h" -#include "nsXFormsAccessible.h" - -/** - * Accessible object for dropmarker widget that is used inside xforms elements - * of combobox representation. For example, these are xforms:select1, - * xforms:input[type="xsd:date"]. - */ -class nsXFormsDropmarkerWidgetAccessible : public mozilla::a11y::LeafAccessible, - public nsXFormsAccessibleBase -{ -public: - nsXFormsDropmarkerWidgetAccessible(nsIContent* aContent, - DocAccessible* aDoc); - - // nsIAccessible - NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName); - NS_IMETHOD DoAction(uint8_t aIndex); - - // Accessible - virtual mozilla::a11y::role NativeRole(); - virtual uint64_t NativeState(); - - // ActionAccessible - virtual uint8_t ActionCount(); -}; - - -/** - * Accessible object for calendar widget. It is used by xforms:input[xsd:date]. - */ -class nsXFormsCalendarWidgetAccessible : public AccessibleWrap -{ -public: - nsXFormsCalendarWidgetAccessible(nsIContent* aContent, - DocAccessible* aDoc); - - // Accessible - virtual mozilla::a11y::role NativeRole(); -}; - - -/** - * Accessible object for popup menu of minimal xforms select1 element that is - * represented by combobox. - */ -class nsXFormsComboboxPopupWidgetAccessible : public nsXFormsAccessible -{ -public: - nsXFormsComboboxPopupWidgetAccessible(nsIContent* aContent, - DocAccessible* aDoc); - - // Accessible - virtual void Description(nsString& aDescription); - virtual void Value(nsString& aValue); - virtual mozilla::a11y::role NativeRole(); - virtual uint64_t NativeState(); - virtual uint64_t NativeInteractiveState() const; - -protected: - // Accessible - virtual mozilla::a11y::ENameValueFlag NativeName(nsString& aName) MOZ_OVERRIDE; - virtual void CacheChildren(); -}; - -#endif
--- a/content/base/public/Makefile.in +++ b/content/base/public/Makefile.in @@ -36,17 +36,16 @@ nsCaseTreatment.h \ nsContentCID.h \ nsCopySupport.h \ nsContentCreatorFunctions.h \ nsDOMFile.h \ nsLineBreaker.h \ nsReferencedElement.h \ nsTreeSanitizer.h \ nsXMLNameSpaceMap.h \ -nsIXFormsUtilityService.h \ nsHostObjectProtocolHandler.h \ $(NULL) EXPORTS_NAMESPACES = mozilla/dom mozilla EXPORTS_mozilla/dom = \ DirectionalityUtils.h \ Element.h \
deleted file mode 100644 --- a/content/base/public/nsIXFormsUtilityService.h +++ /dev/null @@ -1,193 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* 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/. */ - -#ifndef nsIXFormsUtilityService_h -#define nsIXFormsUtilityService_h - -#include "nsISupports.h" - -class nsIDOMNode; -class nsIDOMNodeList; -class nsIEditor; - -/* For IDL files that don't want to include root IDL files. */ -#ifndef NS_NO_VTABLE -#define NS_NO_VTABLE -#endif - -/* nsIXFormsUtilityService */ -#define NS_IXFORMSUTILITYSERVICE_IID_STR "cd3457b6-cb6a-496c-bdfa-6cfecb2bd5fb" -#define NS_IXFORMSUTILITYSERVICE_IID \ -{ 0xcd3457b6, 0xcb6a, 0x496c, \ - { 0xbd, 0xfa, 0x6c, 0xfe, 0xcb, 0x2b, 0xd5, 0xfb } } - - -/** - * Private interface implemented by the nsXFormsUtilityService in XForms - * extension. - */ -class NS_NO_VTABLE nsIXFormsUtilityService : public nsISupports { -public: - - NS_DECLARE_STATIC_IID_ACCESSOR(NS_IXFORMSUTILITYSERVICE_IID) - - enum { - STATE_OUT_OF_RANGE, - STATE_IN_RANGE, - STATE_NOT_A_RANGE - }; - - /** - * Returns the name of the builtin type of the instance node that aElement is - * bound to. Fails if aElement doesn't have a bound node. - */ - NS_IMETHOD GetBuiltinTypeName(nsIDOMNode *aElement, nsAString& aName) = 0; - - /** - * Return true if instance node that element is bound to is readonly. - */ - NS_IMETHOD IsReadonly(nsIDOMNode *aElement, bool *aState) = 0; - - /** - * Return true if instance node that element is bound to is relevant. - */ - NS_IMETHOD IsRelevant(nsIDOMNode *aElement, bool *aState) = 0; - - /** - * Return true if instance node that element is bound to is required. - */ - NS_IMETHOD IsRequired(nsIDOMNode *aElement, bool *aState) = 0; - - /** - * Return true if instance node that element is bound to is valid. - */ - NS_IMETHOD IsValid(nsIDOMNode *aElement, bool *aState) = 0; - - /** - * Return constant declared above that indicates whether instance node that - * element is bound to is out of range, is in range or neither. The last value - * is used if element can't have in-range or out-of-range state, for exmple, - * xforms:input. - */ - NS_IMETHOD IsInRange(nsIDOMNode *aElement, uint32_t *aState) = 0; - - /** - * Return value of instance node that given node is bound to. If given node is - * xforms:item element then the method returns item value. - */ - NS_IMETHOD GetValue(nsIDOMNode *aElement, nsAString& aValue) = 0; - - /** - * Set the focus to xforms element. - */ - NS_IMETHOD Focus(nsIDOMNode *aElement) = 0; - - /** - * Return @start attribute value of xforms:range element. Failure if - * given element is not xforms:range. - */ - NS_IMETHOD GetRangeStart(nsIDOMNode *aElement, nsAString& aValue) = 0; - - /** - * Return @end attribute value of xforms:range element. Failure if - * given element is not xforms:range. - */ - NS_IMETHOD GetRangeEnd(nsIDOMNode *aElement, nsAString& aValue) = 0; - - /** - * Return @step attribute value of xforms:range element. Failure if - * given element is not xforms:range. - */ - NS_IMETHOD GetRangeStep(nsIDOMNode *aElement, nsAString& aValue) = 0; - - /** - * Return nsIEditor for xforms element if element is editable, null if it is - * not editable. Failure if given element doesn't support editing. - */ - NS_IMETHOD GetEditor(nsIDOMNode *aElement, nsIEditor **aEditor) = 0; - - /** - * Return true if dropmarker is in open state (combobox popup is open), - * otherwise false. Failure if given 'aElement' node is not direct child of - * combobox element or is not combobox itself. - */ - NS_IMETHOD IsDropmarkerOpen(nsIDOMNode *aElement, bool* aIsOpen) = 0; - - /** - * Toggles dropmarker state (close/open combobox popup). Failure if given - * 'aElement' node is not direct child of combobox element or is not combobox - * itself. - */ - NS_IMETHOD ToggleDropmarkerState(nsIDOMNode *aElement) = 0; - - /** - * Get selected xforms:item element for xforms:select1. Failure if - * given 'aElement' node is not xforms:select1. - */ - NS_IMETHOD GetSelectedItemForSelect1(nsIDOMNode *aElement, - nsIDOMNode ** aItem) = 0; - - /** - * Set selected xforms:item element for xforms:select1. Failure if - * given 'aElement' node is not xforms:select1. - */ - NS_IMETHOD SetSelectedItemForSelect1(nsIDOMNode *aElement, - nsIDOMNode *aItem) = 0; - - /** - * Get the list of selected xforms:item elements from the xforms:select. - * Failure if given 'aElement' node is not xforms:select. - */ - NS_IMETHOD GetSelectedItemsForSelect(nsIDOMNode *aElement, - nsIDOMNodeList **aItems) = 0; - - /** - * Add xforms:item element to selection of xforms:select. Failure if - * given 'aElement' node is not xforms:select. - */ - NS_IMETHOD AddItemToSelectionForSelect(nsIDOMNode *aElement, - nsIDOMNode *Item) = 0; - - /** - * Remove xforms:item element from selection of xforms:select. Failure if - * given 'aElement' node is not xforms:select. - */ - NS_IMETHOD RemoveItemFromSelectionForSelect(nsIDOMNode *aElement, - nsIDOMNode *Item) = 0; - - /** - * Deslect all xforms:item elements contained in the given xforms:select. - * Failure if given 'aElement' node is not xforms:select. - */ - NS_IMETHOD ClearSelectionForSelect(nsIDOMNode *aElement) = 0; - - /** - * Select all xforms:item elements of xforms:select. Failure if - * given 'aElement' node is not xforms:select. - */ - NS_IMETHOD SelectAllItemsForSelect(nsIDOMNode *aElement) = 0; - - /** - * Return true if given xforms:item element of xforms:select is selected, - * otherwise return false. Failure if given 'aElement' node is not - * xforms:select. - */ - NS_IMETHOD IsSelectItemSelected(nsIDOMNode *aElement, nsIDOMNode *aItem, - bool *aIsSelected) = 0; - - /** - * Return the list of xforms:item or xforms:choices elements that are children - * of the given 'aElement' node. 'aElement' node may be a xforms:select, - * xforms:select1, xforms:choices or xforms:itemset element. Otherwise - * failure. - */ - NS_IMETHOD GetSelectChildrenFor(nsIDOMNode *aElement, - nsIDOMNodeList **aNodeList) = 0; -}; - -NS_DEFINE_STATIC_IID_ACCESSOR(nsIXFormsUtilityService, - NS_IXFORMSUTILITYSERVICE_IID) - -#endif /* nsIXFormsUtilityService_h */
--- a/toolkit/components/telemetry/Histograms.json +++ b/toolkit/components/telemetry/Histograms.json @@ -11,20 +11,16 @@ "A11Y_ISIMPLEDOM_USAGE_FLAG": { "kind": "flag", "description": "have the ISimpleDOM* accessibility interfaces been used" }, "A11Y_IATABLE_USAGE_FLAG": { "kind": "flag", "description": "has the IAccessibleTable accessibility interface been used" }, - "A11Y_XFORMS_USAGE_FLAG": { - "kind": "flag", - "description": "has XForms accessibility been instantiated" - }, "A11Y_UPDATE_TIME": { "kind": "exponential", "high": "10000", "n_buckets": 50, "description": "time spent updating accessibility (ms)" }, "CYCLE_COLLECTOR": { "kind": "exponential",
--- a/toolkit/toolkit-makefiles.sh +++ b/toolkit/toolkit-makefiles.sh @@ -1154,21 +1154,16 @@ if [ "$ACCESSIBILITY" ]; then accessible/public/Makefile accessible/src/Makefile accessible/src/base/Makefile accessible/src/generic/Makefile accessible/src/html/Makefile accessible/src/jsat/Makefile accessible/src/xpcom/Makefile " - if [ ! "$DISABLE_XFORMS_HOOKS" ]; then - add_makefiles " - accessible/src/xforms/Makefile - " - fi if [ "$MOZ_XUL" ]; then add_makefiles " accessible/src/xul/Makefile " fi if [ "$MOZ_WIDGET_TOOLKIT" = "windows" ]; then add_makefiles " accessible/public/ia2/Makefile