[orca/gnome-3-4] Fix for bug 672464 - Orca double presents headings which are links in WebKitGtk
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca/gnome-3-4] Fix for bug 672464 - Orca double presents headings which are links in WebKitGtk
- Date: Thu, 5 Apr 2012 00:30:58 +0000 (UTC)
commit 72b0b928800cb828dd5687036a8097fa54a7c181
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Wed Apr 4 20:31:05 2012 -0400
Fix for bug 672464 - Orca double presents headings which are links in WebKitGtk
.../toolkits/WebKitGtk/braille_generator.py | 30 ++++++++++-----
.../scripts/toolkits/WebKitGtk/speech_generator.py | 40 ++++++++++++--------
.../toolkits/WebKitGtk/structural_navigation.py | 18 +++++++--
3 files changed, 58 insertions(+), 30 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/WebKitGtk/braille_generator.py b/src/orca/scripts/toolkits/WebKitGtk/braille_generator.py
index a5bd3cc..0d4ddfa 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/braille_generator.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/braille_generator.py
@@ -1,8 +1,9 @@
# Orca
#
# Copyright (C) 2010 Joanmarie Diggs
+# Copyright (C) 2011-2012 Igalia, S.L.
#
-# Author: Joanmarie Diggs <joanied gnome org>
+# Author: Joanmarie Diggs <jdiggs igalia com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -22,7 +23,8 @@
__id__ = "$Id$"
__version__ = "$Revision$"
__date__ = "$Date$"
-__copyright__ = "Copyright (c) 2010 Joanmarie Diggs"
+__copyright__ = "Copyright (c) 2010 Joanmarie Diggs" \
+ "Copyright (c) 2011-2012 Igalia, S.L."
__license__ = "LGPL"
import pyatspi
@@ -43,6 +45,20 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
def __init__(self, script):
braille_generator.BrailleGenerator.__init__(self, script)
+ def __generateHeadingRole(self, obj):
+ result = []
+ level = self._script.utilities.headingLevel(obj)
+ # Translators: the 'h' below represents a heading level
+ # attribute for content that you might find in something
+ # such as HTML content (e.g., <h1>). The translated form
+ # is meant to be a single character followed by a numeric
+ # heading level, where the single character is to indicate
+ # 'heading'.
+ #
+ result.append(_("h%d" % level))
+
+ return result
+
def _generateRoleName(self, obj, **args):
"""Prevents some roles from being displayed."""
@@ -50,19 +66,13 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
role = args.get('role', obj.getRole())
if role == pyatspi.ROLE_HEADING:
level = self._script.utilities.headingLevel(obj)
- # Translators: the 'h' below represents a heading level
- # attribute for content that you might find in something
- # such as HTML content (e.g., <h1>). The translated form
- # is meant to be a single character followed by a numeric
- # heading level, where the single character is to indicate
- # 'heading'.
- #
- result.append(_("h%d" % level))
elif not role in [pyatspi.ROLE_SECTION,
pyatspi.ROLE_FORM,
pyatspi.ROLE_UNKNOWN]:
result.extend(braille_generator.BrailleGenerator._generateRoleName(
self, obj, **args))
+ if obj.parent and obj.parent.getRole() == pyatspi.ROLE_HEADING:
+ result.extend(self.__generateHeadingRole(obj.parent))
return result
diff --git a/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py b/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
index a9d781d..ca099fc 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
@@ -1,7 +1,7 @@
# Orca
#
# Copyright (C) 2010 Joanmarie Diggs
-# Copyright (C) 2011 Igalia, S.L.
+# Copyright (C) 2011-2012 Igalia, S.L.
#
# Author: Joanmarie Diggs <jdiggs igalia com>
#
@@ -24,7 +24,7 @@ __id__ = "$Id$"
__version__ = "$Revision$"
__date__ = "$Date$"
__copyright__ = "Copyright (c) 2010 Joanmarie Diggs" \
- "Copyright (c) 2011 Igalia, S.L."
+ "Copyright (c) 2011-2012 Igalia, S.L."
__license__ = "LGPL"
import pyatspi
@@ -80,6 +80,24 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
return result
+ def __generateHeadingRole(self, obj):
+ result = []
+ role = pyatspi.ROLE_HEADING
+ level = self._script.utilities.headingLevel(obj)
+ if level:
+ # Translators: the %(level)d is in reference to a heading
+ # level in HTML (e.g., For <h3>, the level is 3)
+ # and the %(role)s is in reference to a previously
+ # translated rolename for the heading.
+ #
+ result.append(_("%(role)s level %(level)d") % {
+ 'role': self.getLocalizedRoleName(obj, role),
+ 'level': level})
+ else:
+ result.append(self.getLocalizedRoleName(obj, role))
+
+ return result
+
def _generateRoleName(self, obj, **args):
if _settingsManager.getSetting('onlySpeakDisplayedText'):
return []
@@ -105,22 +123,12 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
obj, [pyatspi.ROLE_LINK], [pyatspi.ROLE_DOCUMENT_FRAME])
if link:
result.append(self.getLocalizedRoleName(link))
-
- if role == pyatspi.ROLE_HEADING:
- level = self._script.utilities.headingLevel(obj)
- if level:
- # Translators: the %(level)d is in reference to a heading
- # level in HTML (e.g., For <h3>, the level is 3)
- # and the %(role)s is in reference to a previously
- # translated rolename for the heading.
- #
- result.append(_("%(role)s level %(level)d") % {
- 'role': self.getLocalizedRoleName(obj, role),
- 'level': level})
- else:
- result.append(self.getLocalizedRoleName(obj, role))
+ elif role == pyatspi.ROLE_HEADING:
+ result.extend(self.__generateHeadingRole(obj))
else:
result.append(self.getLocalizedRoleName(obj, role))
+ if obj.parent and obj.parent.getRole() == pyatspi.ROLE_HEADING:
+ result.extend(self.__generateHeadingRole(obj.parent))
if result:
result.extend(acss)
diff --git a/src/orca/scripts/toolkits/WebKitGtk/structural_navigation.py b/src/orca/scripts/toolkits/WebKitGtk/structural_navigation.py
index 36df733..c2840f4 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/structural_navigation.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/structural_navigation.py
@@ -1,8 +1,9 @@
# Orca
#
# Copyright (C) 2010 Joanmarie Diggs
+# Copyright (C) 2011-2012 Igalia, S.L.
#
-# Author: Joanmarie Diggs <joanied gnome org>
+# Author: Joanmarie Diggs <jdiggs igalia com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -22,7 +23,8 @@
__id__ = "$Id$"
__version__ = "$Revision$"
__date__ = "$Date$"
-__copyright__ = "Copyright (c) 2010 Joanmarie Diggs"
+__copyright__ = "Copyright (c) 2010 Joanmarie Diggs" \
+ "Copyright (c) 2011-2012 Igalia, S.L."
__license__ = "LGPL"
import pyatspi
@@ -57,8 +59,16 @@ class StructuralNavigation(structural_navigation.StructuralNavigation):
positioned.
"""
- if obj.getRole() == pyatspi.ROLE_LIST and obj.childCount:
- obj = obj[0]
+ if not obj.childCount:
+ return [obj, 0]
+
+ child = obj[0]
+ if obj.getRole() == pyatspi.ROLE_LIST:
+ return [child, 0]
+
+ name = obj.name
+ if name and name == child.name and child.getRole() == pyatspi.ROLE_LINK:
+ return [child, 0]
return [obj, 0]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]