[orca] Present the new location when using PageUp/PageDown in web content



commit 4cb182c7d957df8136c5430ae6c28e04e354a11c
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Sat Feb 13 16:08:37 2016 -0500

    Present the new location when using PageUp/PageDown in web content

 src/orca/scripts/web/script.py |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 658c849..d8a4fe9 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1004,6 +1004,11 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg, True)
             contents = self.utilities.getLineContentsAtOffset(newFocus, 0)
             utterances = self.speechGenerator.generateContents(contents)
+        elif self.utilities.lastInputEventWasPageNav():
+            msg = "WEB: New focus %s was scrolled to. Generating line contents." % newFocus
+            debug.println(debug.LEVEL_INFO, msg, True)
+            contents = self.utilities.getLineContentsAtOffset(newFocus, caretOffset)
+            utterances = self.speechGenerator.generateContents(contents)
         elif newFocus.getRole() == pyatspi.ROLE_HEADING:
             msg = "WEB: New focus %s is heading. Generating object contents." % newFocus
             debug.println(debug.LEVEL_INFO, msg, True)
@@ -1209,6 +1214,14 @@ class Script(default.Script):
             self.utilities.setCaretContext(obj, offset)
             return True
 
+        if self.utilities.lastInputEventWasPageNav() \
+           and not self.utilities.isLink(event.source):
+            msg = "WEB: Event handled: Caret moved due to scrolling"
+            debug.println(debug.LEVEL_INFO, msg, True)
+            orca.setLocusOfFocus(event, obj)
+            self.utilities.setCaretContext(obj, offset)
+            return True
+
         text = self.utilities.queryNonEmptyText(event.source)
         if not text:
             if event.source.getRole() == pyatspi.ROLE_LINK:
@@ -1477,6 +1490,13 @@ class Script(default.Script):
             debug.println(debug.LEVEL_INFO, msg, True)
             return False
 
+        if self.utilities.lastInputEventWasPageNav():
+            msg = "WEB: Event handled: Focus changed due to scrolling"
+            debug.println(debug.LEVEL_INFO, msg, True)
+            orca.setLocusOfFocus(event, obj)
+            self.utilities.setCaretContext(obj, offset)
+            return True
+
         wasFocused = obj.getState().contains(pyatspi.STATE_FOCUSED)
         obj.clearCache()
         isFocused = obj.getState().contains(pyatspi.STATE_FOCUSED)


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