Index: src/orca/scripts/Thunderbird.py
===================================================================
--- src/orca/scripts/Thunderbird.py	(revision 2025)
+++ src/orca/scripts/Thunderbird.py	(working copy)
@@ -27,9 +27,11 @@
 __license__   = "LGPL"
 
 import orca.orca as orca
+import orca.orca_state as orca_state
 import orca.atspi as atspi
 import orca.debug as debug
 import orca.default as default
+import orca.input_event as input_event
 import orca.rolenames as rolenames
 import orca.settings as settings
 import orca.braille as braille
@@ -47,7 +49,7 @@
 #                                                                      #
 ########################################################################
 
-class BrailleGenerator(braillegenerator.BrailleGenerator):
+class BrailleGenerator(Gecko.BrailleGenerator):
     """Provides a braille generator specific to Gecko.
     """
 
@@ -55,7 +57,9 @@
         self.debugLevel = debug.LEVEL_FINEST
 
         self._debug("__init__")
-        braillegenerator.BrailleGenerator.__init__(self, script)
+        Gecko.BrailleGenerator.__init__(self, script)
+        self.brailleGenerators[rolenames.ROLE_DOCUMENT_FRAME] = \
+             self._getBrailleRegionsForText
 
     def _debug(self, msg):
         """ Convenience method for printing debug messages
@@ -106,6 +110,9 @@
                     if next:
                         self._debug("_getDefaultBrailleRegions: next='%s', role='%s'" \
                                     % (next.name, next.role))
+            else:
+                prev = None
+                next = None
 
             # Get the entry text.
             [word, startOffset, endOffset] = obj.text.getTextAtOffset(0,
@@ -145,7 +152,6 @@
 
         return [regions, componentRegion]
 
-
     def _getBrailleRegionsForText(self, obj):
         """Get the braille for a text component.
 
@@ -159,18 +165,17 @@
         # Gecko._getBrailleRegionsForText does not return the correct
         # braille for Thunderbird. Let the default braillegenerator
         # handle this.
-        return braillegenerator.BrailleGenerator._getBrailleRegionsForText(
-                self, obj)
+        #
+        return braillegenerator.BrailleGenerator._getBrailleRegionsForText(\
+            self, obj)
 
-
-
 ########################################################################
 #                                                                      #
 # Custom SpeechGenerator for Thunderbird                               #
 #                                                                      #
 ########################################################################
 
-class SpeechGenerator(speechgenerator.SpeechGenerator):
+class SpeechGenerator(Gecko.SpeechGenerator):
     """Provides a speech generator specific to Thunderbird.
     """
 
@@ -180,7 +185,9 @@
         self.debugLevel = debug.LEVEL_FINEST
 
         self._debug("__init__")
-        speechgenerator.SpeechGenerator.__init__(self, script)
+        Gecko.SpeechGenerator.__init__(self, script)
+        self.speechGenerators[rolenames.ROLE_DOCUMENT_FRAME] = \
+             self._getSpeechForText
 
     def _debug(self, msg):
         """ Convenience method for printing debug messages
@@ -391,6 +398,32 @@
         #
         default.Script.onStateChanged(self, event)
 
+    def onCaretMoved(self, event):
+        """Called whenever the caret moves.
+
+        Arguments:
+        - event: the Event
+        """
+
+        # We expect text inserted methods to tell us when to speak
+        # text areas.  But, when someone tabs into one, we don't
+        # always get this.  So...we'll look to see if they tabbed
+        # in and will present the text if they did.  The endswith
+        # bit is to capture Tab and ISO_Left_Tab.
+        #
+        if event and event.source and \
+           (event.source != orca_state.locusOfFocus) and \
+            event.source.state.count(atspi.Accessibility.STATE_FOCUSED):
+            if isinstance(orca_state.lastInputEvent,
+                          input_event.KeyboardEvent) \
+                and event.source.parent \
+                and (event.source.parent.role == rolenames.ROLE_AUTOCOMPLETE):
+                string = orca_state.lastInputEvent.event_string
+                if (string.endswith("Tab")):
+                    self.sayLine(event.source)
+
+        Gecko.Script.onCaretMoved(self, event)
+
     def onTextInserted(self, event):
         """Called whenever text is inserted into an object.
 
@@ -523,3 +556,14 @@
             return True
 
         return False
+
+    def inDocumentContent(self, obj=None):
+        """Returns True if the given object (defaults to the current
+        locus of focus is in the document content).
+        """
+        # For now, we just let default.py take care of everything for
+        # Thunderbird.  This is a major hack, and it's here because
+        # we're having problems with the Gecko script handling message
+        # composition.
+        #
+        return False
