[orca/gnome-3-6] Fix for bug 681441 - Orca should present inline lists from WebKitGtk on the same line in braille
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/gnome-3-6] Fix for bug 681441 - Orca should present inline lists from WebKitGtk on the same line in braille
- Date: Wed, 8 Aug 2012 12:56:54 +0000 (UTC)
commit 7d9d608351deb2711e4bbb216e4eab633be532b2
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Aug 8 13:21:50 2012 +0200
Fix for bug 681441 - Orca should present inline lists from WebKitGtk on the same line in braille
src/orca/script_utilities.py | 17 ++++++++++-
src/orca/scripts/toolkits/WebKitGtk/script.py | 30 ++++++++++++++++++-
.../scripts/toolkits/WebKitGtk/script_utilities.py | 10 ++++++
3 files changed, 54 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index c241e8b..76ee683 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -1,4 +1,4 @@
-
+# Orca
#
# Copyright 2010 Joanmarie Diggs.
#
@@ -1497,6 +1497,21 @@ class Utilities:
return obj
@staticmethod
+ def onSameLine(obj1, obj2, delta=0):
+ """Determines if obj1 and obj2 are on the same line."""
+
+ try:
+ bbox1 = obj1.queryComponent().getExtents(pyatspi.DESKTOP_COORDS)
+ bbox2 = obj2.queryComponent().getExtents(pyatspi.DESKTOP_COORDS)
+ except:
+ return False
+
+ center1 = bbox1.y + bbox1.height / 2
+ center2 = bbox2.y + bbox2.height / 2
+
+ return abs(center1 - center2) <= delta
+
+ @staticmethod
def spatialComparison(obj1, obj2):
"""Compares the physical locations of obj1 and obj2 and returns -1,
0, or 1 to indicate if obj1 physically is before, is in the same
diff --git a/src/orca/scripts/toolkits/WebKitGtk/script.py b/src/orca/scripts/toolkits/WebKitGtk/script.py
index 5b3f538..2d03677 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/script.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/script.py
@@ -676,8 +676,6 @@ class Script(default.Script):
where the caret is.
"""
- # TODO - JD: Piece together the full line for braille
-
textLine = default.Script.getTextLineAtCaret(self, obj, offset)
string = textLine[0].decode('UTF-8')
if string.find(self.EMBEDDED_OBJECT_CHARACTER) == -1:
@@ -686,3 +684,31 @@ class Script(default.Script):
textLine[0] = self.utilities.displayedText(obj)
return textLine
+
+ def updateBraille(self, obj, extraRegion=None):
+ """Updates the braille display to show the given object.
+
+ Arguments:
+ - obj: the Accessible
+ - extra: extra Region to add to the end
+ """
+
+ if not obj:
+ return
+
+ if not self.utilities.isWebKitGtk(obj) \
+ or not self.utilities.isInlineContainer(obj):
+ default.Script.updateBraille(self, obj, extraRegion)
+ return
+
+ brailleLine = self.getNewBrailleLine(clearBraille=True, addLine=True)
+ for child in obj:
+ if not self.utilities.onSameLine(child, obj[0]):
+ break
+ [regions, fRegion] = self.brailleGenerator.generateBraille(child)
+ self.addBrailleRegionsToLine(regions, brailleLine)
+
+ if extraRegion:
+ self.addBrailleRegionToLine(extraRegion, brailleLine)
+
+ self.refreshBraille()
diff --git a/src/orca/scripts/toolkits/WebKitGtk/script_utilities.py b/src/orca/scripts/toolkits/WebKitGtk/script_utilities.py
index 1859d30..3caa0a9 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/script_utilities.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/script_utilities.py
@@ -210,3 +210,13 @@ class Utilities(script_utilities.Utilities):
nextObj = None
return nextObj
+
+ def isInlineContainer(self, obj):
+ """Returns True if obj is an inline/non-wrapped container."""
+
+ if not obj.getRole() == pyatspi.ROLE_LIST \
+ or obj.getState().contains(pyatspi.STATE_FOCUSABLE) \
+ or obj.childCount <= 1:
+ return False
+
+ return self.onSameLine(obj[0], obj[1])
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]