[orca] Fix an instance of structural navigation looping



commit d0e61bdb6700b4909daeb7a2641733c873f5ebd7
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Fri Sep 5 20:23:49 2014 -0400

    Fix an instance of structural navigation looping

 src/orca/structural_navigation.py                  |   15 ++++++++++++---
 .../html_struct_nav_heading_in_div_with_text.py    |    7 +++----
 2 files changed, 15 insertions(+), 7 deletions(-)
---
diff --git a/src/orca/structural_navigation.py b/src/orca/structural_navigation.py
index 3f00972..e6d2d88 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -1059,7 +1059,6 @@ class StructuralNavigation:
         whether wrapping took place.
         """
 
-        currentObj = currentObj or self.getCurrentObject()
         ancestors = []
         [currentObj, offset] = self._script.getCaretContext()
         obj = currentObj.parent
@@ -1077,8 +1076,18 @@ class StructuralNavigation:
                 1,
                 True)
             if len(results) > 0 and not results[0] in ancestors:
-                currentObj = results[0]
-                if not self._script.utilities.isHidden(currentObj) \
+                result = results[0]
+
+                # This can occur with anonymous blocks.
+                if result.parent == currentObj:
+                    o = self._script.utilities.characterOffsetInParent(result)
+                    isBefore = o < offset
+                else:
+                    isBefore = False
+
+                currentObj = result
+                if not (isBefore and not wrapped) \
+                   and not self._script.utilities.isHidden(currentObj) \
                    and (not predicate or predicate(currentObj)):
                     match = currentObj
             elif wrap and not wrapped:
diff --git a/test/keystrokes/firefox/html_struct_nav_heading_in_div_with_text.py 
b/test/keystrokes/firefox/html_struct_nav_heading_in_div_with_text.py
index de068e2..7292297 100644
--- a/test/keystrokes/firefox/html_struct_nav_heading_in_div_with_text.py
+++ b/test/keystrokes/firefox/html_struct_nav_heading_in_div_with_text.py
@@ -31,10 +31,9 @@ sequence.append(utils.StartRecordingAction())
 sequence.append(KeyComboAction("2"))
 sequence.append(utils.AssertPresentationAction(
     "3. 2 for second heading", 
-    ["KNOWN ISSUE: This is not the second heading. We looped.",
-     "BRAILLE LINE:  'First Heading h2'",
-     "     VISIBLE:  'First Heading h2', cursor=1",
-     "SPEECH OUTPUT: 'First Heading '",
+    ["BRAILLE LINE:  'Second Heading h2'",
+     "     VISIBLE:  'Second Heading h2', cursor=1",
+     "SPEECH OUTPUT: 'Second Heading '",
      "SPEECH OUTPUT: 'link'",
      "SPEECH OUTPUT: 'heading level 2'"]))
 


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