[orca] Use the character count as the final offset when prefering name over text
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Use the character count as the final offset when prefering name over text
- Date: Wed, 21 Aug 2019 17:05:59 +0000 (UTC)
commit e75ac3c2c17b2afcc6495be4c8ea631dd2b0b5a2
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Aug 21 13:03:45 2019 -0400
Use the character count as the final offset when prefering name over text
Our hackaround for CSSified-into-brokenness text was assuming the name
(if found) would be the same length as the text. This isn't always the
case when there are bugs in the name-from-contents calculation. When it's
not the case, we can double-present or get stuck.
src/orca/scripts/web/script_utilities.py | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index a783c9ea7..1387b32f7 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1251,21 +1251,23 @@ class Utilities(script_utilities.Utilities):
math = self.getMathAncestor(obj)
return [[math, 0, 1, '']]
+ text = self.queryNonEmptyText(obj)
+
if self.elementLinesAreSingleChars(obj):
- if obj.name:
+ if obj.name and text:
msg = "WEB: Returning name as contents for %s (single-char lines)" % obj
debug.println(debug.LEVEL_INFO, msg, True)
- return [[obj, 0, len(obj.name), obj.name]]
+ return [[obj, 0, text.characterCount, obj.name]]
msg = "WEB: Returning all text as contents for %s (single-char lines)" % obj
debug.println(debug.LEVEL_INFO, msg, True)
boundary = None
if self.elementLinesAreSingleWords(obj):
- if obj.name:
+ if obj.name and text:
msg = "WEB: Returning name as contents for %s (single-word lines)" % obj
debug.println(debug.LEVEL_INFO, msg, True)
- return [[obj, 0, len(obj.name), obj.name]]
+ return [[obj, 0, text.characterCount, obj.name]]
msg = "WEB: Returning all text as contents for %s (single-word lines)" % obj
debug.println(debug.LEVEL_INFO, msg, True)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]