[orca] Improve presentation of Dojo color-chooser buttons
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Improve presentation of Dojo color-chooser buttons
- Date: Tue, 23 Apr 2019 20:50:30 +0000 (UTC)
commit 8c1fffae0b742abd207aa1e999f19bc32d9c1816
Author: Joanmarie Diggs <jdiggs igalia com>
Date: Tue Apr 23 16:49:28 2019 -0400
Improve presentation of Dojo color-chooser buttons
src/orca/scripts/web/braille_generator.py | 8 ++++++-
src/orca/scripts/web/script.py | 3 ++-
src/orca/scripts/web/script_utilities.py | 37 +++++++++++++++++++++++++++++++
src/orca/scripts/web/speech_generator.py | 2 +-
4 files changed, 47 insertions(+), 3 deletions(-)
---
diff --git a/src/orca/scripts/web/braille_generator.py b/src/orca/scripts/web/braille_generator.py
index 1d9dfac46..953297d9d 100644
--- a/src/orca/scripts/web/braille_generator.py
+++ b/src/orca/scripts/web/braille_generator.py
@@ -152,6 +152,12 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
return result
+ def _generateRealActiveDescendantDisplayedText(self, obj, **args):
+ if not self._script.utilities.inDocumentContent(obj):
+ return super()._generateRealActiveDescendantDisplayedText(obj, **args)
+
+ return self._generateDisplayedText(obj, **args)
+
def _generateTableCellRow(self, obj, **args):
if not self._script.inFocusMode():
return super()._generateTableCellRow(obj, **args)
@@ -161,7 +167,7 @@ class BrailleGenerator(braille_generator.BrailleGenerator):
isRow = lambda x: x and x.getRole() == pyatspi.ROLE_TABLE_ROW
row = pyatspi.findAncestor(obj, isRow)
- if row and row.name:
+ if row and row.name and not self._script.utilities.isLayoutOnly(row):
return self.generate(row, includeContext=False)
return super()._generateTableCellRow(obj, **args)
diff --git a/src/orca/scripts/web/script.py b/src/orca/scripts/web/script.py
index 47e461f7f..d5ef10d6e 100644
--- a/src/orca/scripts/web/script.py
+++ b/src/orca/scripts/web/script.py
@@ -1182,7 +1182,8 @@ class Script(default.Script):
self.utilities.setCaretContext(newFocus, caretOffset)
self.updateBraille(newFocus)
- if self.utilities.isContentEditableWithEmbeddedObjects(newFocus):
+ if self.utilities.isContentEditableWithEmbeddedObjects(newFocus) \
+ and not (newFocus.getRole() == pyatspi.ROLE_TABLE_CELL and newFocus.name):
msg = "WEB: New focus %s content editable. Generating line contents." % newFocus
debug.println(debug.LEVEL_INFO, msg, True)
contents = self.utilities.getLineContentsAtOffset(newFocus, caretOffset)
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 591e9710f..e735b268a 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -100,6 +100,7 @@ class Utilities(script_utilities.Utilities):
self._preferDescriptionOverName = {}
self._shouldFilter = {}
self._shouldInferLabelFor = {}
+ self._shouldReadFullRow = {}
self._text = {}
self._tag = {}
self._xmlRoles = {}
@@ -172,6 +173,7 @@ class Utilities(script_utilities.Utilities):
self._preferDescriptionOverName = {}
self._shouldFilter = {}
self._shouldInferLabelFor = {}
+ self._shouldReadFullRow = {}
self._tag = {}
self._xmlRoles = {}
self._treatAsDiv = {}
@@ -2310,6 +2312,32 @@ class Utilities(script_utilities.Utilities):
self._isGridDescendant[hash(obj)] = rv
return rv
+ def shouldReadFullRow(self, obj):
+ if not (obj and self.inDocumentContent(obj)):
+ return super().shouldReadFullRow(obj)
+
+ rv = self._shouldReadFullRow.get(hash(obj))
+ if rv is not None:
+ return rv
+
+ try:
+ role = obj.getRole()
+ state = obj.getState()
+ except:
+ msg = "ERROR: Exception getting role and state for %s" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+ return False
+
+ if role == pyatspi.ROLE_TABLE_CELL and state.contains(pyatspi.STATE_FOCUSABLE):
+ msg = "WEB: Should not read full row: focusable cell %s" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+ rv = False
+ else:
+ rv = super().shouldReadFullRow(obj)
+
+ self._shouldReadFullRow[hash(obj)] = rv
+ return rv
+
def isEntryDescendant(self, obj):
if not obj:
return False
@@ -2381,6 +2409,9 @@ class Utilities(script_utilities.Utilities):
rv = self._isLayoutOnly.get(hash(obj))
if rv is not None:
+ if rv:
+ msg = "WEB: %s is deemed to be layout only" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
return rv
try:
@@ -2402,9 +2433,15 @@ class Utilities(script_utilities.Utilities):
rv = False
elif self.isFigure(obj):
rv = False
+ elif role == pyatspi.ROLE_TABLE_ROW:
+ rv = not self.hasExplicitName(obj)
else:
rv = super().isLayoutOnly(obj)
+ if rv:
+ msg = "WEB: %s is deemed to be layout only" % obj
+ debug.println(debug.LEVEL_INFO, msg, True)
+
self._isLayoutOnly[hash(obj)] = rv
return rv
diff --git a/src/orca/scripts/web/speech_generator.py b/src/orca/scripts/web/speech_generator.py
index 90a4f9594..e3caafde1 100644
--- a/src/orca/scripts/web/speech_generator.py
+++ b/src/orca/scripts/web/speech_generator.py
@@ -504,7 +504,7 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
isRow = lambda x: x and x.getRole() == pyatspi.ROLE_TABLE_ROW
row = pyatspi.findAncestor(obj, isRow)
- if row and row.name:
+ if row and row.name and not self._script.utilities.isLayoutOnly(row):
return self.generate(row)
return super()._generateTableCellRow(obj, **args)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]