[orca] Fix for bug #645366 - Orca needs to work around the initial lack of caret in a newly-loaded WebKitGt



commit d99da0bc0cfb6a5bac6044c961a0b8aa7f6e6a2f
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Mon Mar 21 02:33:57 2011 -0400

    Fix for bug #645366 - Orca needs to work around the initial lack of caret in a newly-loaded WebKitGtk page

 src/orca/scripts/apps/epiphany/script.py      |    2 +-
 src/orca/scripts/apps/yelp/yelp_v3/script.py  |    2 +-
 src/orca/scripts/toolkits/WebKitGtk/script.py |    9 +++++++--
 3 files changed, 9 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/scripts/apps/epiphany/script.py b/src/orca/scripts/apps/epiphany/script.py
index 38acc16..30a1170 100644
--- a/src/orca/scripts/apps/epiphany/script.py
+++ b/src/orca/scripts/apps/epiphany/script.py
@@ -40,7 +40,7 @@ class Script(WebKitGtk.Script):
     def __init__(self, app):
         """Creates a new script for the given application."""
 
-        WebKitGtk.Script.__init__(self, app)
+        WebKitGtk.Script.__init__(self, app, isBrowser=True)
 
     def getEnabledStructuralNavigationTypes(self):
         """Returns a list of the structural navigation object types
diff --git a/src/orca/scripts/apps/yelp/yelp_v3/script.py b/src/orca/scripts/apps/yelp/yelp_v3/script.py
index c7064b0..20a4a83 100644
--- a/src/orca/scripts/apps/yelp/yelp_v3/script.py
+++ b/src/orca/scripts/apps/yelp/yelp_v3/script.py
@@ -34,7 +34,7 @@ class Script(WebKitGtk.Script):
     def __init__(self, app):
         """Creates a new script for the given application."""
 
-        WebKitGtk.Script.__init__(self, app)
+        WebKitGtk.Script.__init__(self, app, isBrowser=True)
 
     def getEnabledStructuralNavigationTypes(self):
         """Returns a list of the structural navigation object types
diff --git a/src/orca/scripts/toolkits/WebKitGtk/script.py b/src/orca/scripts/toolkits/WebKitGtk/script.py
index 0057fc0..6b9141c 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/script.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/script.py
@@ -49,7 +49,7 @@ class Script(default.Script):
 
     CARET_NAVIGATION_KEYS = ['Left', 'Right', 'Up', 'Down', 'Home', 'End']
 
-    def __init__(self, app):
+    def __init__(self, app, isBrowser=False):
         """Creates a new script for WebKitGtk applications.
 
         Arguments:
@@ -58,6 +58,7 @@ class Script(default.Script):
 
         default.Script.__init__(self, app)
         self._loadingDocumentContent = False
+        self._isBrowser = isBrowser
 
     def getListeners(self):
         """Sets up the AT-SPI event listeners for this script."""
@@ -145,6 +146,9 @@ class Script(default.Script):
 
         if event.source.getRole() == pyatspi.ROLE_DOCUMENT_FRAME:
             self._loadingDocumentContent = False
+            if self._isBrowser:
+                obj, offset = self.setCaretAtStart(event.source)
+                orca.setLocusOfFocus(event, obj, False)
 
     def onDocumentLoadStopped(self, event):
         """Called when a web page load is interrupted."""
@@ -191,7 +195,8 @@ class Script(default.Script):
             return
 
         if not event.source \
-           or event.source.getRole() != pyatspi.ROLE_DOCUMENT_FRAME:
+           or event.source.getRole() != pyatspi.ROLE_DOCUMENT_FRAME \
+           or not self._isBrowser:
             return
 
         if event.detail1:



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