[orca] Don't present canvas elements which lack fallback content
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Don't present canvas elements which lack fallback content
- Date: Mon, 12 Oct 2015 22:22:59 +0000 (UTC)
commit b1c83f412e3a903f6d528412da52d66548055739
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Mon Oct 12 18:20:14 2015 -0400
Don't present canvas elements which lack fallback content
src/orca/scripts/web/script_utilities.py | 4 +-
test/html/canvas-fallback.html | 12 +++++
test/keystrokes/firefox/line_nav_canvas.params | 1 +
test/keystrokes/firefox/line_nav_canvas.py | 52 ++++++++++++++++++++++++
4 files changed, 68 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index b83c0d0..04f89e2 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2011,7 +2011,7 @@ class Utilities(script_utilities.Utilities):
return rv
rv = True
- if obj.getRole() != pyatspi.ROLE_IMAGE:
+ if obj.getRole() not in [pyatspi.ROLE_IMAGE, pyatspi.ROLE_CANVAS]:
rv = False
if rv and (obj.name or obj.description or obj.childCount):
rv = False
@@ -2029,6 +2029,8 @@ class Utilities(script_utilities.Utilities):
width, height = image.getImageSize()
if width > 25 and height > 25:
rv = False
+ if rv and 'Text' in pyatspi.listInterfaces(obj):
+ rv = self.queryNonEmptyText(obj) is None
self._isUselessImage[hash(obj)] = rv
return rv
diff --git a/test/html/canvas-fallback.html b/test/html/canvas-fallback.html
new file mode 100644
index 0000000..83a926a
--- /dev/null
+++ b/test/html/canvas-fallback.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+</head>
+<body>
+<div>line 1</div>
+<div><canvas>line 2</canvas></div>
+<canvas><div>line 3</div></canvas>
+<div>line <canvas></canvas> 4</div>
+<div><canvas aria-label="line 5"></canvas>
+</div>
+</body>
+</html>
diff --git a/test/keystrokes/firefox/line_nav_canvas.params b/test/keystrokes/firefox/line_nav_canvas.params
new file mode 100644
index 0000000..fab106b
--- /dev/null
+++ b/test/keystrokes/firefox/line_nav_canvas.params
@@ -0,0 +1 @@
+PARAMS=$TEST_DIR/../../html/canvas-fallback.html
diff --git a/test/keystrokes/firefox/line_nav_canvas.py b/test/keystrokes/firefox/line_nav_canvas.py
new file mode 100644
index 0000000..74c6b70
--- /dev/null
+++ b/test/keystrokes/firefox/line_nav_canvas.py
@@ -0,0 +1,52 @@
+#!/usr/bin/python
+
+from macaroon.playback import *
+import utils
+
+sequence = MacroSequence()
+
+sequence.append(WaitForDocLoad())
+
+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 canvas'",
+ " VISIBLE: 'line 2 canvas', cursor=1",
+ "SPEECH OUTPUT: 'line 2 canvas.'"]))
+
+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: 'line 4'",
+ " VISIBLE: 'line 4', cursor=1",
+ "SPEECH OUTPUT: 'line'",
+ "SPEECH OUTPUT: '4'"]))
+
+sequence.append(utils.StartRecordingAction())
+sequence.append(KeyComboAction("Down"))
+sequence.append(utils.AssertPresentationAction(
+ "5. Line Down",
+ ["BRAILLE LINE: 'line 5 canvas'",
+ " VISIBLE: 'line 5 canvas', cursor=1",
+ "SPEECH OUTPUT: 'line 5 canvas.'"]))
+
+sequence.append(utils.AssertionSummaryAction())
+sequence.start()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]