[orca] Distinguish between empty anchors and anchors with accessible text
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Distinguish between empty anchors and anchors with accessible text
- Date: Thu, 26 Nov 2015 05:53:30 +0000 (UTC)
commit c61b0dccba94bfef9905aa8c79e7978779375671
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Thu Nov 26 00:51:18 2015 -0500
Distinguish between empty anchors and anchors with accessible text
src/orca/scripts/web/script.py | 4 +++-
src/orca/scripts/web/script_utilities.py | 11 ++++++++---
2 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index b8499de..2e4c371 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1466,7 +1466,9 @@ class Script(default.Script):
debug.println(debug.LEVEL_INFO, msg)
return False
- if not (self.utilities.isLink(obj) and not isFocused):
+ if self.utilities.isAnchor(obj):
+ cause = "Context is anchor"
+ elif not (self.utilities.isLink(obj) and not isFocused):
cause = "Context is not a non-focused link"
elif self.utilities.isChildOfCurrentFragment(obj):
cause = "Context is child of current fragment"
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 82c082d..4e9664d 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1773,7 +1773,7 @@ class Utilities(script_utilities.Utilities):
return False
if (self.isTextBlockElement(obj) and not string.strip()) \
- or self.isAnchor(obj) \
+ or self.isEmptyAnchor(obj) \
or (self.hasNoSize(obj) and not string.strip()) \
or self.isHidden(obj) \
or self.isOffScreenLabel(obj) \
@@ -1972,13 +1972,18 @@ class Utilities(script_utilities.Utilities):
rv = False
if obj.getRole() == pyatspi.ROLE_LINK \
and not obj.getState().contains(pyatspi.STATE_FOCUSABLE) \
- and not 'Action' in pyatspi.listInterfaces(obj) \
- and not self.queryNonEmptyText(obj):
+ and not 'Action' in pyatspi.listInterfaces(obj):
rv = True
self._isAnchor[hash(obj)] = rv
return rv
+ def isEmptyAnchor(self, obj):
+ if not self.isAnchor(obj):
+ return False
+
+ return self.queryNonEmptyText(obj) is None
+
def isChromeAlert(self, obj):
if not (obj and obj.getRole() == pyatspi.ROLE_ALERT):
return False
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]