[orca] Present Firefox "door hanger" alerts



commit b216ddbebdaa222d78dfd6dae62a94cb9741ceec
Author: Joanmarie Diggs <jdiggs igalia com>
Date:   Wed Oct 7 17:44:23 2015 -0400

    Present Firefox "door hanger" alerts
    
    Note: This functionality requires Firefox nightly and is still a work in
    progress for both Orca and Firefox.

 src/orca/formatting.py                    |    2 +-
 src/orca/scripts/toolkits/Gecko/script.py |    6 ++++++
 src/orca/scripts/web/script_utilities.py  |   15 +++++++++++++++
 3 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/src/orca/formatting.py b/src/orca/formatting.py
index 2b3da2f..861780c 100644
--- a/src/orca/formatting.py
+++ b/src/orca/formatting.py
@@ -107,7 +107,7 @@ formatting = {
             'detailedWhereAmI' : 'pageSummary'
             },
         pyatspi.ROLE_ALERT: {
-            'unfocused': 'expandedEOCs or (labelOrName + unrelatedLabels)'
+            'unfocused': 'labelOrName + roleName + pause + (expandedEOCs or unrelatedLabels)'
             },
         pyatspi.ROLE_ANIMATION: {
             'unfocused': 'labelAndName'
diff --git a/src/orca/scripts/toolkits/Gecko/script.py b/src/orca/scripts/toolkits/Gecko/script.py
index a9f75cf..de29b1a 100644
--- a/src/orca/scripts/toolkits/Gecko/script.py
+++ b/src/orca/scripts/toolkits/Gecko/script.py
@@ -244,6 +244,12 @@ class Script(web.Script):
         if super().onShowingChanged(event):
             return
 
+        if event.detail1 and self.utilities.isTopLevelChromeAlert(event.source):
+            msg = "GECKO: Event handled: Presenting event source"
+            debug.println(debug.LEVEL_INFO, msg)
+            self.presentObject(event.source)
+            return True
+
         msg = "GECKO: Passing along event to default script"
         debug.println(debug.LEVEL_INFO, msg)
         default.Script.onShowingChanged(self, event)
diff --git a/src/orca/scripts/web/script_utilities.py b/src/orca/scripts/web/script_utilities.py
index 3b1989c..f3c1d48 100644
--- a/src/orca/scripts/web/script_utilities.py
+++ b/src/orca/scripts/web/script_utilities.py
@@ -1873,6 +1873,21 @@ class Utilities(script_utilities.Utilities):
         self._isAnchor[hash(obj)] = rv
         return rv
 
+    def isChromeAlert(self, obj):
+        if not (obj and obj.getRole() == pyatspi.ROLE_ALERT):
+            return False
+
+        if self.inDocumentContent(obj):
+            return False
+
+        return True
+
+    def isTopLevelChromeAlert(self, obj):
+        if not self.isChromeAlert(obj):
+            return False
+
+        return obj.parent.getRole() == pyatspi.ROLE_FRAME
+
     def isClickableElement(self, obj):
         if not (obj and self.inDocumentContent(obj)):
             return False


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