mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 17:23:59 +00:00
Bug 726071 - get rid nsAccUtilsGetPositionAndSizeForXULSelectControlItem, r=surkov, f=tbsaunde
This commit is contained in:
parent
19b6b7943a
commit
88c8cc7fea
@ -792,10 +792,15 @@ interface nsIAccessibleRole : nsISupports
|
||||
*/
|
||||
const unsigned long ROLE_FIGURE = 124;
|
||||
|
||||
/**
|
||||
* Represents a rich item with a check box.
|
||||
*/
|
||||
const unsigned long ROLE_CHECK_RICH_OPTION = 125;
|
||||
|
||||
/**
|
||||
* It's not role actually. This constant is important to help ensure
|
||||
* nsRoleMap's are synchronized.
|
||||
*/
|
||||
const unsigned long ROLE_LAST_ENTRY = 125;
|
||||
const unsigned long ROLE_LAST_ENTRY = 126;
|
||||
};
|
||||
|
||||
|
@ -170,6 +170,7 @@ static const PRUint32 atkRoleMap[] = {
|
||||
ATK_ROLE_PANEL, // roles::EMBEDDED_OBJECT 122
|
||||
ATK_ROLE_SECTION, // roles::NOTE 123
|
||||
ATK_ROLE_PANEL, // roles::FIGURE 124
|
||||
ATK_ROLE_CHECK_BOX, // roles::CHECK_RICH_OPTION 125
|
||||
kROLE_ATK_LAST_ENTRY // roles::LAST_ENTRY
|
||||
};
|
||||
|
||||
|
@ -67,6 +67,8 @@ public:
|
||||
role != mozilla::a11y::roles::LISTITEM &&
|
||||
role != mozilla::a11y::roles::MENUITEM &&
|
||||
role != mozilla::a11y::roles::COMBOBOX_OPTION &&
|
||||
role != mozilla::a11y::roles::RICH_OPTION &&
|
||||
role != mozilla::a11y::roles::CHECK_RICH_OPTION &&
|
||||
role != mozilla::a11y::roles::PARENT_MENUITEM &&
|
||||
role != mozilla::a11y::roles::CHECK_MENU_ITEM &&
|
||||
role != mozilla::a11y::roles::RADIO_MENU_ITEM &&
|
||||
@ -88,6 +90,10 @@ private:
|
||||
aRole == mozilla::a11y::roles::PARENT_MENUITEM ||
|
||||
aRole == mozilla::a11y::roles::RADIO_MENU_ITEM)
|
||||
return mozilla::a11y::roles::MENUITEM;
|
||||
|
||||
if (aRole == mozilla::a11y::roles::CHECK_RICH_OPTION)
|
||||
return mozilla::a11y::roles::RICH_OPTION;
|
||||
|
||||
return aRole;
|
||||
}
|
||||
|
||||
|
@ -789,11 +789,16 @@ namespace roles {
|
||||
*/
|
||||
FIGURE = 124,
|
||||
|
||||
/**
|
||||
* Represents a rich item with a check box.
|
||||
*/
|
||||
CHECK_RICH_OPTION = 125,
|
||||
|
||||
/**
|
||||
* It's not role actually. This constant is important to help ensure
|
||||
* nsRoleMap's are synchronized.
|
||||
*/
|
||||
LAST_ENTRY = 125
|
||||
LAST_ENTRY = 126
|
||||
};
|
||||
} // namespace role
|
||||
typedef enum mozilla::a11y::roles::Role role;
|
||||
|
@ -134,47 +134,6 @@ nsAccUtils::GetARIAOrDefaultLevel(nsAccessible *aAccessible)
|
||||
return GetDefaultLevel(aAccessible);
|
||||
}
|
||||
|
||||
void
|
||||
nsAccUtils::GetPositionAndSizeForXULSelectControlItem(nsIContent *aContent,
|
||||
PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> item(do_QueryInterface(aContent));
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDOMXULSelectControlElement> control;
|
||||
item->GetControl(getter_AddRefs(control));
|
||||
if (!control)
|
||||
return;
|
||||
|
||||
PRUint32 itemsCount = 0;
|
||||
control->GetItemCount(&itemsCount);
|
||||
|
||||
PRInt32 indexOf = 0;
|
||||
control->GetIndexOfItem(item, &indexOf);
|
||||
|
||||
*aSetSize = itemsCount;
|
||||
*aPosInSet = indexOf;
|
||||
|
||||
for (PRUint32 index = 0; index < itemsCount; index++) {
|
||||
nsCOMPtr<nsIDOMXULSelectControlItemElement> currItem;
|
||||
control->GetItemAtIndex(index, getter_AddRefs(currItem));
|
||||
nsCOMPtr<nsINode> currNode(do_QueryInterface(currItem));
|
||||
|
||||
nsAccessible* itemAcc = currNode ?
|
||||
GetAccService()->GetAccessible(currNode, nsnull) : nsnull;
|
||||
|
||||
if (!itemAcc || itemAcc->State() & states::INVISIBLE) {
|
||||
(*aSetSize)--;
|
||||
if (index < static_cast<PRUint32>(indexOf))
|
||||
(*aPosInSet)--;
|
||||
}
|
||||
}
|
||||
|
||||
(*aPosInSet)++; // group position is 1-index based.
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsAccUtils::GetLevelForXULContainerItem(nsIContent *aContent)
|
||||
{
|
||||
|
@ -107,14 +107,6 @@ public:
|
||||
*/
|
||||
static PRInt32 GetARIAOrDefaultLevel(nsAccessible *aAccessible);
|
||||
|
||||
/**
|
||||
* Compute position in group (posinset) and group size (setsize) for
|
||||
* nsIDOMXULSelectControlItemElement node.
|
||||
*/
|
||||
static void GetPositionAndSizeForXULSelectControlItem(nsIContent *aContent,
|
||||
PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
|
||||
/**
|
||||
* Compute group level for nsIDOMXULContainerItemElement node.
|
||||
*/
|
||||
|
@ -415,7 +415,8 @@ static const char kRoleNames[][20] = {
|
||||
"gridcell", //ROLE_GRID_CELL
|
||||
"embedded object", //ROLE_EMBEDDED_OBJECT
|
||||
"note", //ROLE_NOTE
|
||||
"figure" //ROLE_FIGURE
|
||||
"figure", //ROLE_FIGURE
|
||||
"check rich option" //ROLE_CHECK_RICH_OPTION
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -167,5 +167,6 @@ static const NSString* AXRoles [] = {
|
||||
NSAccessibilityGroupRole, // ROLE_EMBEDDED_OBJECT
|
||||
NSAccessibilityGroupRole, // ROLE_NOTE
|
||||
NSAccessibilityGroupRole, // ROLE_FIGURE
|
||||
NSAccessibilityCheckBoxRole, // ROLE_CHECK_RICH_OPTION
|
||||
@"ROLE_LAST_ENTRY" // ROLE_LAST_ENTRY. bogus role that will never be shown (just marks the end of this array)!
|
||||
};
|
||||
|
@ -449,6 +449,9 @@ static const WindowsRoleMapItem gWindowsRoleMap[] = {
|
||||
// roles::FIGURE
|
||||
{ ROLE_SYSTEM_GROUPING, ROLE_SYSTEM_GROUPING },
|
||||
|
||||
// roles::CHECK_RICH_OPTION
|
||||
{ ROLE_SYSTEM_CHECKBUTTON, ROLE_SYSTEM_CHECKBUTTON },
|
||||
|
||||
// roles::LAST_ENTRY
|
||||
{ ROLE_WINDOWS_LAST_ENTRY, ROLE_WINDOWS_LAST_ENTRY }
|
||||
};
|
||||
|
@ -527,14 +527,6 @@ nsXULRadioButtonAccessible::NativeState()
|
||||
return state;
|
||||
}
|
||||
|
||||
void
|
||||
nsXULRadioButtonAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
nsAccUtils::GetPositionAndSizeForXULSelectControlItem(mContent, aPosInSet,
|
||||
aSetSize);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULRadioButtonAccessible: Widgets
|
||||
|
||||
|
@ -162,8 +162,6 @@ public:
|
||||
nsXULRadioButtonAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
|
||||
|
||||
// nsAccessible
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
virtual PRUint64 NativeState();
|
||||
|
||||
// Widgets
|
||||
|
@ -976,7 +976,7 @@ nsXULListitemAccessible::NativeRole()
|
||||
return roles::ROW;
|
||||
|
||||
if (mIsCheckbox)
|
||||
return roles::CHECKBUTTON;
|
||||
return roles::CHECK_RICH_OPTION;
|
||||
|
||||
if (mParent && mParent->Role() == roles::COMBOBOX_LIST)
|
||||
return roles::COMBOBOX_OPTION;
|
||||
@ -1031,14 +1031,6 @@ nsXULListitemAccessible::CanHaveAnonChildren()
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
nsXULListitemAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
nsAccUtils::GetPositionAndSizeForXULSelectControlItem(mContent, aPosInSet,
|
||||
aSetSize);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULListitemAccessible: Widgets
|
||||
|
||||
|
@ -139,8 +139,6 @@ public:
|
||||
virtual nsresult GetNameInternal(nsAString& aName);
|
||||
virtual mozilla::a11y::role NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
virtual bool CanHaveAnonChildren();
|
||||
|
||||
// Widgets
|
||||
|
@ -164,14 +164,6 @@ nsXULTabAccessible::RelationByType(PRUint32 aType)
|
||||
return rel;
|
||||
}
|
||||
|
||||
void
|
||||
nsXULTabAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
nsAccUtils::GetPositionAndSizeForXULSelectControlItem(mContent, aPosInSet,
|
||||
aSetSize);
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsXULTabsAccessible
|
||||
|
@ -59,8 +59,6 @@ public:
|
||||
NS_IMETHOD DoAction(PRUint8 index);
|
||||
|
||||
// nsAccessible
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
virtual mozilla::a11y::role NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual Relation RelationByType(PRUint32 aType);
|
||||
|
@ -77,8 +77,10 @@
|
||||
{
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// xul:listbox (bug 417317)
|
||||
testGroupAttrs("item1", 1, 2);
|
||||
testGroupAttrs("item2", 2, 2);
|
||||
testGroupAttrs("listitem1", 1, 4);
|
||||
testGroupAttrs("listitem2", 2, 4);
|
||||
testGroupAttrs("listitem3", 3, 4);
|
||||
testGroupAttrs("listitem4", 4, 4);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// xul:tab
|
||||
@ -143,9 +145,12 @@
|
||||
</body>
|
||||
|
||||
<vbox flex="1">
|
||||
|
||||
<listbox>
|
||||
<listitem label="item1" id="item1"/>
|
||||
<listitem label="item2" id="item2"/>
|
||||
<listitem label="listitem1" id="listitem1"/>
|
||||
<listitem label="listitem2" id="listitem2" type="checkbox"/>
|
||||
<listitem label="listitem3" id="listitem3" type="checkbox"/>
|
||||
<listitem label="listitem4" id="listitem4"/>
|
||||
</listbox>
|
||||
|
||||
<menubar>
|
||||
|
Loading…
Reference in New Issue
Block a user