[orca] Treat non-text-field widgets as a whole when getting their extents
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Treat non-text-field widgets as a whole when getting their extents
- Date: Sat, 16 Aug 2014 02:28:57 +0000 (UTC)
commit 1564329b3788dcebaf47a2a2321542956b77bb92
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Fri Aug 15 22:22:34 2014 -0400
Treat non-text-field widgets as a whole when getting their extents
A number of non-text-field Gecko widgets implement the accessible text
interface. This was causing us to examine character extents rather than
widget extents during caret navigation by line.
src/orca/scripts/toolkits/Gecko/script.py | 28 ++++++++++++++--------------
1 files changed, 14 insertions(+), 14 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 6102002..1fc41fd 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -1831,24 +1831,24 @@ class Script(default.Script):
if not obj:
return [0, 0, 0, 0]
- # The menu items that are children of combo boxes have unique
- # extents based on their physical position, even though they are
- # not showing. Therefore, if the object in question is a menu
- # item, get the object extents rather than the range extents for
- # the text. Similarly, if it's a menu in a combo box, get the
- # extents of the combo box.
- #
+ role = obj.getRole()
+ treatAsWhole = [pyatspi.ROLE_CHECK_MENU_ITEM,
+ pyatspi.ROLE_MENU_ITEM,
+ pyatspi.ROLE_RADIO_MENU_ITEM,
+ pyatspi.ROLE_PUSH_BUTTON]
+
text = self.utilities.queryNonEmptyText(obj)
- if text and obj.getRole() != pyatspi.ROLE_MENU_ITEM:
- extents = list(text.getRangeExtents(startOffset, endOffset, 0))
- elif obj.getRole() == pyatspi.ROLE_MENU \
- and obj.parent.getRole() == pyatspi.ROLE_COMBO_BOX:
+ if text and not role in treatAsWhole:
+ return list(text.getRangeExtents(startOffset, endOffset, 0))
+
+ parentRole = obj.parent.getRole()
+ if role in [pyatspi.ROLE_MENU, pyatspi.ROLE_LIST_ITEM] \
+ and parentRole in [pyatspi.ROLE_COMBO_BOX, pyatspi.ROLE_LIST_BOX]:
ext = obj.parent.queryComponent().getExtents(0)
- extents = [ext.x, ext.y, ext.width, ext.height]
else:
ext = obj.queryComponent().getExtents(0)
- extents = [ext.x, ext.y, ext.width, ext.height]
- return extents
+
+ return [ext.x, ext.y, ext.width, ext.height]
def onSameLine(self, a, b, pixelDelta=5):
"""Determine if extents a and b are on the same line.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]