[orca] Treat links whose content is canvas without fallback content as graphical links
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Treat links whose content is canvas without fallback content as graphical links
- Date: Tue, 13 Oct 2015 04:06:59 +0000 (UTC)
commit 1b05317be997f4453317f5aafdc938ab7f1e180e
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Oct 12 23:56:35 2015 -0400
Treat links whose content is canvas without fallback content as graphical links
src/orca/scripts/web/script_utilities.py | 28 ++++++++++++++++++++++++++++
1 files changed, 28 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 396ee7d..0496514 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -56,6 +56,7 @@ class Utilities(script_utilities.Utilities):
self._isOffScreenLabel = {}
self._hasNoSize = {}
self._hasLongDesc = {}
+ self._hasUselessCanvasDescendant = {}
self._isClickableElement = {}
self._isAnchor = {}
self._isLandmark = {}
@@ -96,6 +97,7 @@ class Utilities(script_utilities.Utilities):
self._isOffScreenLabel = {}
self._hasNoSize = {}
self._hasLongDesc = {}
+ self._hasUselessCanvasDescendant = {}
self._isClickableElement = {}
self._isAnchor = {}
self._isLandmark = {}
@@ -649,6 +651,8 @@ class Utilities(script_utilities.Utilities):
rv = None
if rv and (self.isHidden(obj) or self.isOffScreenLabel(obj)):
rv = None
+ if rv and self.isLink(obj) and self.hasUselessCanvasDescendant(obj):
+ rv = None
self._text[hash(obj)] = rv
return rv
@@ -2002,6 +2006,27 @@ class Utilities(script_utilities.Utilities):
self._isNonNavigablePopup[hash(obj)] = rv
return rv
+ def hasUselessCanvasDescendant(self, obj):
+ if not (obj and self.inDocumentContent(obj)):
+ return False
+
+ rv = self._hasUselessCanvasDescendant.get(hash(obj))
+ if rv is not None:
+ return rv
+
+ isCanvas = lambda x: x and x.getRole() == pyatspi.ROLE_CANVAS
+ try:
+ canvases = pyatspi.findAllDescendants(obj, isCanvas)
+ except:
+ msg = "WEB: Exception getting descendant canvases of %s" % obj
+ debug.println(debug.LEVEL_INFO, msg)
+ rv = False
+ else:
+ rv = len(list(filter(self.isUselessImage, canvases))) > 0
+
+ self._hasUselessCanvasDescendant[hash(obj)] = rv
+ return rv
+
def isUselessImage(self, obj):
if not (obj and self.inDocumentContent(obj)):
return False
@@ -2371,6 +2396,9 @@ class Utilities(script_utilities.Utilities):
if self.isHidden(obj) or self.isOffScreenLabel(obj):
return True
+ if self.isLink(obj) and self.hasUselessCanvasDescendant(obj):
+ return True
+
if self.isTextBlockElement(obj):
return False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]