[orca] Eliminate some false positives detecting broken text from CSS
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Eliminate some false positives detecting broken text from CSS
- Date: Mon, 29 Jul 2019 13:37:49 +0000 (UTC)
commit fabc1da9e3bd07cc534193e47b9a4e8fe5e16731
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Jul 29 09:36:42 2019 -0400
Eliminate some false positives detecting broken text from CSS
src/orca/scripts/web/script_utilities.py | 29 +++++++++++++++++++++--------
1 file changed, 21 insertions(+), 8 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 9f501f2c1..9aec65280 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2708,14 +2708,27 @@ class Utilities(script_utilities.Utilities):
except:
return False
- boundary = pyatspi.TEXT_BOUNDARY_LINE_START
- for i in range(nChars):
- string, start, end = text.getTextAtOffset(i, boundary)
- if len(string) > 1:
- rv = False
- break
- else:
- rv = True
+ if not nChars:
+ return False
+
+ try:
+ obj.clearCache()
+ state = obj.getState()
+ except:
+ msg = "ERROR: Exception getting state for %s" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return False
+
+ # Note: We cannot check for the editable-text interface, because Gecko
+ # seems to be exposing that for non-editable things. Thanks Gecko.
+ rv = not state.contains(pyatspi.STATE_EDITABLE)
+ if rv:
+ boundary = pyatspi.TEXT_BOUNDARY_LINE_START
+ for i in range(nChars):
+ string, start, end = text.getTextAtOffset(i, boundary)
+ if len(string) > 1:
+ rv = False
+ break
self._elementLinesAreSingleChars[hash(obj)] = rv
return rv
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]