[orca] Descend images if they are image maps
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Descend images if they are image maps
- Date: Mon, 17 Oct 2016 18:19:51 +0000 (UTC)
commit 4087a76496c3360458c0effbf2df751091a5f6dc
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Oct 17 14:18:59 2016 -0400
Descend images if they are image maps
src/orca/scripts/web/script_utilities.py | 21 +++++++++++++++++++++
src/orca/where_am_I.py | 3 +++
2 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 92db475..b7f9836 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -74,6 +74,7 @@ class Utilities(script_utilities.Utilities):
self._isLink = {}
self._isNonNavigablePopup = {}
self._isNonEntryTextWidget = {}
+ self._isImageMap = {}
self._isUselessImage = {}
self._isParentOfNullChild = {}
self._inferredLabels = {}
@@ -131,6 +132,7 @@ class Utilities(script_utilities.Utilities):
self._isLink = {}
self._isNonNavigablePopup = {}
self._isNonEntryTextWidget = {}
+ self._isImageMap = {}
self._isUselessImage = {}
self._isParentOfNullChild = {}
self._inferredLabels = {}
@@ -2390,6 +2392,22 @@ class Utilities(script_utilities.Utilities):
self._hasUselessCanvasDescendant[hash(obj)] = rv
return rv
+ def isImageMap(self, obj):
+ if not (obj and self.inDocumentContent(obj)):
+ return False
+
+ rv = self._isImageMap.get(hash(obj))
+ if rv is not None:
+ return rv
+
+ role = obj.getRole()
+ rv = role == pyatspi.ROLE_IMAGE_MAP
+ if rv == False and role == pyatspi.ROLE_IMAGE:
+ rv = obj.childCount and obj[0].getRole() == pyatspi.ROLE_LINK
+
+ self._isImageMap[hash(obj)] = rv
+ return rv
+
def isUselessImage(self, obj):
if not (obj and self.inDocumentContent(obj)):
return False
@@ -2853,6 +2871,9 @@ class Utilities(script_utilities.Utilities):
if self.isTextBlockElement(obj):
return False
+ if self.isImageMap(obj):
+ return False
+
doNotDescend = [pyatspi.ROLE_COMBO_BOX,
pyatspi.ROLE_IMAGE,
pyatspi.ROLE_LIST_BOX,
diff --git a/src/orca/where_am_I.py b/src/orca/where_am_I.py
index 02af522..0572833 100644
--- a/src/orca/where_am_I.py
+++ b/src/orca/where_am_I.py
@@ -48,6 +48,9 @@ class WhereAmI:
list items and table cells.
"""
+ if obj.getState().contains(pyatspi.STATE_FOCUSED):
+ return obj
+
roles = [pyatspi.ROLE_TABLE_CELL, pyatspi.ROLE_LIST_ITEM]
ancestor = pyatspi.findAncestor(obj, lambda x: x and x.getRole() in roles)
if ancestor and not self._script.utilities.isLayoutOnly(ancestor.parent):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]