[orca/orca-xdesktop] Fix for bug #664386 - Orca does not always present image links in WebKitGtk content



commit 335d9910c43a28642d51b362745bdfe7c5ccc7c3
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Nov 19 14:10:41 2011 -0500

    Fix for bug #664386 - Orca does not always present image links in WebKitGtk content

 src/orca/scripts/toolkits/WebKitGtk/script.py      |   24 ++++++++++++++++++++
 .../scripts/toolkits/WebKitGtk/script_utilities.py |   21 +++++++++++++++++
 2 files changed, 45 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/WebKitGtk/script.py b/src/orca/scripts/toolkits/WebKitGtk/script.py
index 58d24e2..e0a6e11 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/script.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/script.py
@@ -515,3 +515,27 @@ class Script(default.Script):
                 return
 
         text.setCaretOffset(offset)
+
+    def getTextLineAtCaret(self, obj, offset=None):
+        """Gets the line of text where the caret is.
+
+        Argument:
+        - obj: an Accessible object that implements the AccessibleText
+          interface
+        - offset: an optional caret offset to use. (Not used here at the
+          moment, but needed in the Gecko script)
+
+        Returns the [string, caretOffset, startOffset] for the line of text
+        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:
+            return textLine
+
+        textLine[0] = self.utilities.displayedText(obj)
+
+        return textLine
diff --git a/src/orca/scripts/toolkits/WebKitGtk/script_utilities.py b/src/orca/scripts/toolkits/WebKitGtk/script_utilities.py
index 879291b..a7eb387 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/script_utilities.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/script_utilities.py
@@ -135,3 +135,24 @@ class Utilities(script_utilities.Utilities):
                 self, child, line, startOffset - adjustment)
 
         return adjustedLine
+
+    def displayedText(self, obj):
+        """Returns the text being displayed for an object.
+
+        Arguments:
+        - obj: the object
+
+        Returns the text being displayed for an object or None if there isn't
+        any text being shown.
+        """
+
+        text = script_utilities.Utilities.displayedText(self, obj)
+        if text and text != self.EMBEDDED_OBJECT_CHARACTER:
+            return text
+
+        if obj.getRole() == pyatspi.ROLE_LINK:
+            text = ' '.join(map(self.displayedText, (x for x in obj)))
+            if not text:
+                text = self.linkBasename(obj)
+
+        return text



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]