mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 05:11:16 +00:00
Bug 1887799 part 4: Implement the UIA TableItem pattern. r=nlapre
Differential Revision: https://phabricator.services.mozilla.com/D208277
This commit is contained in:
parent
8985774454
commit
979b3a6c2c
@ -45,6 +45,22 @@ async function testGridItemProps(id, row, col, rowSpan, colSpan, gridId) {
|
||||
);
|
||||
}
|
||||
|
||||
async function testTableItemProps(id, rowHeaders, colHeaders) {
|
||||
await assignPyVarToUiaWithId(id);
|
||||
await definePyVar("pattern", `getUiaPattern(${id}, "TableItem")`);
|
||||
ok(await runPython(`bool(pattern)`), `${id} has TableItem pattern`);
|
||||
await isUiaElementArray(
|
||||
`pattern.GetCurrentRowHeaderItems()`,
|
||||
rowHeaders,
|
||||
`${id} has correct RowHeaderItems`
|
||||
);
|
||||
await isUiaElementArray(
|
||||
`pattern.GetCurrentColumnHeaderItems()`,
|
||||
colHeaders,
|
||||
`${id} has correct ColumnHeaderItems`
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the Grid pattern.
|
||||
*/
|
||||
@ -90,3 +106,20 @@ addUiaTask(SNIPPET, async function testGridItem() {
|
||||
|
||||
await testPatternAbsent("button", "GridItem");
|
||||
});
|
||||
|
||||
/**
|
||||
* Test the TableItem pattern.
|
||||
*/
|
||||
addUiaTask(SNIPPET, async function testTableItem() {
|
||||
await definePyVar("doc", `getDocUia()`);
|
||||
await testTableItemProps("a", [], []);
|
||||
await testTableItemProps("b", [], []);
|
||||
await testTableItemProps("c", [], []);
|
||||
await testTableItemProps("dg", [], ["a"]);
|
||||
await testTableItemProps("ef", ["dg"], ["b", "c"]);
|
||||
await testTableItemProps("h", ["dg"], ["b"]);
|
||||
await testTableItemProps("i", ["dg", "h"], ["c"]);
|
||||
await testTableItemProps("jkl", [], ["a", "b", "c"]);
|
||||
|
||||
await testPatternAbsent("button", "TableItem");
|
||||
});
|
||||
|
@ -28,6 +28,7 @@ TableCellAccessible* ia2AccessibleTableCell::CellAcc() {
|
||||
IMPL_IUNKNOWN_QUERY_HEAD(ia2AccessibleTableCell)
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(IAccessibleTableCell)
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(IGridItemProvider)
|
||||
IMPL_IUNKNOWN_QUERY_IFACE(ITableItemProvider)
|
||||
IMPL_IUNKNOWN_QUERY_TAIL_INHERITED(ia2AccessibleHypertext)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -94,3 +94,37 @@ UiaGridItem::get_ContainingGrid(
|
||||
uia.forget(aRetVal);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
// ITableItemProvider methods
|
||||
|
||||
STDMETHODIMP
|
||||
UiaGridItem::GetRowHeaderItems(__RPC__deref_out_opt SAFEARRAY** aRetVal) {
|
||||
if (!aRetVal) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
*aRetVal = nullptr;
|
||||
TableCellAccessible* cell = CellAcc();
|
||||
if (!cell) {
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
}
|
||||
AutoTArray<Accessible*, 10> cells;
|
||||
cell->RowHeaderCells(&cells);
|
||||
*aRetVal = AccessibleArrayToUiaArray(cells);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHODIMP
|
||||
UiaGridItem::GetColumnHeaderItems(__RPC__deref_out_opt SAFEARRAY** aRetVal) {
|
||||
if (!aRetVal) {
|
||||
return E_INVALIDARG;
|
||||
}
|
||||
*aRetVal = nullptr;
|
||||
TableCellAccessible* cell = CellAcc();
|
||||
if (!cell) {
|
||||
return CO_E_OBJNOTCONNECTED;
|
||||
}
|
||||
AutoTArray<Accessible*, 10> cells;
|
||||
cell->ColHeaderCells(&cells);
|
||||
*aRetVal = AccessibleArrayToUiaArray(cells);
|
||||
return S_OK;
|
||||
}
|
||||
|
@ -14,9 +14,9 @@ namespace mozilla::a11y {
|
||||
class TableCellAccessible;
|
||||
|
||||
/**
|
||||
* IGridItemProvider implementation.
|
||||
* IGridItemProvider and ITableItemProvider implementations.
|
||||
*/
|
||||
class UiaGridItem : public IGridItemProvider {
|
||||
class UiaGridItem : public IGridItemProvider, public ITableItemProvider {
|
||||
public:
|
||||
// IGridItemProvider
|
||||
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Row(
|
||||
@ -35,6 +35,13 @@ class UiaGridItem : public IGridItemProvider {
|
||||
/* [retval][out] */ __RPC__deref_out_opt IRawElementProviderSimple**
|
||||
aRetVal);
|
||||
|
||||
// ITableItemProvider
|
||||
virtual HRESULT STDMETHODCALLTYPE GetRowHeaderItems(
|
||||
/* [retval][out] */ __RPC__deref_out_opt SAFEARRAY** aRetVal);
|
||||
|
||||
virtual HRESULT STDMETHODCALLTYPE GetColumnHeaderItems(
|
||||
/* [retval][out] */ __RPC__deref_out_opt SAFEARRAY** aRetVal);
|
||||
|
||||
private:
|
||||
TableCellAccessible* CellAcc();
|
||||
};
|
||||
|
@ -313,6 +313,13 @@ uiaRawElmProvider::GetPatternProvider(
|
||||
scroll.forget(aPatternProvider);
|
||||
return S_OK;
|
||||
}
|
||||
case UIA_TableItemPatternId:
|
||||
if (acc->IsTableCell()) {
|
||||
auto item =
|
||||
GetPatternFromDerived<ia2AccessibleTableCell, ITableItemProvider>();
|
||||
item.forget(aPatternProvider);
|
||||
}
|
||||
return S_OK;
|
||||
case UIA_TogglePatternId:
|
||||
if (HasTogglePattern()) {
|
||||
RefPtr<IToggleProvider> toggle = this;
|
||||
|
Loading…
Reference in New Issue
Block a user