[orca] Improve how Orca works with Etherpad in Firefox



commit 5505cb255ed18fe47ceb8c4766ad30ee6a76dd9c
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu Jul 23 12:13:15 2015 -0400

    Improve how Orca works with Etherpad in Firefox

 src/orca/script_utilities.py                       |    7 ++++-
 src/orca/scripts/toolkits/Gecko/script.py          |   10 +++++++
 .../scripts/toolkits/Gecko/script_utilities.py     |   10 -------
 src/orca/scripts/web/script.py                     |   26 ++++++++++++++++++++
 4 files changed, 42 insertions(+), 11 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 39ee06f..b478d40 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -587,7 +587,12 @@ class Utilities:
         if not obj:
             obj = orca_state.locusOfFocus
 
-        if not (obj and obj.getRole() == pyatspi.ROLE_ENTRY):
+        try:
+            role = obj.getRole()
+        except:
+            return False
+
+        if role != pyatspi.ROLE_ENTRY:
             return False
 
         isToolbar = lambda x: x and x.getRole() == pyatspi.ROLE_TOOL_BAR
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 3566e91..2ce9b69 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -211,6 +211,16 @@ class Script(web.Script):
         debug.println(debug.LEVEL_INFO, msg)
         default.Script.onNameChanged(self, event)
 
+    def onSelectionChanged(self, event):
+        """Callback for object:selection-changed accessibility events."""
+
+        if super().onSelectionChanged(event):
+            return
+
+        msg = "GECKO: Passing along event to default script"
+        debug.println(debug.LEVEL_INFO, msg)
+        default.Script.onSelectionChanged(self, event)
+
     def onShowingChanged(self, event):
         """Callback for object:state-changed:showing accessibility events."""
 
diff --git a/src/orca/scripts/toolkits/Gecko/script_utilities.py 
b/src/orca/scripts/toolkits/Gecko/script_utilities.py
index 4355039..061fba9 100644
--- a/src/orca/scripts/toolkits/Gecko/script_utilities.py
+++ b/src/orca/scripts/toolkits/Gecko/script_utilities.py
@@ -45,16 +45,6 @@ class Utilities(web.Utilities):
     def _attemptBrokenTextRecovery(self):
         return True
 
-    def inFindToolbar(self, obj=None):
-        if not obj:
-            obj = orca_state.locusOfFocus
-
-        if obj and obj.parent \
-           and obj.parent.getRole() == pyatspi.ROLE_AUTOCOMPLETE:
-            return False
-
-        return super().inFindToolbar(obj)
-
     def nodeLevel(self, obj):
         """Determines the level of at which this object is at by using
         the object attribute 'level'.  To be consistent with the default
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 3c0e345..73dce40 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1085,6 +1085,11 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg)
             return False
 
+        if not self.utilities.inDocumentContent(orca_state.locusOfFocus):
+            msg = "WEB: Ignoring event source is in document; locusOfFocus is not"
+            debug.println(debug.LEVEL_INFO, msg)
+            return True
+
         if self._lastCommandWasCaretNav:
             msg = "WEB: Event ignored: Last command was caret nav"
             debug.println(debug.LEVEL_INFO, msg)
@@ -1386,6 +1391,27 @@ class Script(default.Script):
 
         return True
 
+    def onSelectionChanged(self, event):
+        """Callback for object:selection-changed accessibility events."""
+
+        if not self.utilities.inDocumentContent(event.source):
+            msg = "WEB: Event source is not in document content"
+            debug.println(debug.LEVEL_INFO, msg)
+            return False
+
+        if not self.utilities.inDocumentContent(orca_state.locusOfFocus):
+            msg = "WEB: Ignoring event source is in document; locusOfFocus is not"
+            debug.println(debug.LEVEL_INFO, msg)
+            return True
+
+        obj, offset = self.utilities.getCaretContext()
+        if obj and event.source not in [obj, obj.parent]:
+            msg = "WEB: Ignoring event source is not context obj or its parent"
+            debug.println(debug.LEVEL_INFO, msg)
+            return True
+
+        return False
+
     def onShowingChanged(self, event):
         """Callback for object:state-changed:showing accessibility events."""
 


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