mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 726069 - get rid nsAccUtils::GetPositionAndSizeForXULContainerItem, r=hub, f=surkov
This commit is contained in:
parent
33fe479cbf
commit
4f94d3def4
@ -66,6 +66,8 @@ public:
|
||||
role != mozilla::a11y::roles::OPTION &&
|
||||
role != mozilla::a11y::roles::LISTITEM &&
|
||||
role != mozilla::a11y::roles::MENUITEM &&
|
||||
role != mozilla::a11y::roles::COMBOBOX_OPTION &&
|
||||
role != mozilla::a11y::roles::PARENT_MENUITEM &&
|
||||
role != mozilla::a11y::roles::CHECK_MENU_ITEM &&
|
||||
role != mozilla::a11y::roles::RADIO_MENU_ITEM &&
|
||||
role != mozilla::a11y::roles::RADIOBUTTON &&
|
||||
@ -83,6 +85,7 @@ private:
|
||||
static mozilla::a11y::role BaseRole(mozilla::a11y::role aRole)
|
||||
{
|
||||
if (aRole == mozilla::a11y::roles::CHECK_MENU_ITEM ||
|
||||
aRole == mozilla::a11y::roles::PARENT_MENUITEM ||
|
||||
aRole == mozilla::a11y::roles::RADIO_MENU_ITEM)
|
||||
return mozilla::a11y::roles::MENUITEM;
|
||||
return aRole;
|
||||
|
@ -175,70 +175,6 @@ nsAccUtils::GetPositionAndSizeForXULSelectControlItem(nsIContent *aContent,
|
||||
(*aPosInSet)++; // group position is 1-index based.
|
||||
}
|
||||
|
||||
void
|
||||
nsAccUtils::GetPositionAndSizeForXULContainerItem(nsIContent *aContent,
|
||||
PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
nsCOMPtr<nsIDOMXULContainerItemElement> item(do_QueryInterface(aContent));
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
nsCOMPtr<nsIDOMXULContainerElement> container;
|
||||
item->GetParentContainer(getter_AddRefs(container));
|
||||
if (!container)
|
||||
return;
|
||||
|
||||
// Get item count.
|
||||
PRUint32 itemsCount = 0;
|
||||
container->GetItemCount(&itemsCount);
|
||||
|
||||
// Get item index.
|
||||
PRInt32 indexOf = 0;
|
||||
container->GetIndexOfItem(item, &indexOf);
|
||||
|
||||
// Calculate set size and position in the set.
|
||||
*aSetSize = 0, *aPosInSet = 0;
|
||||
for (PRInt32 index = indexOf; index >= 0; index--) {
|
||||
nsCOMPtr<nsIDOMXULElement> item;
|
||||
container->GetItemAtIndex(index, getter_AddRefs(item));
|
||||
nsCOMPtr<nsINode> itemNode(do_QueryInterface(item));
|
||||
|
||||
nsAccessible* itemAcc = itemNode ?
|
||||
GetAccService()->GetAccessible(itemNode, nsnull) : nsnull;
|
||||
|
||||
if (itemAcc) {
|
||||
PRUint32 itemRole = Role(itemAcc);
|
||||
if (itemRole == nsIAccessibleRole::ROLE_SEPARATOR)
|
||||
break; // We reached the beginning of our group.
|
||||
|
||||
if (!(itemAcc->State() & states::INVISIBLE)) {
|
||||
(*aSetSize)++;
|
||||
(*aPosInSet)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (PRInt32 index = indexOf + 1; index < static_cast<PRInt32>(itemsCount);
|
||||
index++) {
|
||||
nsCOMPtr<nsIDOMXULElement> item;
|
||||
container->GetItemAtIndex(index, getter_AddRefs(item));
|
||||
nsCOMPtr<nsINode> itemNode(do_QueryInterface(item));
|
||||
|
||||
nsAccessible* itemAcc =
|
||||
itemNode ? GetAccService()->GetAccessible(itemNode, nsnull) : nsnull;
|
||||
|
||||
if (itemAcc) {
|
||||
PRUint32 itemRole = Role(itemAcc);
|
||||
if (itemRole == nsIAccessibleRole::ROLE_SEPARATOR)
|
||||
break; // We reached the end of our group.
|
||||
|
||||
if (!(itemAcc->State() & states::INVISIBLE))
|
||||
(*aSetSize)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
PRInt32
|
||||
nsAccUtils::GetLevelForXULContainerItem(nsIContent *aContent)
|
||||
{
|
||||
|
@ -115,14 +115,6 @@ public:
|
||||
PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
|
||||
/**
|
||||
* Compute group position and group size (posinset and setsize) for
|
||||
* nsIDOMXULContainerItemElement node.
|
||||
*/
|
||||
static void GetPositionAndSizeForXULContainerItem(nsIContent *aContent,
|
||||
PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
|
||||
/**
|
||||
* Compute group level for nsIDOMXULContainerItemElement node.
|
||||
*/
|
||||
|
@ -311,14 +311,6 @@ nsXULMenuitemAccessible::GetLevelInternal()
|
||||
return nsAccUtils::GetLevelForXULContainerItem(mContent);
|
||||
}
|
||||
|
||||
void
|
||||
nsXULMenuitemAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize)
|
||||
{
|
||||
nsAccUtils::GetPositionAndSizeForXULContainerItem(mContent, aPosInSet,
|
||||
aSetSize);
|
||||
}
|
||||
|
||||
bool
|
||||
nsXULMenuitemAccessible::CanHaveAnonChildren()
|
||||
{
|
||||
|
@ -63,8 +63,6 @@ public:
|
||||
virtual mozilla::a11y::role NativeRole();
|
||||
virtual PRUint64 NativeState();
|
||||
virtual PRInt32 GetLevelInternal();
|
||||
virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
|
||||
PRInt32 *aSetSize);
|
||||
|
||||
virtual bool CanHaveAnonChildren();
|
||||
|
||||
|
@ -139,6 +139,13 @@
|
||||
testGroupAttrs("h5", 0, 0, 5);
|
||||
testGroupAttrs("h6", 0, 0, 6);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ARIA combobox
|
||||
testGroupAttrs("combo1_opt1", 1, 4);
|
||||
testGroupAttrs("combo1_opt2", 2, 4);
|
||||
testGroupAttrs("combo1_opt3", 3, 4);
|
||||
testGroupAttrs("combo1_opt4", 4, 4);
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
@ -305,5 +312,12 @@
|
||||
<h5 id="h5">heading5</h5>
|
||||
<h6 id="h6">heading6</h6>
|
||||
|
||||
<ul id="combo1" role="combobox">Password
|
||||
<li id="combo1_opt1" role="option">Xyzzy</li>
|
||||
<li id="combo1_opt2" role="option">Plughs</li>
|
||||
<li id="combo1_opt3" role="option">Shazaam</li>
|
||||
<li id="combo1_opt4" role="option">JoeSentMe</li>
|
||||
</ul>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
@ -90,6 +90,13 @@
|
||||
testGroupAttrs("radio1", 1, 2);
|
||||
testGroupAttrs("radio2", 2, 2);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// xul:menulist
|
||||
testGroupAttrs("menulist1.1", 1);
|
||||
testGroupAttrs("menulist1.2", 2);
|
||||
testGroupAttrs("menulist1.3", 3);
|
||||
testGroupAttrs("menulist1.4", 4);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// ARIA menu (bug 441888)
|
||||
testGroupAttrs("aria-menuitem", 1, 3);
|
||||
@ -175,6 +182,15 @@
|
||||
<radio id="radio2" label="radio2"/>
|
||||
</radiogroup>
|
||||
|
||||
<menulist id="menulist1" label="Vehicle">
|
||||
<menupopup>
|
||||
<menuitem id="menulist1.1" label="Car"/>
|
||||
<menuitem id="menulist1.2" label="Taxi"/>
|
||||
<menuitem id="menulist1.3" label="Bus" selected="true"/>
|
||||
<menuitem id="menulist1.4" label="Train"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
|
||||
<vbox>
|
||||
<description role="menuitem" id="aria-menuitem"
|
||||
value="conventional menuitem"/>
|
||||
|
Loading…
Reference in New Issue
Block a user