зеркало из https://github.com/mozilla/gecko-dev.git
Bug 285167 - Mozilla doesn't support Scrollbar accessible, r=marcoz, davidb, enndeaking, sr=neil
This commit is contained in:
Родитель
906cbaed37
Коммит
05fb56e313
|
@ -45,7 +45,7 @@
|
|||
object. For that XBL binding of element should implement the interface.
|
||||
*/
|
||||
|
||||
[scriptable, uuid(3f7f9194-c625-4a85-8148-6d92d34897fa)]
|
||||
[scriptable, uuid(18ba74e1-0751-41c8-81c6-c903e22491d3)]
|
||||
interface nsIAccessibleProvider : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -62,56 +62,130 @@ interface nsIAccessibleProvider : nsISupports
|
|||
<xul:iframe>, <xul:browser> and <xul:editor>. */
|
||||
const long OuterDoc = 0x00000001;
|
||||
|
||||
|
||||
/**
|
||||
* Constants set is used by XUL controls.
|
||||
*/
|
||||
|
||||
const long XULAlert = 0x00001001;
|
||||
const long XULButton = 0x00001002;
|
||||
const long XULCheckbox = 0x00001003;
|
||||
const long XULColorPicker = 0x00001004;
|
||||
const long XULColorPickerTile = 0x00001005;
|
||||
const long XULCombobox = 0x00001006;
|
||||
const long XULDropmarker = 0x00001007;
|
||||
const long XULGroupbox = 0x00001008;
|
||||
const long XULImage = 0x00001009;
|
||||
const long XULLink = 0x0000100A;
|
||||
const long XULListbox = 0x0000100B;
|
||||
const long XULListCell = 0x00001026;
|
||||
const long XULListHead = 0x00001024;
|
||||
const long XULListHeader = 0x00001025;
|
||||
const long XULListitem = 0x0000100C;
|
||||
const long XULMenubar = 0x0000100D;
|
||||
const long XULMenuitem = 0x0000100E;
|
||||
const long XULMenupopup = 0x0000100F;
|
||||
const long XULMenuSeparator = 0x00001010;
|
||||
const long XULPane = 0x00001011;
|
||||
const long XULProgressMeter = 0x00001012;
|
||||
const long XULScale = 0x00001013;
|
||||
const long XULStatusBar = 0x00001014;
|
||||
const long XULRadioButton = 0x00001015;
|
||||
const long XULRadioGroup = 0x00001016;
|
||||
/** popup@noautofocus="true" and notification elements */
|
||||
const long XULAlert = 0x00001001;
|
||||
|
||||
/** The single tab in a dialog or tabbrowser/editor interface */
|
||||
const long XULTab = 0x00001017;
|
||||
/** button element */
|
||||
const long XULButton = 0x00001002;
|
||||
|
||||
/** A combination of a tabs object and a tabpanels object */
|
||||
const long XULTabBox = 0x00001018;
|
||||
/** checkbox element */
|
||||
const long XULCheckbox = 0x00001003;
|
||||
|
||||
/** The collection of tab objects, useable in the TabBox and independant of
|
||||
as well */
|
||||
const long XULTabs = 0x00001019;
|
||||
/** colorpicker element */
|
||||
const long XULColorPicker = 0x00001004;
|
||||
|
||||
const long XULText = 0x0000101A;
|
||||
const long XULTextBox = 0x0000101B;
|
||||
const long XULThumb = 0x0000101C;
|
||||
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;
|
||||
/** colorpickertile element */
|
||||
const long XULColorPickerTile = 0x00001005;
|
||||
|
||||
/** menulist element */
|
||||
const long XULCombobox = 0x00001006;
|
||||
|
||||
/** dropmarker element */
|
||||
const long XULDropmarker = 0x00001007;
|
||||
|
||||
/** groupbox element */
|
||||
const long XULGroupbox = 0x00001008;
|
||||
|
||||
/** image element */
|
||||
const long XULImage = 0x00001009;
|
||||
|
||||
/** label@class="text-link" and label@onclick elements */
|
||||
const long XULLink = 0x0000100A;
|
||||
|
||||
/** listbox and richlistbox elements */
|
||||
const long XULListbox = 0x0000100B;
|
||||
|
||||
/** listcell element */
|
||||
const long XULListCell = 0x0000100C;
|
||||
|
||||
/** listheader element */
|
||||
const long XULListHead = 0x0000100D;
|
||||
|
||||
/** listhead element */
|
||||
const long XULListHeader = 0x0000100E;
|
||||
|
||||
/** listitem and richlistitem elements */
|
||||
const long XULListitem = 0x0000100F;
|
||||
|
||||
/** menubar element */
|
||||
const long XULMenubar = 0x00001010;
|
||||
|
||||
/** menuitem element */
|
||||
const long XULMenuitem = 0x00001011;
|
||||
|
||||
/** popup, menupopup element */
|
||||
const long XULMenupopup = 0x00001012;
|
||||
|
||||
/** menuseparator element */
|
||||
const long XULMenuSeparator = 0x00001013;
|
||||
|
||||
/** panel element */
|
||||
const long XULPane = 0x00001014;
|
||||
|
||||
/** progressmeter element */
|
||||
const long XULProgressMeter = 0x00001015;
|
||||
|
||||
/** scale element */
|
||||
const long XULScale = 0x00001016;
|
||||
|
||||
/** scrollbar element */
|
||||
const long XULScrollbar = 0x00001017;
|
||||
|
||||
/** slider element */
|
||||
const long XULSlider = 0x00001018;
|
||||
|
||||
/** statusbar element */
|
||||
const long XULStatusBar = 0x00001019;
|
||||
|
||||
/** radio element */
|
||||
const long XULRadioButton = 0x0000101A;
|
||||
|
||||
/** radiogroup element */
|
||||
const long XULRadioGroup = 0x0000101B;
|
||||
|
||||
/** tab element */
|
||||
const long XULTab = 0x0000101C;
|
||||
|
||||
/** tabbox element, contains tabs and tabpanels elements */
|
||||
const long XULTabBox = 0x0000101D;
|
||||
|
||||
/** tabs element, a collection of tab elements */
|
||||
const long XULTabs = 0x0000101E;
|
||||
|
||||
/** label or description elements */
|
||||
const long XULText = 0x0000101F;
|
||||
|
||||
/** textbox and numberbox elements */
|
||||
const long XULTextBox = 0x00001020;
|
||||
|
||||
/** thumb element, child of scale element */
|
||||
const long XULThumb = 0x00001021;
|
||||
|
||||
/** tree element */
|
||||
const long XULTree = 0x00001022;
|
||||
|
||||
/** treecols element, child of tree element */
|
||||
const long XULTreeColumns = 0x00001023;
|
||||
|
||||
/** treecol element, child of treecols element */
|
||||
const long XULTreeColumnItem = 0x00001024;
|
||||
|
||||
/** toolbar element */
|
||||
const long XULToolbar = 0x00001025;
|
||||
|
||||
/** toolbarseparator, toolbarspacer and toolbarspring elements */
|
||||
const long XULToolbarSeparator = 0x00001026;
|
||||
|
||||
/** tooltip element */
|
||||
const long XULTooltip = 0x00001027;
|
||||
|
||||
/** toolbarbutton element */
|
||||
const long XULToolbarButton = 0x00001028;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -1831,6 +1831,14 @@ nsresult nsAccessibilityService::GetAccessibleByType(nsIDOMNode *aNode,
|
|||
*aAccessible = new nsXULStatusBarAccessible(aNode, weakShell);
|
||||
break;
|
||||
case nsIAccessibleProvider::XULScale:
|
||||
*aAccessible = new nsEnumRoleXBLAccessible(aNode, weakShell,
|
||||
nsIAccessibleRole::ROLE_GROUPING);
|
||||
break;
|
||||
case nsIAccessibleProvider::XULScrollbar:
|
||||
*aAccessible = new nsEnumRoleXBLAccessible(aNode, weakShell,
|
||||
nsIAccessibleRole::ROLE_SCROLLBAR);
|
||||
break;
|
||||
case nsIAccessibleProvider::XULSlider:
|
||||
*aAccessible = new nsXULSliderAccessible(aNode, weakShell);
|
||||
break;
|
||||
case nsIAccessibleProvider::XULRadioButton:
|
||||
|
|
|
@ -308,9 +308,10 @@ nsLinkableAccessible::GetActionAccessible()
|
|||
return accessible;
|
||||
}
|
||||
|
||||
//---------------------
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsEnumRoleAccessible
|
||||
//---------------------
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsEnumRoleAccessible::nsEnumRoleAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell, PRUint32 aRole) :
|
||||
nsAccessibleWrap(aNode, aShell),
|
||||
|
@ -326,3 +327,26 @@ nsEnumRoleAccessible::GetRoleInternal(PRUint32 *aRole)
|
|||
*aRole = mRole;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsEnumRoleXBLAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsEnumRoleXBLAccessible::nsEnumRoleXBLAccessible(nsIDOMNode* aNode,
|
||||
nsIWeakReference* aShell,
|
||||
PRUint32 aRole) :
|
||||
nsEnumRoleAccessible(aNode, aShell, aRole)
|
||||
{
|
||||
}
|
||||
|
||||
// nsPIAccessible
|
||||
NS_IMETHODIMP
|
||||
nsEnumRoleXBLAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aAllowsAnonChildren);
|
||||
|
||||
// Allow accessibles for anonymous content.
|
||||
*aAllowsAnonChildren = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -133,4 +133,21 @@ protected:
|
|||
PRUint32 mRole;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* A simple accessible that gets its enumerated role passed into constructor and
|
||||
* allows children from anonymous content.
|
||||
*/
|
||||
class nsEnumRoleXBLAccessible : public nsEnumRoleAccessible
|
||||
{
|
||||
public:
|
||||
nsEnumRoleXBLAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell,
|
||||
PRUint32 aRole);
|
||||
virtual ~nsEnumRoleXBLAccessible() { }
|
||||
|
||||
// nsPIAccessible
|
||||
NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -41,7 +41,10 @@
|
|||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDOMDocumentXBL.h"
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULSliderAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsXULSliderAccessible::nsXULSliderAccessible(nsIDOMNode* aNode,
|
||||
nsIWeakReference* aShell) :
|
||||
|
@ -132,50 +135,8 @@ nsXULSliderAccessible::SetCurrentValue(double aValue)
|
|||
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<nsIContent>
|
||||
nsXULSliderAccessible::GetSliderNode()
|
||||
{
|
||||
if (!mDOMNode)
|
||||
return nsnull;
|
||||
|
||||
if (!mSliderNode) {
|
||||
nsCOMPtr<nsIDOMDocument> document;
|
||||
mDOMNode->GetOwnerDocument(getter_AddRefs(document));
|
||||
if (!document)
|
||||
return nsnull;
|
||||
|
||||
nsCOMPtr<nsIDOMDocumentXBL> xblDoc(do_QueryInterface(document));
|
||||
if (!xblDoc)
|
||||
return nsnull;
|
||||
|
||||
// XXX: we depend on anonymous content.
|
||||
nsCOMPtr<nsIDOMElement> 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)
|
||||
{
|
||||
|
@ -184,9 +145,7 @@ nsXULSliderAccessible::GetSliderAttr(nsIAtom *aName, nsAString& aValue)
|
|||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContent> sliderNode(GetSliderNode());
|
||||
NS_ENSURE_STATE(sliderNode);
|
||||
|
||||
nsCOMPtr<nsIContent> sliderNode(do_QueryInterface(mDOMNode));
|
||||
sliderNode->GetAttr(kNameSpaceID_None, aName, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -197,9 +156,7 @@ nsXULSliderAccessible::SetSliderAttr(nsIAtom *aName, const nsAString& aValue)
|
|||
if (IsDefunct())
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsCOMPtr<nsIContent> sliderNode(GetSliderNode());
|
||||
NS_ENSURE_STATE(sliderNode);
|
||||
|
||||
nsCOMPtr<nsIContent> sliderNode(do_QueryInterface(mDOMNode));
|
||||
sliderNode->SetAttr(kNameSpaceID_None, aName, aValue, PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -236,14 +193,15 @@ nsXULSliderAccessible::SetSliderAttr(nsIAtom *aName, double aValue)
|
|||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULThumbAccessible
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
nsXULThumbAccessible::nsXULThumbAccessible(nsIDOMNode* aNode,
|
||||
nsIWeakReference* aShell) :
|
||||
nsAccessibleWrap(aNode, aShell) {}
|
||||
|
||||
// nsIAccessible
|
||||
|
||||
// nsAccessible
|
||||
nsresult
|
||||
nsXULThumbAccessible::GetRoleInternal(PRUint32 *aRole)
|
||||
{
|
||||
|
|
|
@ -57,23 +57,15 @@ public:
|
|||
// nsIAccessibleValue
|
||||
NS_DECL_NSIACCESSIBLEVALUE
|
||||
|
||||
// nsPIAccessible
|
||||
NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
|
||||
|
||||
// nsAccessible
|
||||
virtual nsresult GetRoleInternal(PRUint32 *aRole);
|
||||
|
||||
protected:
|
||||
already_AddRefed<nsIContent> 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<nsIDOMElement> mSliderNode;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -81,6 +81,8 @@ _TEST_FILES =\
|
|||
test_descr.html \
|
||||
test_elm_filectrl.html \
|
||||
test_elm_media.html \
|
||||
test_elm_scale.xul \
|
||||
test_elm_scrollbar.html \
|
||||
test_elm_txtcntnr.html \
|
||||
test_events_caretmove.html \
|
||||
test_events_mutation.html \
|
||||
|
|
|
@ -55,6 +55,7 @@ const STATE_EXTSELECTABLE = nsIAccessibleStates.STATE_EXTSELECTABLE;
|
|||
const STATE_FOCUSABLE = nsIAccessibleStates.STATE_FOCUSABLE;
|
||||
const STATE_FOCUSED = nsIAccessibleStates.STATE_FOCUSED;
|
||||
const STATE_HASPOPUP = nsIAccessibleStates.STATE_HASPOPUP;
|
||||
const STATE_INVISIBLE = nsIAccessibleStates.STATE_INVISIBLE;
|
||||
const STATE_LINKED = nsIAccessibleStates.STATE_LINKED;
|
||||
const STATE_MIXED = nsIAccessibleStates.STATE_MIXED;
|
||||
const STATE_MULTISELECTABLE = nsIAccessibleStates.STATE_MULTISELECTABLE;
|
||||
|
@ -278,17 +279,26 @@ function testAccessibleTree(aAccOrElmOrID, aAccTree)
|
|||
return;
|
||||
|
||||
for (var prop in aAccTree) {
|
||||
var msg = "Wrong value of property '" + prop + "'.";
|
||||
if (prop == "role")
|
||||
var msg = "Wrong value of property '" + prop + "' of " +
|
||||
prettyName(acc) + ".";
|
||||
|
||||
if (prop == "role") {
|
||||
is(roleToString(acc[prop]), roleToString(aAccTree[prop]), msg);
|
||||
else if (prop != "children")
|
||||
|
||||
} else if (prop == "states") {
|
||||
var statesObj = aAccTree[prop];
|
||||
testStates(acc, statesObj.states, statesObj.extraStates,
|
||||
statesObj.absentStates, statesObj.absentExtraStates);
|
||||
|
||||
} else if (prop != "children") {
|
||||
is(acc[prop], aAccTree[prop], msg);
|
||||
}
|
||||
}
|
||||
|
||||
if ("children" in aAccTree) {
|
||||
if ("children" in aAccTree && aAccTree["children"] instanceof Array) {
|
||||
var children = acc.children;
|
||||
is(children.length, aAccTree.children.length,
|
||||
"Different amount of expected children.");
|
||||
"Different amount of expected children of " + prettyName(acc) + ".");
|
||||
|
||||
if (aAccTree.children.length == children.length) {
|
||||
for (var i = 0; i < children.length; i++) {
|
||||
|
|
|
@ -15,55 +15,59 @@ function testStates(aAccOrElmOrID, aState, aExtraState, aAbsentState,
|
|||
{
|
||||
var [state, extraState] = getStates(aAccOrElmOrID);
|
||||
|
||||
var id = prettyName(aAccOrElmOrID);
|
||||
|
||||
is(state & aState, aState,
|
||||
"wrong state bits for " + aAccOrElmOrID + "!");
|
||||
"wrong state bits for " + id + "!");
|
||||
|
||||
if (aExtraState)
|
||||
is(extraState & aExtraState, aExtraState,
|
||||
"wrong extra state bits for " + aAccOrElmOrID + "!");
|
||||
"wrong extra state bits for " + id + "!");
|
||||
|
||||
if (aAbsentState)
|
||||
is(state & aAbsentState, 0,
|
||||
"state bits should not be present in ID " + aAccOrElmOrID + "!");
|
||||
"state bits should not be present in ID " + id + "!");
|
||||
|
||||
if (aAbsentExtraState)
|
||||
is(extraState & aAbsentExtraState, 0,
|
||||
"extraState bits should not be present in ID " + aAccOrElmOrID + "!");
|
||||
"extraState bits should not be present in ID " + id + "!");
|
||||
|
||||
if (state & STATE_READONLY)
|
||||
is(extraState & EXT_STATE_EDITABLE, 0,
|
||||
"Read-only " + aAccOrElmOrID + " cannot be editable!");
|
||||
"Read-only " + id + " cannot be editable!");
|
||||
|
||||
if (extraState & EXT_STATE_EDITABLE)
|
||||
is(state & STATE_READONLY, 0,
|
||||
"Editable " + aAccOrElmOrID + " cannot be readonly!");
|
||||
"Editable " + id + " cannot be readonly!");
|
||||
|
||||
if (state & STATE_COLLAPSED || state & STATE_EXPANDED)
|
||||
is(extraState & EXT_STATE_EXPANDABLE, EXT_STATE_EXPANDABLE,
|
||||
"Collapsed or expanded " + aAccOrElmOrID + " should be expandable!");
|
||||
"Collapsed or expanded " + id + " should be expandable!");
|
||||
|
||||
if (state & STATE_COLLAPSED)
|
||||
is(state & STATE_EXPANDED, 0,
|
||||
"Collapsed " + aAccOrElmOrID + " cannot be expanded!");
|
||||
"Collapsed " + id + " cannot be expanded!");
|
||||
|
||||
if (state & STATE_EXPANDED)
|
||||
is(state & STATE_COLLAPSED, 0,
|
||||
"Expanded " + aAccOrElmOrID + " cannot be collapsed!");
|
||||
"Expanded " + id + " cannot be collapsed!");
|
||||
|
||||
if (state & STATE_CHECKED || state & STATE_MIXED)
|
||||
is(state & STATE_CHECKABLE, STATE_CHECKABLE,
|
||||
"Checked or mixed element must be checkable!");
|
||||
"Checked or mixed " + id + " must be checkable!");
|
||||
|
||||
if (state & STATE_CHECKED)
|
||||
is(state & STATE_MIXED, 0, "Checked element cannot be state mixed!");
|
||||
is(state & STATE_MIXED, 0,
|
||||
"Checked " + id + " cannot be state mixed!");
|
||||
|
||||
if (state & STATE_MIXED)
|
||||
is(state & STATE_CHECKED, 0, "Mixed element cannot be state checked!");
|
||||
is(state & STATE_CHECKED, 0,
|
||||
"Mixed " + id + " cannot be state checked!");
|
||||
|
||||
if ((state & STATE_UNAVAILABLE)
|
||||
if ((state & STATE_UNAVAILABLE) && !(state & STATE_INVISIBLE)
|
||||
&& (getRole(aAccOrElmOrID) != ROLE_GROUPING))
|
||||
is(state & STATE_FOCUSABLE, STATE_FOCUSABLE,
|
||||
"Disabled " + aAccOrElmOrID + " must be focusable!");
|
||||
"Disabled " + id + " must be focusable!");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -17,6 +17,7 @@ const ROLE_GRID_CELL = nsIAccessibleRole.ROLE_GRID_CELL;
|
|||
const ROLE_GROUPING = nsIAccessibleRole.ROLE_GROUPING;
|
||||
const ROLE_HEADING = nsIAccessibleRole.ROLE_HEADING;
|
||||
const ROLE_IMAGE_MAP = nsIAccessibleRole.ROLE_IMAGE_MAP;
|
||||
const ROLE_INDICATOR = nsIAccessibleRole.ROLE_INDICATOR;
|
||||
const ROLE_INTERNAL_FRAME = nsIAccessibleRole.ROLE_INTERNAL_FRAME;
|
||||
const ROLE_LABEL = nsIAccessibleRole.ROLE_LABEL;
|
||||
const ROLE_LINK = nsIAccessibleRole.ROLE_LINK;
|
||||
|
@ -29,6 +30,7 @@ const ROLE_PASSWORD_TEXT = nsIAccessibleRole.ROLE_PASSWORD_TEXT;
|
|||
const ROLE_PROGRESSBAR = nsIAccessibleRole.ROLE_PROGRESSBAR;
|
||||
const ROLE_PUSHBUTTON = nsIAccessibleRole.ROLE_PUSHBUTTON;
|
||||
const ROLE_ROW = nsIAccessibleRole.ROLE_ROW;
|
||||
const ROLE_SCROLLBAR = nsIAccessibleRole.ROLE_SCROLLBAR;
|
||||
const ROLE_SECTION = nsIAccessibleRole.ROLE_SECTION;
|
||||
const ROLE_SLIDER = nsIAccessibleRole.ROLE_SLIDER;
|
||||
const ROLE_TABLE = nsIAccessibleRole.ROLE_TABLE;
|
||||
|
|
|
@ -61,8 +61,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483573
|
|||
{ // progress bar
|
||||
role: ROLE_PROGRESSBAR
|
||||
},
|
||||
{ // slider of progress bar
|
||||
role: ROLE_SLIDER
|
||||
{ // scale of progress bar
|
||||
role: ROLE_GROUPING,
|
||||
children: [
|
||||
{ // slider of scale
|
||||
role: ROLE_SLIDER
|
||||
}
|
||||
]
|
||||
},
|
||||
{ // duration label
|
||||
role: ROLE_LABEL
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://mochikit/content/a11y/accessible/nsIAccessible_name.css"
|
||||
type="text/css"?>
|
||||
|
||||
|
||||
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
title="XUL scale element testing">
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js" />
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js" />
|
||||
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
function doTest()
|
||||
{
|
||||
var accTree = {
|
||||
role: ROLE_GROUPING,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_SLIDER,
|
||||
children: [
|
||||
{
|
||||
role: ROLE_INDICATOR
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("scale", accTree);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
]]>
|
||||
</script>
|
||||
|
||||
<body xmlns="http://www.w3.org/1999/xhtml">
|
||||
<a target="_blank"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=285167"
|
||||
title="Mozilla doesn't support Scrollbar accessible">
|
||||
Mozilla Bug 285167
|
||||
</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
|
||||
<scale id="scale" min="0" max="10" value="2"/>
|
||||
|
||||
</window>
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<title>scrollbar tests</title>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/a11y/accessible/nsIAccessible_states.js"></script>
|
||||
|
||||
<script type="application/javascript">
|
||||
|
||||
/**
|
||||
* Return states object for scrollbar depending on it is visible or not.
|
||||
*/
|
||||
function getScrollbarStates(aVisible)
|
||||
{
|
||||
var states = {
|
||||
states: aVisible ? 0 : STATE_INVISIBLE,
|
||||
extraStates: 0,
|
||||
absentStates: aVisible ? STATE_INVISIBLE : 0,
|
||||
absentExtraStates: 0
|
||||
};
|
||||
|
||||
return states;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return structure describing subtree of scrollbar
|
||||
*/
|
||||
function getScrollbarChildren(aVisible)
|
||||
{
|
||||
var children =
|
||||
[
|
||||
{
|
||||
role: ROLE_PUSHBUTTON
|
||||
},
|
||||
{
|
||||
role: ROLE_SLIDER,
|
||||
children: (aVisible ? [ { role: ROLE_INDICATOR } ] : null)
|
||||
},
|
||||
{
|
||||
role: ROLE_PUSHBUTTON
|
||||
}
|
||||
];
|
||||
|
||||
return children;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return accessible tree for testing (passed into testAccessibleTree
|
||||
* function).
|
||||
*
|
||||
* @param aHorizontalScrollbar true if horizontal scrollbar is presented
|
||||
* @param aVerticalScrollbar true if vertical scrollbar is presented
|
||||
*/
|
||||
function getAccTreeForScrollableArea(aHorizontalScrollbar,
|
||||
aVerticalScrollbar)
|
||||
{
|
||||
var accTree = {
|
||||
role: ROLE_SECTION,
|
||||
children: [
|
||||
{ // horizontal scrollbar
|
||||
role: ROLE_SCROLLBAR,
|
||||
states: getScrollbarStates(aHorizontalScrollbar),
|
||||
children: getScrollbarChildren(aHorizontalScrollbar)
|
||||
},
|
||||
{ // vertical scrollbar
|
||||
role: ROLE_SCROLLBAR,
|
||||
states: getScrollbarStates(aVerticalScrollbar),
|
||||
children: getScrollbarChildren(aVerticalScrollbar)
|
||||
},
|
||||
{ // text child
|
||||
role: ROLE_TEXT_LEAF,
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
return accTree;
|
||||
}
|
||||
|
||||
function doTest()
|
||||
{
|
||||
testAccessibleTree("c1", getAccTreeForScrollableArea(false, true));
|
||||
testAccessibleTree("c2", getAccTreeForScrollableArea(true, false));
|
||||
testAccessibleTree("c3", getAccTreeForScrollableArea(true, true));
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addA11yLoadEvent(doTest);
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<a target="_blank"
|
||||
title="Mozilla doesn't support Scrollbar accessible"
|
||||
href="https://bugzilla.mozilla.org/show_bug.cgi?id=285167">Mozilla Bug 285167</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none"></div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
|
||||
<div id="c1" style="width: 100px; height: 100px; overflow: auto;">
|
||||
1hellohello 2hellohello 3hellohello 4hellohello 5hellohello 6hellohello 7hellohello
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<div id="c2" style="width: 100px; height: 100px; overflow: auto;">
|
||||
1hellohellohellohello 2hellohellohellohello 3hellohellohellohello
|
||||
</div>
|
||||
<br>
|
||||
|
||||
<div id="c3" style="width: 100px; height: 100px; overflow: auto;">
|
||||
1hellohellohellohello 2hellohellohellohello 3hellohellohellohello 4hellohellohellohello 5hellohellohellohello 6hellohellohellohello 7hellohellohellohello
|
||||
</div>
|
||||
<br>
|
||||
</body>
|
||||
</html>
|
|
@ -18,7 +18,24 @@
|
|||
<script type="application/javascript">
|
||||
function doTest()
|
||||
{
|
||||
var accTree = {
|
||||
var c1Tree = {
|
||||
role: ROLE_SECTION,
|
||||
children: [
|
||||
{ // horizontal scrollbar
|
||||
role: ROLE_SCROLLBAR,
|
||||
},
|
||||
{ // vertical scrollbar
|
||||
role: ROLE_SCROLLBAR,
|
||||
},
|
||||
{ // text child
|
||||
role: ROLE_TEXT_LEAF
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("c1", c1Tree);
|
||||
|
||||
var c2Tree = {
|
||||
role: ROLE_SECTION,
|
||||
children: [
|
||||
{ // text child
|
||||
|
@ -27,8 +44,7 @@
|
|||
]
|
||||
};
|
||||
|
||||
testAccessibleTree("c1", accTree);
|
||||
testAccessibleTree("c2", accTree);
|
||||
testAccessibleTree("c2", c2Tree);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
|
|
@ -26,8 +26,10 @@
|
|||
testValue("pm3", "0%", 0, 0, 1, 0);
|
||||
|
||||
// scale
|
||||
testValue("sc1", "500", 500, 0, 1000, 10);
|
||||
testValue("sc2", "", 0, 0, 0, 0);
|
||||
var sc1 = getAccessible("sc1").firstChild;
|
||||
testValue(sc1, "500", 500, 0, 1000, 10);
|
||||
var sc2 = getAccessible("sc2").firstChild;
|
||||
testValue(sc2, "", 0, 0, 0, 0);
|
||||
|
||||
// aria progressbar
|
||||
testValue("ariapb1", "500", 500, 0, 1000, 0);
|
||||
|
|
|
@ -5,18 +5,11 @@
|
|||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="scalethumb" extends="xul:button">
|
||||
<binding id="scalethumb"
|
||||
extends="chrome://global/content/bindings/scrollbar.xml#thumb">
|
||||
<resources>
|
||||
<stylesheet src="chrome://global/skin/scale.css"/>
|
||||
</resources>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
return Components.interfaces.nsIAccessibleProvider.XULThumb;
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="scaleslider" display="xul:slider"
|
||||
|
@ -24,6 +17,14 @@
|
|||
<resources>
|
||||
<stylesheet src="chrome://global/skin/scale.css"/>
|
||||
</resources>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
return Components.interfaces.nsIAccessibleProvider.XULSlider;
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="scale"
|
||||
|
|
|
@ -5,7 +5,35 @@
|
|||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:xbl="http://www.mozilla.org/xbl">
|
||||
|
||||
<binding id="thumb" extends="xul:button" />
|
||||
<binding id="thumb" extends="xul:button">
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
return Components.interfaces.nsIAccessibleProvider.XULThumb;
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="slider">
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
return Components.interfaces.nsIAccessibleProvider.XULSlider;
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="scrollbarbutton">
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
return Components.interfaces.nsIAccessibleProvider.XULButton;
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
|
||||
<binding id="scrollbar-base">
|
||||
<handlers>
|
||||
|
@ -27,5 +55,13 @@
|
|||
<xul:scrollbarbutton sbattr="scrollbar-up-bottom" type="decrement" xbl:inherits="curpos,maxpos,disabled,sborient=orient"/>
|
||||
<xul:scrollbarbutton sbattr="scrollbar-down-bottom" type="increment" xbl:inherits="curpos,maxpos,disabled,sborient=orient"/>
|
||||
</content>
|
||||
|
||||
<implementation implements="nsIAccessibleProvider">
|
||||
<property name="accessibleType" readonly="true">
|
||||
<getter>
|
||||
return Components.interfaces.nsIAccessibleProvider.XULScrollbar;
|
||||
</getter>
|
||||
</property>
|
||||
</implementation>
|
||||
</binding>
|
||||
</bindings>
|
||||
|
|
|
@ -886,10 +886,18 @@ scrollbar[value="hidden"] {
|
|||
visibility: hidden;
|
||||
}
|
||||
|
||||
scrollbarbutton {
|
||||
-moz-binding: url(chrome://global/content/bindings/scrollbar.xml#scrollbarbutton);
|
||||
}
|
||||
|
||||
scale {
|
||||
-moz-binding: url(chrome://global/content/bindings/scale.xml#scale);
|
||||
}
|
||||
|
||||
slider {
|
||||
-moz-binding: url(chrome://global/content/bindings/scrollbar.xml#slider);
|
||||
}
|
||||
|
||||
.scale-slider {
|
||||
-moz-binding: url(chrome://global/content/bindings/scale.xml#scaleslider);
|
||||
-moz-user-focus: normal;
|
||||
|
|
Загрузка…
Ссылка в новой задаче