[orca/gnome-3-20] Add and use option to explicitly set document frame when setting caret position



commit 09608b6d510f016aa7a85dae34a3c704f9124394
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Thu May 26 22:32:57 2016 -0400

    Add and use option to explicitly set document frame when setting caret position

 src/orca/orca_gui_navlist.py             |    4 +++-
 src/orca/script_utilities.py             |    2 +-
 src/orca/scripts/web/script_utilities.py |    7 +++++--
 3 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/orca_gui_navlist.py b/src/orca/orca_gui_navlist.py
index 4e64b5c..1d1fb42 100644
--- a/src/orca/orca_gui_navlist.py
+++ b/src/orca/orca_gui_navlist.py
@@ -42,6 +42,7 @@ class OrcaNavListGUI:
         self._gui.set_title(title)
         self._gui.set_modal(True)
         self._script = orca_state.activeScript
+        self._document = None
         self.showGUI()
 
     def _createNavListDialog(self, columnHeaders, rows, selectedRow):
@@ -107,6 +108,7 @@ class OrcaNavListGUI:
         return dialog
 
     def showGUI(self):
+        self._document = self._script.utilities.documentFrame()
         self._gui.show_all()
         ts = orca_state.lastInputEvent.timestamp
         if ts == 0:
@@ -137,7 +139,7 @@ class OrcaNavListGUI:
     def _onJumpToClicked(self, widget):
         obj, offset = self._getSelectedAccessibleAndOffset()
         self._gui.destroy()
-        self._script.utilities.setCaretPosition(obj, offset)
+        self._script.utilities.setCaretPosition(obj, offset, self._document)
 
     def _onActivateClicked(self, widget):
         obj, offset = self._getSelectedAccessibleAndOffset()
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index ea4d277..00dccf3 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -2433,7 +2433,7 @@ class Utilities:
 
         return obj, offset
 
-    def setCaretPosition(self, obj, offset):
+    def setCaretPosition(self, obj, offset, documentFrame=None):
         orca.setLocusOfFocus(None, obj, False)
         self.setCaretOffset(obj, offset)
 
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 498deee..c563b27 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -269,12 +269,12 @@ class Utilities(script_utilities.Utilities):
             msg = "WEB: Exception grabbing focus on %s" % obj
             debug.println(debug.LEVEL_INFO, msg, True)
 
-    def setCaretPosition(self, obj, offset):
+    def setCaretPosition(self, obj, offset, documentFrame=None):
         if self._script.flatReviewContext:
             self._script.toggleFlatReviewMode()
 
         obj, offset = self.findFirstCaretContext(obj, offset)
-        self.setCaretContext(obj, offset, documentFrame=None)
+        self.setCaretContext(obj, offset, documentFrame)
         if self._script.focusModeIsSticky():
             return
 
@@ -2735,6 +2735,9 @@ class Utilities(script_utilities.Utilities):
 
     def _getCaretContextViaLocusOfFocus(self):
         obj = orca_state.locusOfFocus
+        if not self.inDocumentContent(obj):
+            return None, -1
+
         try:
             offset = obj.queryText().caretOffset
         except NotImplementedError:


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