[orca] Present description for elements which use font icons for sharing links



commit d2404dbfcbc3dbd18d89ec78acddba12415099a4
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date:   Wed Jan 29 13:56:34 2020 -0500

    Present description for elements which use font icons for sharing links

 src/orca/scripts/web/script_utilities.py | 14 ++++++++++++--
 src/orca/scripts/web/speech_generator.py | 10 +++-------
 2 files changed, 15 insertions(+), 9 deletions(-)
---
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 930f5afac..af8f20b86 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -3575,6 +3575,11 @@ class Utilities(script_utilities.Utilities):
             debug.println(debug.LEVEL_INFO, msg, True)
             return False
 
+        if len(obj.name) == 1 and ord(obj.name) in range(0xe000, 0xf8ff):
+            msg = "WEB: name of %s is in unicode private use area" % obj
+            debug.println(debug.LEVEL_INFO, msg, True)
+            return False
+
         return True
 
     def isUselessEmptyElement(self, obj):
@@ -4724,8 +4729,13 @@ class Utilities(script_utilities.Utilities):
             debug.println(debug.LEVEL_INFO, msg, True)
             rv = False
         else:
-            roles = [pyatspi.ROLE_PUSH_BUTTON]
-            rv = role in roles and len(name) == 1 and description
+            if len(obj.name) == 1 and ord(obj.name) in range(0xe000, 0xf8ff):
+                msg = "WEB: name of %s is in unicode private use area" % obj
+                debug.println(debug.LEVEL_INFO, msg, True)
+                rv = True
+            else:
+                roles = [pyatspi.ROLE_PUSH_BUTTON]
+                rv = role in roles and len(name) == 1 and description
 
         self._preferDescriptionOverName[hash(obj)] = rv
         return rv
diff --git a/src/orca/scripts/web/speech_generator.py b/src/orca/scripts/web/speech_generator.py
index a3f2aef16..6d2f4ed98 100644
--- a/src/orca/scripts/web/speech_generator.py
+++ b/src/orca/scripts/web/speech_generator.py
@@ -268,9 +268,6 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
            and not self._script.utilities.isDPub(obj):
             return []
 
-        if obj.name and not self._script.utilities.hasValidName(obj):
-            return []
-
         role = args.get('role', obj.getRole())
         alwaysPresent = [pyatspi.ROLE_PUSH_BUTTON,
                          pyatspi.ROLE_IMAGE]
@@ -284,13 +281,12 @@ class SpeechGenerator(speech_generator.SpeechGenerator):
         if role in [pyatspi.ROLE_COMBO_BOX, pyatspi.ROLE_SPIN_BUTTON]:
             return super()._generateName(obj, **args)
 
-        if self._script.utilities.isLink(obj) \
-           and not self._script.utilities.hasExplicitName(obj):
-            return []
-
         if obj.name:
             if self._script.utilities.preferDescriptionOverName(obj):
                 result = [obj.description]
+            elif self._script.utilities.isLink(obj) \
+                 and not self._script.utilities.hasExplicitName(obj):
+                return []
             else:
                 name = obj.name
                 if not self._script.utilities.hasExplicitName(obj):


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]