OSDN Git Service

In Mozilla browsers, browse mode can again be used when Flash content is focused.
authorJames Teh <jamie@jantrid.net>
Thu, 31 Jan 2013 04:35:42 +0000 (14:35 +1000)
committerJames Teh <jamie@jantrid.net>
Thu, 31 Jan 2013 04:35:42 +0000 (14:35 +1000)
Specifically, this was a problem when Flash protected mode was enabled. It was due to a bug in Flash, but this change works around it.
Fixes #2546.

source/NVDAObjects/IAccessible/adobeFlash.py
user_docs/en/changes.t2t

index ba0e44d..159b029 100644 (file)
@@ -55,17 +55,35 @@ class Root(IAccessible):
        def _get_parent(self):\r
                return getNVDAObjectFromEvent(self.windowHandle,0,0)\r
 \r
+class PluginClientWithBrokenFocus(IAccessible):\r
+       """The client of a Flash plugin with broken focus behaviour.\r
+       #2546: In Flash protected mode, the Flash content is in another window beneath the plugin window.\r
+       Unfortunately, Flash doesn't bother to set focus to this window.\r
+       To work around this, when focus hits this object, focus is forced to the child.\r
+       """\r
+\r
+       def event_gainFocus(self):\r
+               try:\r
+                       self.firstChild.firstChild.setFocus()\r
+               except AttributeError:\r
+                       super(PluginClientWithBrokenFocus, self).event_gainFocus()\r
+\r
 def findExtraOverlayClasses(obj, clsList):\r
        """Determine the most appropriate class if this is a Flash object.\r
        This works similarly to L{NVDAObjects.NVDAObject.findOverlayClasses} except that it never calls any other findOverlayClasses method.\r
        """\r
+       iaRole = obj.IAccessibleRole\r
+       if obj.windowClassName == "GeckoPluginWindow" and iaRole == oleacc.ROLE_SYSTEM_CLIENT and obj.childCount == 1 and obj.firstChild.windowClassName == "GeckoFPSandboxChildWindow":\r
+               clsList.append(PluginClientWithBrokenFocus)\r
+               return\r
+\r
        try:\r
                servProv = obj.IAccessibleObject.QueryInterface(IServiceProvider)\r
        except COMError:\r
                return\r
 \r
        # Check whether this is the Flash root accessible.\r
-       if obj.IAccessibleRole == oleacc.ROLE_SYSTEM_CLIENT:\r
+       if iaRole == oleacc.ROLE_SYSTEM_CLIENT:\r
                try:\r
                        servProv.QueryService(IFlashAccessibility._iid_, IFlashAccessibility)\r
                        clsList.append(Root)\r
index 3c27583..d7b1c0b 100644 (file)
@@ -42,6 +42,7 @@
 - In Internet Explorer and other MSHTML controls, block quotes are now reported where appropriate. (#2888)\r
 - The HumanWare Brailliant BI/B series braille display driver can now be selected when the display is connected via Bluetooth but has never been connected via USB.\r
 - Filtering elements in the Browse Mode Elements list with uppercase filter text now returns case-insensitive results just like lowercase rather than nothing at all. (#2951)\r
+- In Mozilla browsers, browse mode can again be used when Flash content is focused. (#2546)\r
 \r
 \r
 == Changes for Developers ==\r