[orca] Fix for bug 588344 - Missed text on a page in Firefox
- From: Joanmarie Diggs <joanied src gnome org>
- To: svn-commits-list gnome org
- Subject: [orca] Fix for bug 588344 - Missed text on a page in Firefox
- Date: Sun, 12 Jul 2009 12:53:31 +0000 (UTC)
commit d2e11761274628f0fa4933f95efbf17869a2ba32
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Sat Jul 11 22:44:28 2009 -0400
Fix for bug 588344 - Missed text on a page in Firefox
src/orca/scripts/toolkits/Gecko/script.py | 27 ++++++-
src/orca/structural_navigation.py | 14 ++--
test/keystrokes/firefox/bug_552887a.py | 125 ++++++++++++++++++--------
test/keystrokes/firefox/codetalks_button.py | 2 +-
4 files changed, 120 insertions(+), 48 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index eb0e171..fbc3df5 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -3414,7 +3414,10 @@ class Script(default.Script):
textObj = self.queryNonEmptyText(obj)
if not textObj and obj.getRole() == pyatspi.ROLE_PARAGRAPH:
- useless = True
+ # Under these circumstances, this object is useless even
+ # if it is the child of a link.
+ #
+ return True
elif obj.getRole() in [pyatspi.ROLE_IMAGE, \
pyatspi.ROLE_TABLE_CELL, \
pyatspi.ROLE_SECTION]:
@@ -5357,7 +5360,17 @@ class Script(default.Script):
done = False
while not done:
[lastObj, start, end, string] = objects[-1]
- [nextObj, nOffset] = self.findNextCaretInOrder(lastObj, end)
+
+ # The offset reported as the end offset can vary with Gecko.
+ # If the offset is one bigger than we expect, we are in danger
+ # of skipping over an object. Therefore, start by decrementing
+ # the end offset by 1. If we find the same object, try again.
+ #
+ [nextObj, nOffset] = self.findNextCaretInOrder(lastObj, end - 1)
+ if self.isSameObject(lastObj, nextObj):
+ [nextObj, nOffset] = \
+ self.findNextCaretInOrder(nextObj, nOffset)
+
if not nextObj or self.isSameObject(nextObj, lastObj):
break
@@ -5653,6 +5666,16 @@ class Script(default.Script):
self._objectForFocusGrab = obj
while self._objectForFocusGrab and obj:
role = self._objectForFocusGrab.getRole()
+
+ # If we're within a link whose children contain the text,
+ # grabbing focus on the link will result in our looping
+ # back to the link and never being able to arrow through
+ # the text.
+ #
+ if role == pyatspi.ROLE_LINK and self.queryNonEmptyText(obj):
+ self._objectForFocusGrab = None
+ break
+
if self._objectForFocusGrab.getState().contains(\
pyatspi.STATE_FOCUSABLE):
break
diff --git a/src/orca/structural_navigation.py b/src/orca/structural_navigation.py
index 2001db2..e4e56ef 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -3385,9 +3385,13 @@ class StructuralNavigation:
"""
if obj:
- [obj, characterOffset] = self._getCaretPosition(obj)
- self._setCaretPosition(obj, characterOffset)
- self._presentObject(obj, characterOffset)
+ # 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()
else:
# Translators: this is for navigating document content by
# moving from unvisited link to unvisited link. This string
@@ -3465,9 +3469,7 @@ class StructuralNavigation:
the criteria (e.g. the level of a heading).
"""
if obj:
- [obj, characterOffset] = self._getCaretPosition(obj)
- self._setCaretPosition(obj, characterOffset)
- self._presentObject(obj, characterOffset)
+ obj.queryComponent().grabFocus()
else:
# Translators: this is for navigating document content by
# moving from visited link to visited link. This string is
diff --git a/test/keystrokes/firefox/bug_552887a.py b/test/keystrokes/firefox/bug_552887a.py
index 3cd26c8..9681b23 100644
--- a/test/keystrokes/firefox/bug_552887a.py
+++ b/test/keystrokes/firefox/bug_552887a.py
@@ -32,11 +32,12 @@ sequence.append(KeyComboAction("<Control>Home"))
sequence.append(utils.AssertPresentationAction(
"Top of file",
["BUG? - In this test, the text is extremely small and probably appears to be on the same line, so we're speaking more than we should be",
- "BRAILLE LINE: ''",
- " VISIBLE: '', cursor=1",
+ "BRAILLE LINE: 'Line 1'",
+ " VISIBLE: 'Line 1', cursor=1",
"SPEECH OUTPUT: '",
" Line 1",
- "'"]))
+ " Line 2",
+ " heading level 2'"]))
########################################################################
# Down Arrow to the bottom.
@@ -45,16 +46,6 @@ sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"1. Line Down",
- ["BRAILLE LINE: 'Line 1'",
- " VISIBLE: 'Line 1', cursor=7",
- "SPEECH OUTPUT: '",
- " Line 1",
- "'"]))
-
-sequence.append(utils.StartRecordingAction())
-sequence.append(KeyComboAction("Down"))
-sequence.append(utils.AssertPresentationAction(
- "2. Line Down",
["BRAILLE LINE: 'Line 1 Line 2 h2'",
" VISIBLE: 'Line 1 Line 2 h2', cursor=14",
"SPEECH OUTPUT: 'Line 1",
@@ -64,7 +55,7 @@ sequence.append(utils.AssertPresentationAction(
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
- "3. Line Down",
+ "2. Line Down",
["BRAILLE LINE: 'Line 3'",
" VISIBLE: 'Line 3', cursor=1",
"SPEECH OUTPUT: 'Line 3",
@@ -73,7 +64,7 @@ sequence.append(utils.AssertPresentationAction(
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
- "4. Line Down",
+ "3. Line Down",
["BRAILLE LINE: ''",
" VISIBLE: '', cursor=1",
"SPEECH OUTPUT: 'blank'"]))
@@ -81,24 +72,57 @@ sequence.append(utils.AssertPresentationAction(
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
- "5. Line Down",
+ "4. Line Down",
["BRAILLE LINE: 'The Orca logo Image'",
" VISIBLE: 'The Orca logo Image', cursor=1",
"SPEECH OUTPUT: 'The Orca logo link image ",
- " link ",
- "'"]))
+ " link image"]))
-#sequence.append(utils.StartRecordingAction())
-#sequence.append(KeyComboAction("Down"))
-#sequence.append(utils.AssertPresentationAction(
-# "6. Line Down",
-# []))
-#BUG? - For some reason still yet to be determined, we're never getting to the text beneath the image.
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "5. Line Down",
+ ["BRAILLE LINE: 'Can an Orca really hold a'",
+ " VISIBLE: 'Can an Orca really hold a', cursor=1",
+ "SPEECH OUTPUT: 'Can an Orca really hold a'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "6. Line Down",
+ ["BRAILLE LINE: 'white cane? (And why'",
+ " VISIBLE: 'white cane? (And why', cursor=1",
+ "SPEECH OUTPUT: 'white cane? (And why'"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
"7. Line Down",
+ ["BRAILLE LINE: 'aren't we speaking this'",
+ " VISIBLE: 'aren't we speaking this', cursor=1",
+ "SPEECH OUTPUT: 'aren't we speaking this'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "8. Line Down",
+ ["BRAILLE LINE: 'text?'",
+ " VISIBLE: 'text?', cursor=1",
+ "SPEECH OUTPUT: 'text?",
+ "'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "9. Line Down",
+ ["BRAILLE LINE: ''",
+ " VISIBLE: '', cursor=0",
+ "SPEECH OUTPUT: 'blank'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "10. Line Down",
["BRAILLE LINE: 'This text comes before the box section'",
" VISIBLE: 'xt comes before the box section', cursor=32",
"SPEECH OUTPUT: 'This text comes before the box section",
@@ -107,7 +131,7 @@ sequence.append(utils.AssertPresentationAction(
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
- "8. Line Down",
+ "11. Line Down",
["BRAILLE LINE: ''",
" VISIBLE: '', cursor=1",
"SPEECH OUTPUT: 'blank'"]))
@@ -115,7 +139,7 @@ sequence.append(utils.AssertPresentationAction(
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
- "9. Line Down",
+ "12. Line Down",
["BRAILLE LINE: 'Here's a box'",
" VISIBLE: 'Here's a box', cursor=1",
"SPEECH OUTPUT: 'Here's a box'"]))
@@ -123,7 +147,7 @@ sequence.append(utils.AssertPresentationAction(
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
- "10. Line Down",
+ "13. Line Down",
["BRAILLE LINE: 'Here's some box text.'",
" VISIBLE: 'Here's some box text.', cursor=1",
"SPEECH OUTPUT: 'Here's some box text.'"]))
@@ -131,7 +155,7 @@ sequence.append(utils.AssertPresentationAction(
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
- "11. Line Down",
+ "14. Line Down",
["BRAILLE LINE: 'The end of the box'",
" VISIBLE: 'The end of the box', cursor=1",
"SPEECH OUTPUT: 'The end of the box'"]))
@@ -139,7 +163,7 @@ sequence.append(utils.AssertPresentationAction(
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
- "12. Line Down",
+ "15. Line Down",
["BRAILLE LINE: 'This text comes after the'",
" VISIBLE: 'This text comes after the', cursor=1",
"SPEECH OUTPUT: 'This text comes after the'"]))
@@ -147,7 +171,7 @@ sequence.append(utils.AssertPresentationAction(
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
- "13. Line Down",
+ "16. Line Down",
["BRAILLE LINE: 'box section.'",
" VISIBLE: 'box section.', cursor=1",
"SPEECH OUTPUT: 'box section.",
@@ -156,7 +180,7 @@ sequence.append(utils.AssertPresentationAction(
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
- "14. Line Down",
+ "17. Line Down",
["BRAILLE LINE: ''",
" VISIBLE: '', cursor=1",
"SPEECH OUTPUT: 'blank'"]))
@@ -164,7 +188,7 @@ sequence.append(utils.AssertPresentationAction(
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Down"))
sequence.append(utils.AssertPresentationAction(
- "15. Line Down",
+ "18. Line Down",
[""]))
########################################################################
@@ -241,6 +265,30 @@ sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Up"))
sequence.append(utils.AssertPresentationAction(
"9. Line Up",
+ ["BRAILLE LINE: 'aren't we speaking this'",
+ " VISIBLE: 'aren't we speaking this', cursor=1",
+ "SPEECH OUTPUT: 'aren't we speaking this'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+ "10. Line Up",
+ ["BRAILLE LINE: 'white cane? (And why'",
+ " VISIBLE: 'white cane? (And why', cursor=1",
+ "SPEECH OUTPUT: 'white cane? (And why'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+ "11. Line Up",
+ ["BRAILLE LINE: 'Can an Orca really hold a'",
+ " VISIBLE: 'Can an Orca really hold a', cursor=1",
+ "SPEECH OUTPUT: 'Can an Orca really hold a'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+ "12. Line Up",
["BRAILLE LINE: ''",
" VISIBLE: '', cursor=0",
"SPEECH OUTPUT: '",
@@ -249,17 +297,16 @@ sequence.append(utils.AssertPresentationAction(
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Up"))
sequence.append(utils.AssertPresentationAction(
- "10. Line Up",
+ "13. Line Up",
["BRAILLE LINE: 'The Orca logo Image'",
" VISIBLE: 'The Orca logo Image', cursor=1",
"SPEECH OUTPUT: 'The Orca logo link image ",
- " link ",
- "'"]))
+ " link image"]))
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Up"))
sequence.append(utils.AssertPresentationAction(
- "11. Line Up",
+ "14. Line Up",
["BRAILLE LINE: ''",
" VISIBLE: '', cursor=1",
"SPEECH OUTPUT: 'blank'"]))
@@ -267,7 +314,7 @@ sequence.append(utils.AssertPresentationAction(
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Up"))
sequence.append(utils.AssertPresentationAction(
- "12. Line Up",
+ "15. Line Up",
["BRAILLE LINE: 'Line 3'",
" VISIBLE: 'Line 3', cursor=1",
"SPEECH OUTPUT: 'Line 3",
@@ -276,7 +323,7 @@ sequence.append(utils.AssertPresentationAction(
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Up"))
sequence.append(utils.AssertPresentationAction(
- "13. Line Up",
+ "16. Line Up",
["BRAILLE LINE: 'Line 1 Line 2 h2'",
" VISIBLE: 'Line 1 Line 2 h2', cursor=1",
"SPEECH OUTPUT: 'Line 1",
@@ -286,7 +333,7 @@ sequence.append(utils.AssertPresentationAction(
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("Up"))
sequence.append(utils.AssertPresentationAction(
- "14. Line Up",
+ "17. Line Up",
[""]))
########################################################################
diff --git a/test/keystrokes/firefox/codetalks_button.py b/test/keystrokes/firefox/codetalks_button.py
index 1efa4c0..1416992 100644
--- a/test/keystrokes/firefox/codetalks_button.py
+++ b/test/keystrokes/firefox/codetalks_button.py
@@ -95,7 +95,7 @@ sequence.append(utils.AssertPresentationAction(
"BRAILLE LINE: 'Check Now Button Check to see if your order has been shipped. $l'",
" VISIBLE: 'Check Now Button Check to see if', cursor=1",
"SPEECH OUTPUT: 'ARIA Button - " + utils.firefoxFrameNames + " frame'",
- "SPEECH OUTPUT: 'Check Now button Check to see if your order has been shipped. text Check to see if your order has been shipped.'"]))
+ "SPEECH OUTPUT: 'Check Now button text Check to see if your order has been shipped.'"]))
########################################################################
# Close the demo
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]