From 023067b7874c8f02c31106b2c8f6d6b5598a6cad Mon Sep 17 00:00:00 2001 From: James Teh Date: Fri, 15 Feb 2013 11:32:29 +1000 Subject: [PATCH] flash vbuf: __contains__: The Flash root object has two different object IDs, but Flash doesn't seem to know about the one on which IE fires focus events. Again, always trust IAccIdentity. Also, in getIdentifierFromNVDAObject (which __contains__ now uses), never use event parameters if they aren't valid. Fixes recreation of Flash buffers every time you move out and back into Flash content. --- source/virtualBuffers/adobeFlash.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/source/virtualBuffers/adobeFlash.py b/source/virtualBuffers/adobeFlash.py index ebb9f2344..435883733 100644 --- a/source/virtualBuffers/adobeFlash.py +++ b/source/virtualBuffers/adobeFlash.py @@ -39,14 +39,17 @@ class AdobeFlash(VirtualBuffer): def __contains__(self,obj): if self.isWindowless: - if obj.windowHandle != self.rootNVDAObject.windowHandle: + if not isinstance(obj, NVDAObjects.IAccessible.IAccessible): + return False + docHandle, ID = self.getIdentifierFromNVDAObject(obj) + if docHandle != self.rootDocHandle: return False try: - self.rootNVDAObject.IAccessibleObject.accChild(obj.event_objectID) + self.rootNVDAObject.IAccessibleObject.accChild(ID) return True except COMError: return False - return winUser.isDescendantWindow(self.rootNVDAObject.windowHandle, obj.windowHandle) + return winUser.isDescendantWindow(self.rootDocHandle, obj.windowHandle) def _get_isAlive(self): if self.isLoading: @@ -73,7 +76,12 @@ class AdobeFlash(VirtualBuffer): # Trust IAccIdentity over the event parameters. accId = info["objectID"] else: - accId = obj.event_objectID if obj.event_objectID > 0 else obj.event_childID + accId = obj.event_objectID + if accId is None: + # We don't have event parameters, so we can't get an ID. + raise LookupError + if accId <= 0: + accId = obj.event_childID return obj.windowHandle, accId def _searchableAttribsForNodeType(self,nodeType): -- 2.11.0