Bug 1862437: Return the correct data for ATK get_row_column_span. r=eeejay

Previously, this incorrectly returned the row in the column field, the column in the row field, and the column span for both the row and column spans.

Differential Revision: https://phabricator.services.mozilla.com/D192912
This commit is contained in:
James Teh 2023-11-21 23:34:15 +00:00
Родитель 49f664a9d4
Коммит 3396179cba
3 изменённых файлов: 59 добавлений и 4 удалений

Просмотреть файл

@ -49,8 +49,8 @@ static gboolean GetPositionCB(AtkTableCell* aCell, gint* aRow, gint* aCol) {
return true;
}
static gboolean GetColumnRowSpanCB(AtkTableCell* aCell, gint* aCol, gint* aRow,
gint* aColExtent, gint* aRowExtent) {
static gboolean GetRowColumnSpanCB(AtkTableCell* aCell, gint* aRow, gint* aCol,
gint* aRowExtent, gint* aColExtent) {
Accessible* acc = GetInternalObj(ATK_OBJECT(aCell));
if (!acc) {
return false;
@ -62,7 +62,7 @@ static gboolean GetColumnRowSpanCB(AtkTableCell* aCell, gint* aCol, gint* aRow,
*aCol = static_cast<gint>(cellAcc->ColIdx());
*aRow = static_cast<gint>(cellAcc->RowIdx());
*aColExtent = static_cast<gint>(cellAcc->ColExtent());
*aRowExtent = static_cast<gint>(cellAcc->ColExtent());
*aRowExtent = static_cast<gint>(cellAcc->RowExtent());
return true;
}
@ -143,6 +143,6 @@ void tableCellInterfaceInitCB(AtkTableCellIface* aIface) {
aIface->get_position = GetPositionCB;
aIface->get_row_span = GetRowSpanCB;
aIface->get_row_header_cells = GetRowHeaderCellsCB;
aIface->get_row_column_span = GetColumnRowSpanCB;
aIface->get_row_column_span = GetRowColumnSpanCB;
aIface->get_table = GetTableCB;
}

Просмотреть файл

@ -13,3 +13,4 @@ prefs = [
]
["browser_role.js"]
["browser_table.js"]

Просмотреть файл

@ -0,0 +1,54 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
/**
* Test getRowColumnSpan.
*/
addAccessibleTask(
`
<table>
<tr>
<th id="ab" colspan="2">ab</th>
<td id="cf" rowspan="2">cf</td>
</tr>
<tr>
<td id="d">d</td>
<td>e</td>
</tr>
</table>
`,
async function (browser, docAcc) {
let result = await runPython(`
global doc
doc = getDoc()
ab = findByDomId(doc, "ab")
return str(ab.queryTableCell().getRowColumnSpan())
`);
is(
result,
"(row=0, column=0, row_span=1, column_span=2)",
"ab getColumnRowSpan correct"
);
result = await runPython(`
cf = findByDomId(doc, "cf")
return str(cf.queryTableCell().getRowColumnSpan())
`);
is(
result,
"(row=0, column=2, row_span=2, column_span=1)",
"cf getColumnRowSpan correct"
);
result = await runPython(`
d = findByDomId(doc, "d")
return str(d.queryTableCell().getRowColumnSpan())
`);
is(
result,
"(row=1, column=0, row_span=1, column_span=1)",
"d getColumnRowSpan correct"
);
}
);