[orca] Ensure we present the start of an inline suggestion



commit ce2ba270991af539119e341468aaddb88baed5dd
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Feb 26 15:07:36 2020 +0100

    Ensure we present the start of an inline suggestion

 src/orca/script_utilities.py             |  3 +++
 src/orca/scripts/web/script_utilities.py |  7 +++++++
 src/orca/speech_generator.py             | 16 ++++++++++++++--
 3 files changed, 24 insertions(+), 2 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index ef24c3772..60c7bdc90 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -789,6 +789,9 @@ class Utilities:
     def isInlineSuggestion(self, obj):
         return False
 
+    def isFirstItemInInlineContentSuggestion(self, obj):
+        return False
+
     def isLastItemInInlineContentSuggestion(self, obj):
         return False
 
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index bf1532326..cb59ffae6 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -2195,6 +2195,13 @@ class Utilities(script_utilities.Utilities):
         displayStyle = self._getDisplayStyle(obj)
         return "inline" in displayStyle
 
+    def isFirstItemInInlineContentSuggestion(self, obj):
+        suggestion = pyatspi.findAncestor(obj, self.isInlineSuggestion)
+        if not (suggestion and suggestion.childCount):
+            return False
+
+        return suggestion[0] == obj
+
     def isLastItemInInlineContentSuggestion(self, obj):
         suggestion = pyatspi.findAncestor(obj, self.isInlineSuggestion)
         if not (suggestion and suggestion.childCount):
diff --git a/src/orca/speech_generator.py b/src/orca/speech_generator.py
index 37e6107f7..a8cad576c 100644
--- a/src/orca/speech_generator.py
+++ b/src/orca/speech_generator.py
@@ -314,7 +314,13 @@ class SpeechGenerator(generator.Generator):
         if startOffset != 0:
             return []
 
-        result = [messages.CONTENT_DELETION_START]
+        result = []
+        if self._script.utilities.isFirstItemInInlineContentSuggestion(obj):
+            result.extend([object_properties.ROLE_CONTENT_SUGGESTION])
+            result.extend(self.voice(SYSTEM))
+            result.extend(self._generatePause(obj, **args))
+
+        result.extend([messages.CONTENT_DELETION_START])
         result.extend(self.voice(SYSTEM))
         return result
 
@@ -346,7 +352,13 @@ class SpeechGenerator(generator.Generator):
         if startOffset != 0:
             return []
 
-        result = [messages.CONTENT_INSERTION_START]
+        result = []
+        if self._script.utilities.isFirstItemInInlineContentSuggestion(obj):
+            result.extend([object_properties.ROLE_CONTENT_SUGGESTION])
+            result.extend(self.voice(SYSTEM))
+            result.extend(self._generatePause(obj, **args))
+
+        result.extend([messages.CONTENT_INSERTION_START])
         result.extend(self.voice(SYSTEM))
         return result
 


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