[orca] Fix for two issues related to WebKitGtk



commit 0743ec786658582a4190e8c13538bb520f8f1775
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Dec 2 16:38:17 2011 +0100

    Fix for two issues related to WebKitGtk
    
    1. Orca was double-presenting links when using caret navigation
    2. Remove some custom handling which is no longer needed due to a bug
       fix in WebKitGtk

 src/orca/scripts/toolkits/WebKitGtk/script.py      |   16 ++++---
 .../scripts/toolkits/WebKitGtk/script_utilities.py |   51 --------------------
 2 files changed, 9 insertions(+), 58 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/WebKitGtk/script.py b/src/orca/scripts/toolkits/WebKitGtk/script.py
index 1b3a05f..5367a92 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/script.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/script.py
@@ -227,8 +227,7 @@ class Script(default.Script):
             self.updateBraille(event.source)
             return
 
-        if self.utilities.isWebKitGtk(orca_state.locusOfFocus):
-            orca.setLocusOfFocus(event, event.source, False)
+        orca.setLocusOfFocus(event, event.source, False)
 
         default.Script.onCaretMoved(self, event)
 
@@ -272,6 +271,10 @@ class Script(default.Script):
         - event: the Event
         """
 
+        lastKey, mods = self.utilities.lastKeyAndModifiers()
+        if lastKey in self.CARET_NAVIGATION_KEYS:
+            return True
+
         obj = event.source
         role = obj.getRole()
         if role == pyatspi.ROLE_LIST_ITEM and obj.childCount:
@@ -364,7 +367,10 @@ class Script(default.Script):
 
         default.Script.sayLine(self, obj)
 
-        rolesToSpeak = [pyatspi.ROLE_HEADING]
+        if obj.getRole() == pyatspi.ROLE_PANEL and obj.getIndexInParent() == 0:
+            obj = obj.parent
+
+        rolesToSpeak = [pyatspi.ROLE_HEADING, pyatspi.ROLE_LINK]
         if obj.getRole() in rolesToSpeak:
             speech.speak(self.speechGenerator.getRoleName(obj))
 
@@ -383,10 +389,6 @@ class Script(default.Script):
             if event.source.getRole() == pyatspi.ROLE_LINK:
                 return False
 
-            lastKey, mods = self.utilities.lastKeyAndModifiers()
-            if lastKey in self.CARET_NAVIGATION_KEYS:
-                return True
-
         return default.Script.skipObjectEvent(self, event)
 
     def useStructuralNavigationModel(self):
diff --git a/src/orca/scripts/toolkits/WebKitGtk/script_utilities.py b/src/orca/scripts/toolkits/WebKitGtk/script_utilities.py
index 25b5b3c..7cdde86 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/script_utilities.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/script_utilities.py
@@ -85,57 +85,6 @@ class Utilities(script_utilities.Utilities):
 
         return readOnly
 
-    def adjustForLinks(self, obj, line, startOffset):
-        """Adjust line to include the word "link" after any hypertext links.
-        Overridden here to deal with parents containing children which in
-        turn contain the links and implement the hypertext interface.
-
-        Arguments:
-        - obj: the accessible object that this line came from.
-        - line: the string to adjust for links.
-        - startOffset: the caret offset at the start of the line.
-
-        Returns: a new line adjusted to add the speaking of "link" after
-        text which is also a link.
-        """
-
-        adjustedLine = script_utilities.Utilities.adjustForLinks(
-                self, obj, line, startOffset)
-
-        roles = [pyatspi.ROLE_LIST_ITEM]
-        if not obj.getRole() in roles or not obj.childCount:
-            return adjustedLine
-
-        child = obj[0]
-        try:
-            hypertext = obj.queryHypertext()
-            nLinks = hypertext.getNLinks()
-        except NotImplementedError:
-            nLinks = 0
-
-        if not nLinks:
-            try:
-                hypertext = child.queryHypertext()
-                nLinks = hypertext.getNLinks()
-            except NotImplementedError:
-                pass
-
-        if not nLinks:
-            return adjustedLine
-
-        try:
-            objText = obj.queryText()
-            childText = child.queryText()
-        except NotImplementedError:
-            return adjustedLine
-
-        adjustment = objText.characterCount - childText.characterCount
-        if adjustment:
-            adjustedLine = script_utilities.Utilities.adjustForLinks(
-                self, child, line, startOffset - adjustment)
-
-        return adjustedLine
-
     def displayedText(self, obj):
         """Returns the text being displayed for an object.
 



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