[orca] Fix another instance of structural navigation looping
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Fix another instance of structural navigation looping
- Date: Sun, 7 Sep 2014 05:49:09 +0000 (UTC)
commit c7807449913ff3cc9c2a63679a9f53969a2f1f0f
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Sun Sep 7 01:45:36 2014 -0400
Fix another instance of structural navigation looping
src/orca/scripts/toolkits/Gecko/script.py | 5 +-
src/orca/structural_navigation.py | 25 +++----
.../headings-in-divs-in-links-in-list-items.html | 11 +++
.../html_struct_nav_headings_buried_deep.params | 1 +
.../html_struct_nav_headings_buried_deep.py | 73 ++++++++++++++++++++
test/keystrokes/firefox/html_struct_nav_links.py | 40 +++--------
6 files changed, 108 insertions(+), 47 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index dd95fb7..2d19bb2 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -1215,8 +1215,9 @@ class Script(default.Script):
if self._lastCommandWasStructNav:
msg = "INFO: Focus change event handled manually: last command was struct nav"
debug.println(debug.LEVEL_INFO, msg)
- self.setCaretContext(event.source, 0)
- orca.setLocusOfFocus(event, event.source)
+ if role != pyatspi.ROLE_LINK:
+ self.setCaretContext(event.source, 0)
+ orca.setLocusOfFocus(event, event.source)
return
default.Script.onFocusedChanged(self, event)
diff --git a/src/orca/structural_navigation.py b/src/orca/structural_navigation.py
index 18ba5d0..226fafa 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -3440,13 +3440,9 @@ class StructuralNavigation:
"""
if obj:
- # We were counting on the Gecko script's setCaretPosition
- # to do the focus grab. It turns out that we do not always
- # want setCaretPosition to grab focus on a link (e.g. when
- # arrowing in the text of a paragraph which is a child of
- # a link. Therefore, we need to grab focus here.
- #
- obj.queryComponent().grabFocus()
+ [obj, characterOffset] = self._getCaretPosition(obj)
+ self._setCaretPosition(obj, characterOffset)
+ self._presentObject(obj, characterOffset)
else:
full = messages.NO_MORE_UNVISITED_LINKS
brief = messages.STRUCTURAL_NAVIGATION_NOT_FOUND
@@ -3530,8 +3526,11 @@ class StructuralNavigation:
- arg: an optional argument which may need to be included in
the criteria (e.g. the level of a heading).
"""
+
if obj:
- obj.queryComponent().grabFocus()
+ [obj, characterOffset] = self._getCaretPosition(obj)
+ self._setCaretPosition(obj, characterOffset)
+ self._presentObject(obj, characterOffset)
else:
full = messages.NO_MORE_VISITED_LINKS
brief = messages.STRUCTURAL_NAVIGATION_NOT_FOUND
@@ -3612,13 +3611,9 @@ class StructuralNavigation:
"""
if obj:
- # We were counting on the Gecko script's setCaretPosition
- # to do the focus grab. It turns out that we do not always
- # want setCaretPosition to grab focus on a link (e.g. when
- # arrowing in the text of a paragraph which is a child of
- # a link. Therefore, we need to grab focus here.
- #
- obj.queryComponent().grabFocus()
+ [obj, characterOffset] = self._getCaretPosition(obj)
+ self._setCaretPosition(obj, characterOffset)
+ self._presentObject(obj, characterOffset)
else:
full = messages.NO_MORE_LINKS
brief = messages.STRUCTURAL_NAVIGATION_NOT_FOUND
diff --git a/test/html/headings-in-divs-in-links-in-list-items.html
b/test/html/headings-in-divs-in-links-in-list-items.html
new file mode 100644
index 0000000..4c273b0
--- /dev/null
+++ b/test/html/headings-in-divs-in-links-in-list-items.html
@@ -0,0 +1,11 @@
+<html>
+<body>
+<div>Start</div>
+<ul>
+<li><a href="foo"><div><h3>Heading 1</h3></div></a></li>
+<li><a href="foo"><div><h3>Heading 2</h3></div></a></li>
+<li><a href="foo"><div><h3>Heading 3</h3></div></a></li>
+</ul>
+<div>End</div>
+</body>
+</html>
diff --git a/test/keystrokes/firefox/html_struct_nav_headings_buried_deep.params
b/test/keystrokes/firefox/html_struct_nav_headings_buried_deep.params
new file mode 100644
index 0000000..fa5136d
--- /dev/null
+++ b/test/keystrokes/firefox/html_struct_nav_headings_buried_deep.params
@@ -0,0 +1 @@
+PARAMS=$TEST_DIR/../../html/headings-in-divs-in-links-in-list-items.html
diff --git a/test/keystrokes/firefox/html_struct_nav_headings_buried_deep.py
b/test/keystrokes/firefox/html_struct_nav_headings_buried_deep.py
new file mode 100644
index 0000000..c3b58eb
--- /dev/null
+++ b/test/keystrokes/firefox/html_struct_nav_headings_buried_deep.py
@@ -0,0 +1,73 @@
+#!/usr/bin/python
+
+"""Test of structural navigation by heading."""
+
+from macaroon.playback import *
+import utils
+
+sequence = MacroSequence()
+
+sequence.append(KeyComboAction("<Control>Home"))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Shift>h"))
+sequence.append(utils.AssertPresentationAction(
+ "1. Shift+h for previous heading",
+ ["BRAILLE LINE: 'Wrapping to bottom.'",
+ " VISIBLE: 'Wrapping to bottom.', cursor=0",
+ "BRAILLE LINE: '• Heading 3 h3'",
+ " VISIBLE: '• Heading 3 h3', cursor=3",
+ "SPEECH OUTPUT: 'Wrapping to bottom.' voice=system",
+ "SPEECH OUTPUT: 'Heading 3'",
+ "SPEECH OUTPUT: 'heading level 3'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Shift>h"))
+sequence.append(utils.AssertPresentationAction(
+ "2. Shift+h for previous heading",
+ ["BRAILLE LINE: '• Heading 2 h3'",
+ " VISIBLE: '• Heading 2 h3', cursor=3",
+ "SPEECH OUTPUT: 'Heading 2'",
+ "SPEECH OUTPUT: 'heading level 3'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Shift>h"))
+sequence.append(utils.AssertPresentationAction(
+ "3. Shift+h for previous heading",
+ ["BRAILLE LINE: '• Heading 1 h3'",
+ " VISIBLE: '• Heading 1 h3', cursor=3",
+ "SPEECH OUTPUT: 'Heading 1'",
+ "SPEECH OUTPUT: 'heading level 3'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("h"))
+sequence.append(utils.AssertPresentationAction(
+ "4. h for next heading",
+ ["BRAILLE LINE: '• Heading 2 h3'",
+ " VISIBLE: '• Heading 2 h3', cursor=3",
+ "SPEECH OUTPUT: 'Heading 2'",
+ "SPEECH OUTPUT: 'heading level 3'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("h"))
+sequence.append(utils.AssertPresentationAction(
+ "5. h for next heading",
+ ["BRAILLE LINE: '• Heading 3 h3'",
+ " VISIBLE: '• Heading 3 h3', cursor=3",
+ "SPEECH OUTPUT: 'Heading 3'",
+ "SPEECH OUTPUT: 'heading level 3'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("h"))
+sequence.append(utils.AssertPresentationAction(
+ "6. h for next heading",
+ ["BRAILLE LINE: 'Wrapping to top.'",
+ " VISIBLE: 'Wrapping to top.', cursor=0",
+ "BRAILLE LINE: '• Heading 1 h3'",
+ " VISIBLE: '• Heading 1 h3', cursor=3",
+ "SPEECH OUTPUT: 'Wrapping to top.' voice=system",
+ "SPEECH OUTPUT: 'Heading 1'",
+ "SPEECH OUTPUT: 'heading level 3'"]))
+
+sequence.append(utils.AssertionSummaryAction())
+sequence.start()
diff --git a/test/keystrokes/firefox/html_struct_nav_links.py
b/test/keystrokes/firefox/html_struct_nav_links.py
index a4f9a45..45db499 100644
--- a/test/keystrokes/firefox/html_struct_nav_links.py
+++ b/test/keystrokes/firefox/html_struct_nav_links.py
@@ -15,10 +15,8 @@ sequence.append(utils.AssertPresentationAction(
"1. u to anchors.html link",
["BRAILLE LINE: '•anchors.html'",
" VISIBLE: '•anchors.html', cursor=2",
- "BRAILLE LINE: '•anchors.html'",
- " VISIBLE: '•anchors.html', cursor=2",
"SPEECH OUTPUT: 'anchors.html'",
- "SPEECH OUTPUT: 'link' voice=hyperlink"]))
+ "SPEECH OUTPUT: 'link'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("u"))
@@ -26,10 +24,8 @@ sequence.append(utils.AssertPresentationAction(
"2. u to blockquotes.html link",
["BRAILLE LINE: '•blockquotes.html'",
" VISIBLE: '•blockquotes.html', cursor=2",
- "BRAILLE LINE: '•blockquotes.html'",
- " VISIBLE: '•blockquotes.html', cursor=2",
"SPEECH OUTPUT: 'blockquotes.html'",
- "SPEECH OUTPUT: 'link' voice=hyperlink"]))
+ "SPEECH OUTPUT: 'link'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("<Shift>u"))
@@ -37,10 +33,8 @@ sequence.append(utils.AssertPresentationAction(
"3. shift + u to anchors.html link",
["BRAILLE LINE: '•anchors.html'",
" VISIBLE: '•anchors.html', cursor=2",
- "BRAILLE LINE: '•anchors.html'",
- " VISIBLE: '•anchors.html', cursor=2",
"SPEECH OUTPUT: 'anchors.html'",
- "SPEECH OUTPUT: 'link' voice=hyperlink"]))
+ "SPEECH OUTPUT: 'link'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("<Shift>u"))
@@ -50,11 +44,9 @@ sequence.append(utils.AssertPresentationAction(
" VISIBLE: 'Wrapping to bottom.', cursor=0",
"BRAILLE LINE: '•textattributes.html'",
" VISIBLE: '•textattributes.html', cursor=2",
- "BRAILLE LINE: '•textattributes.html'",
- " VISIBLE: '•textattributes.html', cursor=2",
"SPEECH OUTPUT: 'Wrapping to bottom.' voice=system",
"SPEECH OUTPUT: 'textattributes.html'",
- "SPEECH OUTPUT: 'link' voice=hyperlink"]))
+ "SPEECH OUTPUT: 'link'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("<Shift>u"))
@@ -62,10 +54,8 @@ sequence.append(utils.AssertPresentationAction(
"5. shift + u to tables.html",
["BRAILLE LINE: '•tables.html'",
" VISIBLE: '•tables.html', cursor=2",
- "BRAILLE LINE: '•tables.html'",
- " VISIBLE: '•tables.html', cursor=2",
"SPEECH OUTPUT: 'tables.html'",
- "SPEECH OUTPUT: 'link' voice=hyperlink"]))
+ "SPEECH OUTPUT: 'link'"]))
sequence.append(KeyComboAction("Return"))
sequence.append(WaitForDocLoad())
@@ -79,10 +69,8 @@ sequence.append(utils.AssertPresentationAction(
"6. u to textattributes.html link",
["BRAILLE LINE: '•textattributes.html'",
" VISIBLE: '•textattributes.html', cursor=2",
- "BRAILLE LINE: '•textattributes.html'",
- " VISIBLE: '•textattributes.html', cursor=2",
"SPEECH OUTPUT: 'textattributes.html'",
- "SPEECH OUTPUT: 'link' voice=hyperlink"]))
+ "SPEECH OUTPUT: 'link'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("u"))
@@ -92,11 +80,9 @@ sequence.append(utils.AssertPresentationAction(
" VISIBLE: 'Wrapping to top.', cursor=0",
"BRAILLE LINE: '•anchors.html'",
" VISIBLE: '•anchors.html', cursor=2",
- "BRAILLE LINE: '•anchors.html'",
- " VISIBLE: '•anchors.html', cursor=2",
"SPEECH OUTPUT: 'Wrapping to top.' voice=system",
"SPEECH OUTPUT: 'anchors.html'",
- "SPEECH OUTPUT: 'link' voice=hyperlink"]))
+ "SPEECH OUTPUT: 'link'"]))
sequence.append(KeyComboAction("Return"))
sequence.append(WaitForDocLoad())
@@ -110,10 +96,8 @@ sequence.append(utils.AssertPresentationAction(
"8. v to tables.html link",
["BRAILLE LINE: '•tables.html'",
" VISIBLE: '•tables.html', cursor=2",
- "BRAILLE LINE: '•tables.html'",
- " VISIBLE: '•tables.html', cursor=2",
"SPEECH OUTPUT: 'tables.html'",
- "SPEECH OUTPUT: 'link' voice=hyperlink"]))
+ "SPEECH OUTPUT: 'link'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("v"))
@@ -123,11 +107,9 @@ sequence.append(utils.AssertPresentationAction(
" VISIBLE: 'Wrapping to top.', cursor=0",
"BRAILLE LINE: '•anchors.html'",
" VISIBLE: '•anchors.html', cursor=2",
- "BRAILLE LINE: '•anchors.html'",
- " VISIBLE: '•anchors.html', cursor=2",
"SPEECH OUTPUT: 'Wrapping to top.' voice=system",
"SPEECH OUTPUT: 'anchors.html'",
- "SPEECH OUTPUT: 'link' voice=hyperlink"]))
+ "SPEECH OUTPUT: 'link'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("<Shift>v"))
@@ -137,11 +119,9 @@ sequence.append(utils.AssertPresentationAction(
" VISIBLE: 'Wrapping to bottom.', cursor=0",
"BRAILLE LINE: '•tables.html'",
" VISIBLE: '•tables.html', cursor=2",
- "BRAILLE LINE: '•tables.html'",
- " VISIBLE: '•tables.html', cursor=2",
"SPEECH OUTPUT: 'Wrapping to bottom.' voice=system",
"SPEECH OUTPUT: 'tables.html'",
- "SPEECH OUTPUT: 'link' voice=hyperlink"]))
+ "SPEECH OUTPUT: 'link'"]))
sequence.append(utils.AssertionSummaryAction())
sequence.start()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]