orca r4397 - in trunk: . src/orca/scripts/toolkits/Gecko test/keystrokes/firefox



Author: joanied
Date: Thu Jan  1 01:37:49 2009
New Revision: 4397
URL: http://svn.gnome.org/viewvc/orca?rev=4397&view=rev

Log:
* src/orca/scripts/toolkits/Gecko/script.py:
  test/keystrokes/firefox/find_wiki.py:
  Fix for bug #566181 - Changes made to Firefox 3.2 caret-moved
  events cause Orca to provide unreliable access during the use
  of the Find toolbar.



Modified:
   trunk/ChangeLog
   trunk/src/orca/scripts/toolkits/Gecko/script.py
   trunk/test/keystrokes/firefox/find_wiki.py

Modified: trunk/src/orca/scripts/toolkits/Gecko/script.py
==============================================================================
--- trunk/src/orca/scripts/toolkits/Gecko/script.py	(original)
+++ trunk/src/orca/scripts/toolkits/Gecko/script.py	Thu Jan  1 01:37:49 2009
@@ -1204,37 +1204,48 @@
         -offset: The offset with obj where the caret should be positioned
         """
 
+        # At some point in Firefox 3.2 we started getting detail1 values of
+        # -1 for the caret-moved events for unfocused content during a find.
+        # We don't want to base the new caret offset -- or the current line
+        # on this value. We should be able to count on the selection range
+        # instead -- across FF 3.0, 3.1, and 3.2.
+        #
+        enoughSelected = False
+        text = self.queryNonEmptyText(obj)
+        if text and text.getNSelections():
+            [start, end] = text.getSelection(0)
+            offset = max(offset, start)
+            if end - start >= script_settings.minimumFindLength:
+                enoughSelected = True
+
+        # Haing done that, update the caretContext. If the user wants
+        # matches spoken, we also need to if we are on the same line
+        # as before.
+        #
         origObj, origOffset = self.getCaretContext()
         self.setCaretContext(obj, offset)
-        origExtents = self.getExtents(origObj, origOffset - 1, origOffset)
-        newExtents = self.getExtents(obj, offset - 1, offset)
-        text = self.queryNonEmptyText(obj)
-        if script_settings.speakResultsDuringFind and text:
-            nSelections = text.getNSelections()
-            if nSelections:
-                [start, end] = text.getSelection(0)
-                enoughSelected = (end - start) >= \
-                                  script_settings.minimumFindLength
-                lineChanged = not self.onSameLine(origExtents, newExtents)
-
-                # If the user starts backspacing over the text in the
-                # toolbar entry, he/she is indicating they want to perform
-                # a different search. Because madeFindAnnounement may
-                # be set to True, we should reset it -- but only if we
-                # detect the line has also changed.  We're not getting
-                # events from the Find entry, so we have to compare
-                # offsets.
-                #
-                if self.isSameObject(origObj, obj) and (origOffset > offset) \
-                   and lineChanged:
-                    self.madeFindAnnouncement = False
-
-                if enoughSelected:
-                    if lineChanged or not self.madeFindAnnouncement or \
-                       not script_settings.onlySpeakChangedLinesDuringFind:
-                        line = self.getLineContentsAtOffset(obj, offset)
-                        self.speakContents(line)
-                        self.madeFindAnnouncement = True
+        if enoughSelected and script_settings.speakResultsDuringFind:
+            origExtents = self.getExtents(origObj, origOffset - 1, origOffset)
+            newExtents = self.getExtents(obj, offset - 1, offset)
+            lineChanged = not self.onSameLine(origExtents, newExtents)
+
+            # If the user starts backspacing over the text in the
+            # toolbar entry, he/she is indicating they want to perform
+            # a different search. Because madeFindAnnounement may
+            # be set to True, we should reset it -- but only if we
+            # detect the line has also changed.  We're not getting
+            # events from the Find entry, so we have to compare
+            # offsets.
+            #
+            if self.isSameObject(origObj, obj) and (origOffset > offset) \
+               and lineChanged:
+                self.madeFindAnnouncement = False
+
+            if lineChanged or not self.madeFindAnnouncement or \
+               not script_settings.onlySpeakChangedLinesDuringFind:
+                line = self.getLineContentsAtOffset(obj, offset)
+                self.speakContents(line)
+                self.madeFindAnnouncement = True
 
     def sayAll(self, inputEvent):
         """Speaks the contents of the document beginning with the present

Modified: trunk/test/keystrokes/firefox/find_wiki.py
==============================================================================
--- trunk/test/keystrokes/firefox/find_wiki.py	(original)
+++ trunk/test/keystrokes/firefox/find_wiki.py	Thu Jan  1 01:37:49 2009
@@ -114,7 +114,7 @@
 sequence.append(KeyComboAction("Return"))
 sequence.append(utils.AssertPresentationAction(
     "9. Return",
-    ["SPEECH OUTPUT: 'Guide to installing the latest versions of Firefox and Orca link'"]))
+    ["SPEECH OUTPUT: '(â |)Guide to installing the latest versions of Firefox and Orca link'"]))
 
 sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("Return"))



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