[orca] Fix a couple of instances of Orca getting stuck during caret navigation
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Fix a couple of instances of Orca getting stuck during caret navigation
- Date: Tue, 14 Jun 2016 03:53:32 +0000 (UTC)
commit fd78c9eae6045ee3b6152e3f708318eb504fd527
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Jun 13 23:45:25 2016 -0400
Fix a couple of instances of Orca getting stuck during caret navigation
src/orca/scripts/web/script_utilities.py | 11 ++-
test/html/empty-link-and-line-break.html | 13 +++
test/html/fraction.svg | 22 +++++
test/html/mathml-has-display-none.html | 80 ++++++++++++++++
.../line_nav_empty_link_with_line_break.params | 1 +
.../firefox/line_nav_empty_link_with_line_break.py | 66 +++++++++++++
.../firefox/math_line_nav_punctuation.params | 1 +
.../firefox/math_line_nav_punctuation.py | 100 ++++++++++++++++++++
8 files changed, 290 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 3dd5441..3764c8b 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1221,7 +1221,7 @@ class Utilities(script_utilities.Utilities):
return False
xExtents = self.getExtents(xObj, xStart, xStart + 1)
- if self.isMathTopLevel(xObj):
+ if self.isMathTopLevel(xObj) or self.isMath(obj):
onSameLine = self.extentsAreOnSameLine(extents, xExtents, extents[3])
else:
onSameLine = self.extentsAreOnSameLine(extents, xExtents)
@@ -1267,6 +1267,9 @@ class Utilities(script_utilities.Utilities):
nextObj, nOffset = self.findNextCaretInOrder(nextObj, nOffset)
onRight = self._getContentsForObj(nextObj, nOffset, boundary)
+ if self._contentIsSubsetOf(objects[0], onRight[-1]):
+ onRight = onRight[0:-1]
+
onRight = list(filter(_include, onRight))
if not onRight:
break
@@ -1348,11 +1351,11 @@ class Utilities(script_utilities.Utilities):
if not (line and line[0]):
return []
- math = self.getMathAncestor(obj)
+ lastObj, lastOffset = line[-1][0], line[-1][2] - 1
+ math = self.getMathAncestor(lastObj)
if math:
lastObj, lastOffset = self.lastContext(math)
- else:
- lastObj, lastOffset = line[-1][0], line[-1][2] - 1
+
msg = "WEB: Last context on line is: %s, %i" % (lastObj, lastOffset)
debug.println(debug.LEVEL_INFO, msg, True)
diff --git a/test/html/empty-link-and-line-break.html b/test/html/empty-link-and-line-break.html
new file mode 100644
index 0000000..d570025
--- /dev/null
+++ b/test/html/empty-link-and-line-break.html
@@ -0,0 +1,13 @@
+<html>
+<head></head>
+<body>
+<div>Line 1</div>
+<div>
+<a name="foo"></a>
+Line 2 <a href="foo">foo</a> and
+<a href="bar">bar</a>
+<br />
+</div>
+<div>Line 3</div>
+</body>
+</html>
diff --git a/test/html/fraction.svg b/test/html/fraction.svg
new file mode 100644
index 0000000..c285d44
--- /dev/null
+++ b/test/html/fraction.svg
@@ -0,0 +1,22 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg xmlns:xlink="http://www.w3.org/1999/xlink" width="4.123ex" height="5.676ex" style="vertical-align:
-2.005ex;" viewBox="0 -1580.7 1775 2443.8" xmlns="http://www.w3.org/2000/svg">
+<defs>
+<path stroke-width="10" id="E1-MJMAIN-394" d="M51 0Q46 4 46 7Q46 9 215 357T388 709Q391 716 416 716Q439 716
444 709Q447 705 616 357T786 7Q786 4 781 0H51ZM507 344L384 596L137 92L383 91H630Q630 93 507 344Z"></path>
+<path stroke-width="10" id="E1-MJMATHI-79" d="M21 287Q21 301 36 335T84 406T158 442Q199 442 224 419T250
355Q248 336 247 334Q247 331 231 288T198 191T182 105Q182 62 196 45T238 27Q261 27 281 38T312 61T339 94Q339 95
344 114T358 173T377 247Q415 397 419 404Q432 431 462 431Q475 431 483 424T494 412T496 403Q496 390 447 193T391
-23Q363 -106 294 -155T156 -205Q111 -205 77 -183T43 -117Q43 -95 50 -80T69 -58T89 -48T106 -45Q150 -45 150
-87Q150 -107 138 -122T115 -142T102 -147L99 -148Q101 -153 118 -160T152 -167H160Q177 -167 186 -165Q219 -156 247
-127T290 -65T313 -9T321 21L315 17Q309 13 296 6T270 -6Q250 -11 231 -11Q185 -11 150 11T104 82Q103 89 103
113Q103 170 138 262T173 379Q173 380 173 381Q173 390 173 393T169 400T158 404H154Q131 404 112 385T82 344T65
302T57 280Q55 278 41 278H27Q21 284 21 287Z"></path>
+<path stroke-width="10" id="E1-MJMATHI-78" d="M52 289Q59 331 106 386T222 442Q257 442 286 424T329 379Q371 442
430 442Q467 442 494 420T522 361Q522 332 508 314T481 292T458 288Q439 288 427 299T415 328Q415 374 465 391Q454
404 425 404Q412 404 406 402Q368 386 350 336Q290 115 290 78Q290 50 306 38T341 26Q378 26 414 59T463 140Q466 150
469 151T485 153H489Q504 153 504 145Q504 144 502 134Q486 77 440 33T333 -11Q263 -11 227 52Q186 -10 133
-10H127Q78 -10 57 16T35 71Q35 103 54 123T99 143Q142 143 142 101Q142 81 130 66T107 46T94 41L91 40Q91 39 97
36T113 29T132 26Q168 26 194 71Q203 87 217 139T245 247T261 313Q266 340 266 352Q266 380 251 392T217 404Q177 404
142 372T93 290Q91 281 88 280T72 278H58Q52 284 52 289Z"></path>
+</defs>
+<g stroke="currentColor" fill="currentColor" stroke-width="0" transform="matrix(1 0 0 -1 0 0)">
+<g transform="translate(120,0)">
+<rect stroke="none" width="1535" height="60" x="0" y="220"></rect>
+<g transform="translate(97,734)">
+ <use xlink:href="#E1-MJMAIN-394" x="0" y="0"></use>
+ <use xlink:href="#E1-MJMATHI-79" x="838" y="0"></use>
+</g>
+<g transform="translate(60,-746)">
+ <use xlink:href="#E1-MJMAIN-394" x="0" y="0"></use>
+ <use xlink:href="#E1-MJMATHI-78" x="838" y="0"></use>
+</g>
+</g>
+</g>
+</svg>
\ No newline at end of file
diff --git a/test/html/mathml-has-display-none.html b/test/html/mathml-has-display-none.html
new file mode 100644
index 0000000..d8b2980
--- /dev/null
+++ b/test/html/mathml-has-display-none.html
@@ -0,0 +1,80 @@
+<html>
+<head>
+<meta charset="UTF-8">
+<style>
+ namespace m url(http://www.w3.org/1998/Math/MathML);
+.math-inline {
+ display:inline !important
+}
+.math-a11y {
+ clip:rect( 1px,1px,1px,1px );
+ overflow:hidden;
+ position:absolute;
+ width:1px;
+ height:1px;
+ opacity:0
+}
+
+span.bigger-font {
+ font-size:118%
+}
+</style>
+</head>
+<body>
+ <div>Line 1</div>
+ <div>
+ <span class="math-inline bigger-font math-a11y" style="display: none;">
+ <math xmlns="http://www.w3.org/1998/Math/MathML">
+ <semantics>
+ <mrow>
+ <mstyle displaystyle="true" scriptlevel="0">
+ <mrow>
+ <mfrac>
+ <mrow>
+ <mi mathvariant="normal">Δ</mi>
+ <mi>y</mi>
+ </mrow>
+ <mrow>
+ <mi mathvariant="normal">Δ</mi>
+ <mi>x</mi>
+ </mrow>
+ </mfrac>
+ </mrow>
+ </mstyle>
+ </mrow>
+ </semantics>
+ </math>
+ </span>
+ <img src="fraction.svg" aria-hidden="true" style="vertical-align: -2.005ex; width:4.123ex;
height:5.676ex;">.
+ </div>
+ <div>Line 3</div>
+<div>
+<dl>
+<dd><span><span class="math-inline math-a11y" style="display: none;"><math
xmlns="http://www.w3.org/1998/Math/MathML">
+ <semantics>
+ <mrow>
+ <mstyle displaystyle="true" scriptlevel="0">
+ <mrow>
+ <mfrac>
+ <mrow>
+ <mi mathvariant="normal">Δ<!-- Δ --></mi>
+ <mi>y</mi>
+ </mrow>
+ <mrow>
+ <mi mathvariant="normal">Δ<!-- Δ --></mi>
+ <mi>x</mi>
+ </mrow>
+ </mfrac>
+ </mrow>
+ </mstyle>
+ </mrow>
+ <annotation encoding="application/x-tex">{\displaystyle {\frac {\Delta y}{\Delta x}}}</annotation>
+ </semantics>
+</math>
+</span>
+<img src="fraction.svg" aria-hidden="true" style="vertical-align: -2.005ex; width:4.123ex;
height:5.676ex;"></span>.</dd>
+</dl>
+<p>Line 5</p>
+</div>
+</body>
+</html>
diff --git a/test/keystrokes/firefox/line_nav_empty_link_with_line_break.params
b/test/keystrokes/firefox/line_nav_empty_link_with_line_break.params
new file mode 100644
index 0000000..675a65c
--- /dev/null
+++ b/test/keystrokes/firefox/line_nav_empty_link_with_line_break.params
@@ -0,0 +1 @@
+PARAMS=$TEST_DIR/../../html/empty-link-and-line-break.html
diff --git a/test/keystrokes/firefox/line_nav_empty_link_with_line_break.py
b/test/keystrokes/firefox/line_nav_empty_link_with_line_break.py
new file mode 100644
index 0000000..7195008
--- /dev/null
+++ b/test/keystrokes/firefox/line_nav_empty_link_with_line_break.py
@@ -0,0 +1,66 @@
+#!/usr/bin/python
+
+from macaroon.playback import *
+import utils
+
+sequence = MacroSequence()
+
+#sequence.append(WaitForDocLoad())
+sequence.append(PauseAction(5000))
+
+# Work around some new quirk in Gecko that causes this test to fail if
+# run via the test harness rather than manually.
+sequence.append(KeyComboAction("<Control>r"))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Control>Home"))
+sequence.append(utils.AssertPresentationAction(
+ "1. Top of file",
+ ["BRAILLE LINE: 'Line 1'",
+ " VISIBLE: 'Line 1', cursor=1",
+ "SPEECH OUTPUT: 'Line 1'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "2. Line Down",
+ ["BRAILLE LINE: 'Line 2 foo and bar'",
+ " VISIBLE: 'Line 2 foo and bar', cursor=1",
+ "SPEECH OUTPUT: 'Line 2'",
+ "SPEECH OUTPUT: 'foo'",
+ "SPEECH OUTPUT: 'link.'",
+ "SPEECH OUTPUT: 'and'",
+ "SPEECH OUTPUT: 'bar'",
+ "SPEECH OUTPUT: 'link.'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "3. Line Down",
+ ["BRAILLE LINE: 'Line 3'",
+ " VISIBLE: 'Line 3', cursor=1",
+ "SPEECH OUTPUT: 'Line 3'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+ "4. Line Up",
+ ["BRAILLE LINE: 'Line 2 foo and bar'",
+ " VISIBLE: 'Line 2 foo and bar', cursor=1",
+ "SPEECH OUTPUT: 'Line 2'",
+ "SPEECH OUTPUT: 'foo'",
+ "SPEECH OUTPUT: 'link.'",
+ "SPEECH OUTPUT: 'and'",
+ "SPEECH OUTPUT: 'bar'",
+ "SPEECH OUTPUT: 'link.'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+ "5. Line Up",
+ ["BRAILLE LINE: 'Line 1'",
+ " VISIBLE: 'Line 1', cursor=1",
+ "SPEECH OUTPUT: 'Line 1'"]))
+
+sequence.append(utils.AssertionSummaryAction())
+sequence.start()
diff --git a/test/keystrokes/firefox/math_line_nav_punctuation.params
b/test/keystrokes/firefox/math_line_nav_punctuation.params
new file mode 100644
index 0000000..e190c20
--- /dev/null
+++ b/test/keystrokes/firefox/math_line_nav_punctuation.params
@@ -0,0 +1 @@
+PARAMS=$TEST_DIR/../../html/mathml-has-display-none.html
diff --git a/test/keystrokes/firefox/math_line_nav_punctuation.py
b/test/keystrokes/firefox/math_line_nav_punctuation.py
new file mode 100644
index 0000000..a298a42
--- /dev/null
+++ b/test/keystrokes/firefox/math_line_nav_punctuation.py
@@ -0,0 +1,100 @@
+#!/usr/bin/python
+
+from macaroon.playback import *
+import utils
+
+sequence = MacroSequence()
+
+#sequence.append(WaitForDocLoad())
+sequence.append(PauseAction(5000))
+
+# Work around some new quirk in Gecko that causes this test to fail if
+# run via the test harness rather than manually.
+sequence.append(KeyComboAction("<Control>r"))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("<Control>Home"))
+sequence.append(utils.AssertPresentationAction(
+ "1. Top of file",
+ ["BRAILLE LINE: 'Line 1'",
+ " VISIBLE: 'Line 1', cursor=1",
+ "SPEECH OUTPUT: 'Line 1'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "2. Line Down",
+ ["BRAILLE LINE: 'math.'",
+ " VISIBLE: 'math.', cursor=0",
+ "SPEECH OUTPUT: 'fraction start.'",
+ "SPEECH OUTPUT: 'Δ y over Δ x.'",
+ "SPEECH OUTPUT: 'fraction end.'",
+ "SPEECH OUTPUT: '.'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "3. Line Down",
+ ["BRAILLE LINE: 'Line 3'",
+ " VISIBLE: 'Line 3', cursor=1",
+ "SPEECH OUTPUT: 'Line 3'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "4 Line Down",
+ ["BRAILLE LINE: 'math.'",
+ " VISIBLE: 'math.', cursor=0",
+ "SPEECH OUTPUT: 'fraction start.'",
+ "SPEECH OUTPUT: 'Δ y over Δ x.'",
+ "SPEECH OUTPUT: 'fraction end.'",
+ "SPEECH OUTPUT: '.'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "5. Line Down",
+ ["BRAILLE LINE: 'Line 5'",
+ " VISIBLE: 'Line 5', cursor=1",
+ "SPEECH OUTPUT: 'Line 5'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+ "6. Line Up",
+ ["BRAILLE LINE: 'math.'",
+ " VISIBLE: 'math.', cursor=0",
+ "SPEECH OUTPUT: 'fraction start.'",
+ "SPEECH OUTPUT: 'Δ y over Δ x.'",
+ "SPEECH OUTPUT: 'fraction end.'",
+ "SPEECH OUTPUT: '.'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+ "7. Line Up",
+ ["BRAILLE LINE: 'Line 3'",
+ " VISIBLE: 'Line 3', cursor=1",
+ "SPEECH OUTPUT: 'Line 3'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+ "8 Line Up",
+ ["BRAILLE LINE: 'math.'",
+ " VISIBLE: 'math.', cursor=0",
+ "SPEECH OUTPUT: 'fraction start.'",
+ "SPEECH OUTPUT: 'Δ y over Δ x.'",
+ "SPEECH OUTPUT: 'fraction end.'",
+ "SPEECH OUTPUT: '.'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Up"))
+sequence.append(utils.AssertPresentationAction(
+ "9 Line Up",
+ ["BRAILLE LINE: 'Line 1'",
+ " VISIBLE: 'Line 1', cursor=1",
+ "SPEECH OUTPUT: 'Line 1'"]))
+
+sequence.append(utils.AssertionSummaryAction())
+sequence.start()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]