[orca] Handle ROLE_DOCUMENT_WEB for WebKitGtk content
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Handle ROLE_DOCUMENT_WEB for WebKitGtk content
- Date: Sat, 1 Feb 2014 23:37:52 +0000 (UTC)
commit 72c7ca4f2b01706098dd38b2ad9d50c2475a7c9f
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Sat Feb 1 18:36:54 2014 -0500
Handle ROLE_DOCUMENT_WEB for WebKitGtk content
src/orca/scripts/toolkits/WebKitGtk/script.py | 16 ++++++++++------
.../scripts/toolkits/WebKitGtk/script_utilities.py | 5 ++++-
.../scripts/toolkits/WebKitGtk/speech_generator.py | 4 +++-
src/orca/structural_navigation.py | 5 +++--
4 files changed, 20 insertions(+), 10 deletions(-)
---
diff --git a/src/orca/scripts/toolkits/WebKitGtk/script.py b/src/orca/scripts/toolkits/WebKitGtk/script.py
index feaced0..c8b93a8 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/script.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/script.py
@@ -213,13 +213,15 @@ class Script(default.Script):
def onDocumentReload(self, event):
"""Callback for document:reload accessibility events."""
- if event.source.getRole() == pyatspi.ROLE_DOCUMENT_FRAME:
+ docRoles = [pyatspi.ROLE_DOCUMENT_FRAME, pyatspi.ROLE_DOCUMENT_WEB]
+ if event.source.getRole() in docRoles:
self._loadingDocumentContent = True
def onDocumentLoadComplete(self, event):
"""Callback for document:load-complete accessibility events."""
- if event.source.getRole() != pyatspi.ROLE_DOCUMENT_FRAME:
+ docRoles = [pyatspi.ROLE_DOCUMENT_FRAME, pyatspi.ROLE_DOCUMENT_WEB]
+ if not event.source.getRole() in docRoles:
return
self._loadingDocumentContent = False
@@ -240,7 +242,8 @@ class Script(default.Script):
def onDocumentLoadStopped(self, event):
"""Callback for document:load-stopped accessibility events."""
- if event.source.getRole() == pyatspi.ROLE_DOCUMENT_FRAME:
+ docRoles = [pyatspi.ROLE_DOCUMENT_FRAME, pyatspi.ROLE_DOCUMENT_WEB]
+ if event.source.getRole() in docRoles:
self._loadingDocumentContent = False
def onFocusedChanged(self, event):
@@ -284,7 +287,8 @@ class Script(default.Script):
except:
return
- if role != pyatspi.ROLE_DOCUMENT_FRAME or not self._isBrowser:
+ docRoles = [pyatspi.ROLE_DOCUMENT_FRAME, pyatspi.ROLE_DOCUMENT_WEB]
+ if role not in docRoles or not self._isBrowser:
return
if event.detail1:
@@ -564,8 +568,8 @@ class Script(default.Script):
if obj.getRole() == pyatspi.ROLE_LINK:
obj = obj.parent
- document = utils.findAncestor(
- obj, lambda x: x.getRole() == pyatspi.ROLE_DOCUMENT_FRAME)
+ docRoles = [pyatspi.ROLE_DOCUMENT_FRAME, pyatspi.ROLE_DOCUMENT_WEB]
+ document = utils.findAncestor(obj, lambda x: x.getRole() in docRoles)
if not document or document.getState().contains(pyatspi.STATE_BUSY):
return
diff --git a/src/orca/scripts/toolkits/WebKitGtk/script_utilities.py
b/src/orca/scripts/toolkits/WebKitGtk/script_utilities.py
index c390893..76f3e6e 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/script_utilities.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/script_utilities.py
@@ -76,7 +76,10 @@ class Utilities(script_utilities.Utilities):
if not obj:
return False
- attrs = dict([attr.split(':', 1) for attr in obj.getAttributes()])
+ try:
+ attrs = dict([attr.split(':', 1) for attr in obj.getAttributes()])
+ except:
+ return False
return attrs.get('toolkit', '') == 'WebKitGtk'
def isReadOnlyTextArea(self, obj):
diff --git a/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
b/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
index 43e8299..ca03b48 100644
--- a/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
+++ b/src/orca/scripts/toolkits/WebKitGtk/speech_generator.py
@@ -112,9 +112,10 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
pyatspi.ROLE_TABLE_CELL])
if not (role in doNotSpeak):
+ docRoles = [pyatspi.ROLE_DOCUMENT_FRAME, pyatspi.ROLE_DOCUMENT_WEB]
if role == pyatspi.ROLE_IMAGE:
link = self._script.utilities.ancestorWithRole(
- obj, [pyatspi.ROLE_LINK], [pyatspi.ROLE_DOCUMENT_FRAME])
+ obj, [pyatspi.ROLE_LINK], docRoles)
if link:
result.append(self.getLocalizedRoleName(link))
elif role == pyatspi.ROLE_HEADING:
@@ -155,6 +156,7 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
return []
args['stopAtRoles'] = [pyatspi.ROLE_DOCUMENT_FRAME,
+ pyatspi.ROLE_DOCUMENT_WEB,
pyatspi.ROLE_EMBEDDED,
pyatspi.ROLE_INTERNAL_FRAME,
pyatspi.ROLE_FORM,
diff --git a/src/orca/structural_navigation.py b/src/orca/structural_navigation.py
index 2a561db..4562d2a 100644
--- a/src/orca/structural_navigation.py
+++ b/src/orca/structural_navigation.py
@@ -570,7 +570,8 @@ class StructuralNavigation:
pyatspi.ROLE_TABLE_CELL,
pyatspi.ROLE_TEXT,
pyatspi.ROLE_SECTION,
- pyatspi.ROLE_DOCUMENT_FRAME]
+ pyatspi.ROLE_DOCUMENT_FRAME,
+ pyatspi.ROLE_DOCUMENT_WEB]
def __init__(self, script, enabledTypes, enabled=False):
"""Creates an instance of the StructuralNavigation class.
@@ -1169,7 +1170,7 @@ class StructuralNavigation:
interest is contained.
"""
- docRoles = [pyatspi.ROLE_DOCUMENT_FRAME]
+ docRoles = [pyatspi.ROLE_DOCUMENT_FRAME, pyatspi.ROLE_DOCUMENT_WEB]
stopRoles = [pyatspi.ROLE_FRAME, pyatspi.ROLE_SCROLL_PANE]
document = self._script.utilities.ancestorWithRole(
orca_state.locusOfFocus, docRoles, stopRoles)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]