[orca/gnome-3-14] Fix another instance of structural navigation looping
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/gnome-3-14] Fix another instance of structural navigation looping
- Date: Mon, 15 Sep 2014 00:20:21 +0000 (UTC)
commit 1b0f7c0cf9c20b92715ecf8e0300a1b3b09e83fa
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 +++++
test/keystrokes/firefox/html_struct_nav_links.py | 40 +++++---------------
4 files changed, 34 insertions(+), 47 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index 44bdb8d..ebc2df4 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -1234,8 +1234,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 e8c871c..7d65a21 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -3417,13 +3417,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
@@ -3507,8 +3503,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
@@ -3589,13 +3588,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_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]