[orca] Try to detect bogus extents for the object under the mouse
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Try to detect bogus extents for the object under the mouse
- Date: Wed, 20 Nov 2019 19:10:54 +0000 (UTC)
commit e198a5213b2981ce1d63c0c63904373ae0346adc
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Nov 20 14:10:14 2019 -0500
Try to detect bogus extents for the object under the mouse
src/orca/script_utilities.py | 7 +++++++
src/orca/scripts/web/script_utilities.py | 22 +++++++++++++++++++++-
2 files changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 5298be2ef..a1ab98048 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -4090,7 +4090,14 @@ class Utilities:
return table.nRows, table.nColumns
+ def _objectBoundsMightBeBogus(self, obj):
+ return False
+
def containsPoint(self, obj, x, y, coordType, margin=2):
+ if self._objectBoundsMightBeBogus(obj) \
+ and self.textAtPoint(obj, x, y, coordType) == ("", 0, 0):
+ return False
+
try:
component = obj.queryComponent()
except:
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 408d91c06..ff05000ee 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2839,6 +2839,26 @@ class Utilities(script_utilities.Utilities):
return None
+ def _objectBoundsMightBeBogus(self, obj):
+ if not (obj and self.inDocumentContent(obj)):
+ return super()._objectBoundsMightBeBogus(obj)
+
+ if obj.getRole() != pyatspi.ROLE_LINK or "Text" not in pyatspi.listInterfaces(obj):
+ return False
+
+ text = obj.queryText()
+ start = list(text.getRangeExtents(0, 1, 0))
+ end = list(text.getRangeExtents(text.characterCount - 1, text.characterCount, 0))
+ if self.extentsAreOnSameLine(start, end):
+ return False
+
+ if not self.hasPresentableText(obj.parent):
+ return False
+
+ msg = "WEB: Objects bounds of %s might be bogus" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return True
+
def _isBrokenChildParentTree(self, child, parent):
if not (child and parent):
return False
@@ -4573,7 +4593,7 @@ class Utilities(script_utilities.Utilities):
break
else:
child = root.queryComponent().getAccessibleAtPoint(x, y, coordType)
- if child:
+ if child and self.containsPoint(child, x, y, coordType):
return child
return super().descendantAtPoint(obj, x, y, coordType)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]