diff --git a/accessible/public/nsIAccessibleProvider.idl b/accessible/public/nsIAccessibleProvider.idl index 286618f129f..680a205df12 100644 --- a/accessible/public/nsIAccessibleProvider.idl +++ b/accessible/public/nsIAccessibleProvider.idl @@ -45,7 +45,7 @@ object. For that XBL binding of element should implement the interface. */ -[scriptable, uuid(7250d0f0-732d-4981-b73e-dd5d71b16183)] +[scriptable, uuid(3f7f9194-c625-4a85-8148-6d92d34897fa)] interface nsIAccessibleProvider : nsISupports { /** @@ -69,37 +69,39 @@ interface nsIAccessibleProvider : nsISupports const long XULDropmarker = 0x00001007; const long XULGroupbox = 0x00001008; const long XULImage = 0x00001009; - const long XULLink = 0x00001010; - const long XULListbox = 0x00001011; - const long XULListitem = 0x00001012; - const long XULMenubar = 0x00001013; - const long XULMenuitem = 0x00001014; - const long XULMenupopup = 0x00001015; - const long XULMenuSeparator = 0x00001016; - const long XULProgressMeter = 0x00001017; - const long XULStatusBar = 0x00001018; - const long XULRadioButton = 0x00001019; - const long XULRadioGroup = 0x00001020; + const long XULLink = 0x0000100A; + const long XULListbox = 0x0000100B; + const long XULListitem = 0x0000100C; + const long XULMenubar = 0x0000100D; + const long XULMenuitem = 0x0000100E; + const long XULMenupopup = 0x0000100F; + const long XULMenuSeparator = 0x00001010; + const long XULProgressMeter = 0x00001011; + const long XULScale = 0x00001012; + const long XULStatusBar = 0x00001013; + const long XULRadioButton = 0x00001014; + const long XULRadioGroup = 0x00001015; /** The single tab in a dialog or tabbrowser/editor interface */ - const long XULTab = 0x00001021; + const long XULTab = 0x00001016; /** A combination of a tabs object and a tabpanels object */ - const long XULTabBox = 0x00001022; + const long XULTabBox = 0x00001017; /** The collection of tab objects, useable in the TabBox and independant of as well */ - const long XULTabs = 0x00001023; + const long XULTabs = 0x00001018; - const long XULText = 0x00001024; - const long XULTextBox = 0x00001025; - const long XULTree = 0x00001026; - const long XULTreeColumns = 0x00001027; - const long XULTreeColumnitem = 0x00001028; - const long XULToolbar = 0x00001029; - const long XULToolbarSeparator = 0x00001030; - const long XULTooltip = 0x00001031; - const long XULToolbarButton = 0x00001032; + const long XULText = 0x00001019; + const long XULTextBox = 0x0000101A; + const long XULThumb = 0x0000101B; + const long XULTree = 0x0000101C; + const long XULTreeColumns = 0x0000101D; + const long XULTreeColumnitem = 0x0000101E; + const long XULToolbar = 0x0000101F; + const long XULToolbarSeparator = 0x00001020; + const long XULTooltip = 0x00001021; + const long XULToolbarButton = 0x00001022; /** diff --git a/accessible/src/base/nsAccessibilityAtomList.h b/accessible/src/base/nsAccessibilityAtomList.h index 6437f28a3c4..5aba6e33fb3 100755 --- a/accessible/src/base/nsAccessibilityAtomList.h +++ b/accessible/src/base/nsAccessibilityAtomList.h @@ -155,6 +155,7 @@ ACCESSIBILITY_ATOM(anonid, "anonid") // Used for ID's in XBL ACCESSIBILITY_ATOM(autocomplete, "autocomplete") // Used as attribute value too ACCESSIBILITY_ATOM(control, "control") ACCESSIBILITY_ATOM(cycles, "cycles") // used for XUL cycler attribute +ACCESSIBILITY_ATOM(curpos, "curpos") // XUL ACCESSIBILITY_ATOM(data, "data") ACCESSIBILITY_ATOM(disabled, "disabled") ACCESSIBILITY_ATOM(droppable, "droppable") // XUL combo box @@ -163,7 +164,10 @@ ACCESSIBILITY_ATOM(_for, "for") ACCESSIBILITY_ATOM(hidden, "hidden") // XUL tree columns ACCESSIBILITY_ATOM(href, "href") ACCESSIBILITY_ATOM(id, "id") +ACCESSIBILITY_ATOM(increment, "increment") // XUL ACCESSIBILITY_ATOM(lang, "lang") +ACCESSIBILITY_ATOM(maxpos, "maxpos") // XUL +ACCESSIBILITY_ATOM(minpos, "minpos") // XUL ACCESSIBILITY_ATOM(multiline, "multiline") ACCESSIBILITY_ATOM(name, "name") ACCESSIBILITY_ATOM(onclick, "onclick") diff --git a/accessible/src/base/nsAccessibilityService.cpp b/accessible/src/base/nsAccessibilityService.cpp index e1672a3ad61..a878a87f218 100644 --- a/accessible/src/base/nsAccessibilityService.cpp +++ b/accessible/src/base/nsAccessibilityService.cpp @@ -87,6 +87,7 @@ #include "nsXULFormControlAccessible.h" #include "nsXULMenuAccessibleWrap.h" #include "nsXULSelectAccessible.h" +#include "nsXULSliderAccessible.h" #include "nsXULTabAccessible.h" #include "nsXULTextAccessible.h" #include "nsXULTreeAccessibleWrap.h" @@ -1613,6 +1614,9 @@ nsresult nsAccessibilityService::GetAccessibleByType(nsIDOMNode *aNode, case nsIAccessibleProvider::XULStatusBar: *aAccessible = new nsXULStatusBarAccessible(aNode, weakShell); break; + case nsIAccessibleProvider::XULScale: + *aAccessible = new nsXULSliderAccessible(aNode, weakShell); + break; case nsIAccessibleProvider::XULRadioButton: *aAccessible = new nsXULRadioButtonAccessible(aNode, weakShell); break; @@ -1634,6 +1638,9 @@ nsresult nsAccessibilityService::GetAccessibleByType(nsIDOMNode *aNode, case nsIAccessibleProvider::XULTextBox: *aAccessible = new nsXULTextFieldAccessible(aNode, weakShell); break; + case nsIAccessibleProvider::XULThumb: + *aAccessible = new nsXULThumbAccessible(aNode, weakShell); + break; case nsIAccessibleProvider::XULTree: *aAccessible = new nsXULTreeAccessibleWrap(aNode, weakShell); break; diff --git a/accessible/src/base/nsAccessible.cpp b/accessible/src/base/nsAccessible.cpp index 475490cc301..ac87a9e2c0b 100644 --- a/accessible/src/base/nsAccessible.cpp +++ b/accessible/src/base/nsAccessible.cpp @@ -2374,110 +2374,68 @@ NS_IMETHODIMP nsAccessible::GetValue(nsAString& aValue) return NS_OK; } -NS_IMETHODIMP nsAccessible::GetMaximumValue(double *aMaximumValue) +// nsIAccessibleValue +NS_IMETHODIMP +nsAccessible::GetMaximumValue(double *aMaximumValue) { - *aMaximumValue = 0; - if (!mDOMNode) { - return NS_ERROR_FAILURE; // Node already shut down - } - if (mRoleMapEntry) { - if (mRoleMapEntry->valueRule == eNoValue) { - return NS_OK; - } - nsCOMPtr content(do_QueryInterface(mDOMNode)); - nsAutoString valueMax; - if (content && content->GetAttr(kNameSpaceID_WAIProperties, - nsAccessibilityAtoms::valuemax, valueMax) && - valueMax.IsEmpty() == PR_FALSE) { - *aMaximumValue = PR_strtod(NS_LossyConvertUTF16toASCII(valueMax).get(), nsnull); - return NS_OK; - } - } - return NS_ERROR_FAILURE; // No maximum + return GetAttrValue(kNameSpaceID_WAIProperties, + nsAccessibilityAtoms::valuemax, aMaximumValue); } -NS_IMETHODIMP nsAccessible::GetMinimumValue(double *aMinimumValue) +NS_IMETHODIMP +nsAccessible::GetMinimumValue(double *aMinimumValue) { - *aMinimumValue = 0; - if (!mDOMNode) { - return NS_ERROR_FAILURE; // Node already shut down - } - if (mRoleMapEntry) { - if (mRoleMapEntry->valueRule == eNoValue) { - return NS_OK; - } - nsCOMPtr content(do_QueryInterface(mDOMNode)); - nsAutoString valueMin; - if (content && content->GetAttr(kNameSpaceID_WAIProperties, - nsAccessibilityAtoms::valuemin, valueMin) && - valueMin.IsEmpty() == PR_FALSE) { - *aMinimumValue = PR_strtod(NS_LossyConvertUTF16toASCII(valueMin).get(), nsnull); - return NS_OK; - } - } - return NS_ERROR_FAILURE; // No minimum + return GetAttrValue(kNameSpaceID_WAIProperties, + nsAccessibilityAtoms::valuemin, aMinimumValue); } -NS_IMETHODIMP nsAccessible::GetMinimumIncrement(double *aMinIncrement) +NS_IMETHODIMP +nsAccessible::GetMinimumIncrement(double *aMinIncrement) { + NS_ENSURE_ARG_POINTER(aMinIncrement); *aMinIncrement = 0; - return NS_ERROR_NOT_IMPLEMENTED; // No mimimum increment in dynamic content spec right now + + // No mimimum increment in dynamic content spec right now + return NS_OK_NO_ARIA_VALUE; } -NS_IMETHODIMP nsAccessible::GetCurrentValue(double *aValue) +NS_IMETHODIMP +nsAccessible::GetCurrentValue(double *aValue) { - *aValue = 0; - if (!mDOMNode) { - return NS_ERROR_FAILURE; // Node already shut down - } - if (mRoleMapEntry) { - if (mRoleMapEntry->valueRule == eNoValue) { - return NS_OK; - } - nsCOMPtr content(do_QueryInterface(mDOMNode)); - nsAutoString value; - if (content && content->GetAttr(kNameSpaceID_WAIProperties, - nsAccessibilityAtoms::valuenow, value) && - value.IsEmpty() == PR_FALSE) { - *aValue = PR_strtod(NS_LossyConvertUTF16toASCII(value).get(), nsnull); - return NS_OK; - } - } - return NS_ERROR_FAILURE; // No value + return GetAttrValue(kNameSpaceID_WAIProperties, + nsAccessibilityAtoms::valuenow, aValue); } -NS_IMETHODIMP nsAccessible::SetCurrentValue(double aValue) +NS_IMETHODIMP +nsAccessible::SetCurrentValue(double aValue) { - if (!mDOMNode) { + if (!mDOMNode) return NS_ERROR_FAILURE; // Node already shut down - } - if (mRoleMapEntry) { - if (mRoleMapEntry->valueRule == eNoValue) { - return NS_OK; - } - const PRUint32 kValueCannotChange = nsIAccessibleStates::STATE_READONLY | - nsIAccessibleStates::STATE_UNAVAILABLE; - if (State(this) & kValueCannotChange) { - return NS_ERROR_FAILURE; - } - double minValue; - if (NS_SUCCEEDED(GetMinimumValue(&minValue)) && aValue < minValue) { - return NS_ERROR_INVALID_ARG; - } - double maxValue; - if (NS_SUCCEEDED(GetMaximumValue(&maxValue)) && aValue > maxValue) { - return NS_ERROR_INVALID_ARG; - } - nsCOMPtr content(do_QueryInterface(mDOMNode)); - if (content) { - nsAutoString newValue; - newValue.AppendFloat(aValue); - return content->SetAttr(kNameSpaceID_WAIProperties, - nsAccessibilityAtoms::valuenow, newValue, PR_TRUE); - } - } - return NS_ERROR_FAILURE; // Not in a role that can accept value + if (!mRoleMapEntry || mRoleMapEntry->valueRule == eNoValue) + return NS_OK_NO_ARIA_VALUE; + + const PRUint32 kValueCannotChange = nsIAccessibleStates::STATE_READONLY | + nsIAccessibleStates::STATE_UNAVAILABLE; + + if (State(this) & kValueCannotChange) + return NS_ERROR_FAILURE; + + double minValue = 0; + if (NS_SUCCEEDED(GetMinimumValue(&minValue)) && aValue < minValue) + return NS_ERROR_INVALID_ARG; + + double maxValue = 0; + if (NS_SUCCEEDED(GetMaximumValue(&maxValue)) && aValue > maxValue) + return NS_ERROR_INVALID_ARG; + + nsCOMPtr content(do_QueryInterface(mDOMNode)); + NS_ENSURE_STATE(content); + + nsAutoString newValue; + newValue.AppendFloat(aValue); + return content->SetAttr(kNameSpaceID_WAIProperties, + nsAccessibilityAtoms::valuenow, newValue, PR_TRUE); } /* void setName (in DOMString name); */ @@ -3285,3 +3243,28 @@ PRBool nsAccessible::CheckVisibilityInParentChain(nsIDocument* aDocument, nsIVie return PR_TRUE; } + +nsresult +nsAccessible::GetAttrValue(PRUint32 aNameSpaceID, nsIAtom *aName, + double *aValue) +{ + NS_ENSURE_ARG_POINTER(aValue); + *aValue = 0; + + if (!mDOMNode) + return NS_ERROR_FAILURE; // Node already shut down + + if (!mRoleMapEntry || mRoleMapEntry->valueRule == eNoValue) + return NS_OK_NO_ARIA_VALUE; + + nsCOMPtr content(do_QueryInterface(mDOMNode)); + NS_ENSURE_STATE(content); + + PRInt32 result = NS_OK; + nsAutoString value; + if (content->GetAttr(aNameSpaceID, aName, value) && !value.IsEmpty()) + *aValue = value.ToFloat(&result); + + return result; +} + diff --git a/accessible/src/base/nsAccessible.h b/accessible/src/base/nsAccessible.h index 5c7af6528af..025aa9df693 100644 --- a/accessible/src/base/nsAccessible.h +++ b/accessible/src/base/nsAccessible.h @@ -67,6 +67,9 @@ class nsIDOMNode; class nsIAtom; class nsIView; +#define NS_OK_NO_ARIA_VALUE \ +NS_ERROR_GENERATE_SUCCESS(NS_ERROR_MODULE_GENERAL, 0x21) + // When mNextSibling is set to this, it indicates there ar eno more siblings #define DEAD_END_ACCESSIBLE static_cast((void*)1) @@ -275,6 +278,17 @@ protected: // Check the visibility across both parent content and chrome PRBool CheckVisibilityInParentChain(nsIDocument* aDocument, nsIView* aView); + /** + * Get numeric value of the given attribute. + * + * @param aNameSpaceID - namespace ID of the attribute + * @param aName - name of the attribute + * @param aValue - value of the attribute + * + * @return - NS_OK_NO_ARIA_VALUE if there is no setted ARIA attribute + */ + nsresult GetAttrValue(PRUint32 aNameSpaceID, nsIAtom *aName, double *aValue); + // Data Members nsCOMPtr mParent; nsIAccessible *mFirstChild, *mNextSibling; diff --git a/accessible/src/xul/Makefile.in b/accessible/src/xul/Makefile.in index adc66694b40..d666523e134 100644 --- a/accessible/src/xul/Makefile.in +++ b/accessible/src/xul/Makefile.in @@ -72,6 +72,7 @@ CPPSRCS = \ nsXULFormControlAccessible.cpp \ nsXULMenuAccessible.cpp \ nsXULSelectAccessible.cpp \ + nsXULSliderAccessible.cpp \ nsXULTabAccessible.cpp \ nsXULTextAccessible.cpp \ nsXULTreeAccessible.cpp \ diff --git a/accessible/src/xul/nsXULSliderAccessible.cpp b/accessible/src/xul/nsXULSliderAccessible.cpp new file mode 100644 index 00000000000..a48913c35ae --- /dev/null +++ b/accessible/src/xul/nsXULSliderAccessible.cpp @@ -0,0 +1,244 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2007 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alexander Surkov (original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "nsXULSliderAccessible.h" + +#include "nsIDOMDocument.h" +#include "nsIDOMDocumentXBL.h" + +// nsXULSliderAccessible + +nsXULSliderAccessible::nsXULSliderAccessible(nsIDOMNode* aNode, + nsIWeakReference* aShell) : + nsAccessibleWrap(aNode, aShell) +{ +} + +// nsIAccessible + +NS_IMETHODIMP +nsXULSliderAccessible::GetRole(PRUint32 *aRole) +{ + NS_ENSURE_ARG_POINTER(aRole); + + *aRole = nsIAccessibleRole::ROLE_SLIDER; + return NS_OK; +} + +NS_IMETHODIMP +nsXULSliderAccessible::GetValue(nsAString& aValue) +{ + return GetSliderAttr(nsAccessibilityAtoms::curpos, aValue); +} + +// nsIAccessibleValue + +NS_IMETHODIMP +nsXULSliderAccessible::GetMaximumValue(double *aValue) +{ + nsresult rv = nsAccessibleWrap::GetMaximumValue(aValue); + + // ARIA redefined maximum value. + if (rv != NS_OK_NO_ARIA_VALUE) + return rv; + + return GetSliderAttr(nsAccessibilityAtoms::maxpos, aValue); +} + +NS_IMETHODIMP +nsXULSliderAccessible::GetMinimumValue(double *aValue) +{ + nsresult rv = nsAccessibleWrap::GetMinimumValue(aValue); + + // ARIA redefined minmum value. + if (rv != NS_OK_NO_ARIA_VALUE) + return rv; + + return GetSliderAttr(nsAccessibilityAtoms::minpos, aValue); +} + +NS_IMETHODIMP +nsXULSliderAccessible::GetMinimumIncrement(double *aValue) +{ + nsresult rv = nsAccessibleWrap::GetMinimumIncrement(aValue); + + // ARIA redefined minimum increment value. + if (rv != NS_OK_NO_ARIA_VALUE) + return rv; + + return GetSliderAttr(nsAccessibilityAtoms::increment, aValue); +} + +NS_IMETHODIMP +nsXULSliderAccessible::GetCurrentValue(double *aValue) +{ + nsresult rv = nsAccessibleWrap::GetCurrentValue(aValue); + + // ARIA redefined current value. + if (rv != NS_OK_NO_ARIA_VALUE) + return rv; + + return GetSliderAttr(nsAccessibilityAtoms::curpos, aValue); +} + +NS_IMETHODIMP +nsXULSliderAccessible::SetCurrentValue(double aValue) +{ + nsresult rv = nsAccessibleWrap::SetCurrentValue(aValue); + + // ARIA redefined current value. + if (rv != NS_OK_NO_ARIA_VALUE) + return rv; + + return SetSliderAttr(nsAccessibilityAtoms::curpos, aValue); +} + +// nsPIAccessible +NS_IMETHODIMP +nsXULSliderAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren) +{ + NS_ENSURE_ARG_POINTER(aAllowsAnonChildren); + + // Allow anonymous xul:thumb inside xul:slider. + *aAllowsAnonChildren = PR_TRUE; + return NS_OK; +} + +// Utils + +already_AddRefed +nsXULSliderAccessible::GetSliderNode() +{ + if (!mDOMNode) + return nsnull; + + if (!mSliderNode) { + nsCOMPtr document; + mDOMNode->GetOwnerDocument(getter_AddRefs(document)); + if (!document) + return nsnull; + + nsCOMPtr xblDoc(do_QueryInterface(document)); + if (!xblDoc) + return nsnull; + + // XXX: we depend on anonymous content. + nsCOMPtr domElm(do_QueryInterface(mDOMNode)); + if (!domElm) + return nsnull; + + xblDoc->GetAnonymousElementByAttribute(domElm, NS_LITERAL_STRING("anonid"), + NS_LITERAL_STRING("slider"), + getter_AddRefs(mSliderNode)); + } + + nsIContent *sliderNode = nsnull; + nsresult rv = CallQueryInterface(mSliderNode, &sliderNode); + return NS_FAILED(rv) ? nsnull : sliderNode; +} + +nsresult +nsXULSliderAccessible::GetSliderAttr(nsIAtom *aName, nsAString& aValue) +{ + aValue.Truncate(); + + if (!mDOMNode) + return NS_ERROR_FAILURE; + + nsCOMPtr sliderNode(GetSliderNode()); + NS_ENSURE_STATE(sliderNode); + + sliderNode->GetAttr(kNameSpaceID_None, aName, aValue); + return NS_OK; +} + +nsresult +nsXULSliderAccessible::SetSliderAttr(nsIAtom *aName, const nsAString& aValue) +{ + if (!mDOMNode) + return NS_ERROR_FAILURE; + + nsCOMPtr sliderNode(GetSliderNode()); + NS_ENSURE_STATE(sliderNode); + + sliderNode->SetAttr(kNameSpaceID_None, aName, aValue, PR_TRUE); + return NS_OK; +} + +nsresult +nsXULSliderAccessible::GetSliderAttr(nsIAtom *aName, double *aValue) +{ + NS_ENSURE_ARG_POINTER(aValue); + *aValue = 0; + + nsAutoString value; + nsresult rv = GetSliderAttr(aName, value); + NS_ENSURE_SUCCESS(rv, rv); + + PRInt32 error = NS_OK; + *aValue = value.ToFloat(&error); + return error; +} + +nsresult +nsXULSliderAccessible::SetSliderAttr(nsIAtom *aName, double aValue) +{ + nsAutoString value; + value.AppendFloat(aValue); + + return SetSliderAttr(aName, value); +} + + +// nsXULThumbAccessible + +nsXULThumbAccessible::nsXULThumbAccessible(nsIDOMNode* aNode, + nsIWeakReference* aShell) : + nsAccessibleWrap(aNode, aShell) {} + +// nsIAccessible + +NS_IMETHODIMP +nsXULThumbAccessible::GetRole(PRUint32 *aRole) +{ + NS_ENSURE_ARG_POINTER(aRole); + + *aRole = nsIAccessibleRole::ROLE_INDICATOR; + return NS_OK; +} + diff --git a/accessible/src/xul/nsXULSliderAccessible.h b/accessible/src/xul/nsXULSliderAccessible.h new file mode 100644 index 00000000000..143adef12fa --- /dev/null +++ b/accessible/src/xul/nsXULSliderAccessible.h @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is + * Mozilla Foundation. + * Portions created by the Initial Developer are Copyright (C) 2007 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * Alexander Surkov (original author) + * + * Alternatively, the contents of this file may be used under the terms of + * either of the GNU General Public License Version 2 or later (the "GPL"), + * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#ifndef _nsXULSliderAccessible_H_ +#define _nsXULSliderAccessible_H_ + +#include "nsAccessibleWrap.h" + +#include "nsIDOMElement.h" + +class nsXULSliderAccessible : public nsAccessibleWrap +{ +public: + nsXULSliderAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell); + + // nsIAccessible + NS_IMETHOD GetRole(PRUint32 *aRole); + NS_IMETHOD GetValue(nsAString& aValue); + + // nsIAccessibleValue + NS_IMETHOD GetMaximumValue(double *aMaximumValue); + NS_IMETHOD GetMinimumValue(double *aMinimumValue); + NS_IMETHOD GetMinimumIncrement(double *aMinIncrement); + NS_IMETHOD GetCurrentValue(double *aValue); + NS_IMETHOD SetCurrentValue(double aValue); + + // nsPIAccessible + NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren); + +protected: + already_AddRefed GetSliderNode(); + + nsresult GetSliderAttr(nsIAtom *aName, nsAString& aValue); + nsresult SetSliderAttr(nsIAtom *aName, const nsAString& aValue); + + nsresult GetSliderAttr(nsIAtom *aName, double *aValue); + nsresult SetSliderAttr(nsIAtom *aName, double aValue); + +private: + nsCOMPtr mSliderNode; +}; + + +class nsXULThumbAccessible : public nsAccessibleWrap +{ +public: + nsXULThumbAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell); + + // nsIAccessible + NS_IMETHOD GetRole(PRUint32 *aRole); +}; + +#endif + diff --git a/toolkit/content/widgets/scale.xml b/toolkit/content/widgets/scale.xml index 6b885a62c47..82540ec4805 100644 --- a/toolkit/content/widgets/scale.xml +++ b/toolkit/content/widgets/scale.xml @@ -9,6 +9,14 @@ + + + + + return Components.interfaces.nsIAccessibleProvider.XULThumb; + + + - + + + + return Components.interfaces.nsIAccessibleProvider.XULScale; + + +