[orca/gnome-42] Store row and column info even when the focused object isn't a cell
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/gnome-42] Store row and column info even when the focused object isn't a cell
- Date: Thu, 30 Jun 2022 13:59:17 +0000 (UTC)
commit 63e6e6375ab6218e746f09a69e71fec39be64cd5
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Thu Jun 30 15:53:38 2022 +0200
Store row and column info even when the focused object isn't a cell
The logic to determine whether or not the row and/or column header
has changed relies on the values stored when the location changes.
We were only storing those values when the new location was a cell
(or cell-like thing). If instead the new location is a focusable
descendant of the cell, we are at risk of duplicating header info.
This commit fixes that by looking for the most immediate ancestor
cell and storing its coordinates if found.
See issue #253.
src/orca/script_utilities.py | 8 ++++++--
src/orca/scripts/default.py | 2 +-
src/orca/scripts/web/script_utilities.py | 8 ++++++--
3 files changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 4e72aaa8b..8c816b226 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -4452,14 +4452,18 @@ class Utilities:
rowIndex = table.getRowAtIndex(index)
return table.getRowHeader(rowIndex)
- def coordinatesForCell(self, obj, preferAttribute=True):
+ def coordinatesForCell(self, obj, preferAttribute=True, findCellAncestor=False):
roles = [pyatspi.ROLE_TABLE_CELL,
pyatspi.ROLE_TABLE_COLUMN_HEADER,
pyatspi.ROLE_TABLE_ROW_HEADER,
pyatspi.ROLE_COLUMN_HEADER,
pyatspi.ROLE_ROW_HEADER]
if not (obj and obj.getRole() in roles):
- return -1, -1
+ if not findCellAncestor:
+ return -1, -1
+
+ cell = pyatspi.findAncestor(obj, lambda x: x and x.getRole() in roles)
+ return self.coordinatesForCell(cell, preferAttribute, False)
isTable = lambda x: x and 'Table' in pyatspi.listInterfaces(x)
parent = pyatspi.findAncestor(obj, isTable)
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index f9f90126f..0a193066f 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -837,7 +837,7 @@ class Script(script.Script):
# We want to save the current row and column of a newly focused
# or selected table cell so that on subsequent cell focus/selection
# we only present the changed location.
- row, column = self.utilities.coordinatesForCell(obj)
+ row, column = self.utilities.coordinatesForCell(obj, findCellAncestor=True)
self.pointOfReference['lastColumn'] = column
self.pointOfReference['lastRow'] = row
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 92575c10f..ed4a05991 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2980,14 +2980,18 @@ class Utilities(script_utilities.Utilities):
return ''
- def coordinatesForCell(self, obj, preferAttribute=True):
+ def coordinatesForCell(self, obj, preferAttribute=True, findCellAncestor=False):
roles = [pyatspi.ROLE_TABLE_CELL,
pyatspi.ROLE_TABLE_COLUMN_HEADER,
pyatspi.ROLE_TABLE_ROW_HEADER,
pyatspi.ROLE_COLUMN_HEADER,
pyatspi.ROLE_ROW_HEADER]
if not (obj and obj.getRole() in roles):
- return -1, -1
+ if not findCellAncestor:
+ return -1, -1
+
+ cell = pyatspi.findAncestor(obj, lambda x: x and x.getRole() in roles)
+ return self.coordinatesForCell(cell, preferAttribute, False)
if preferAttribute:
rowindex, colindex = self._rowAndColumnIndices(obj)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]