From 15ab77a3ad72654ee80c8e729ca71804ab96277f Mon Sep 17 00:00:00 2001 From: Michael Curran Date: Thu, 16 Jun 2011 14:24:42 +1000 Subject: [PATCH] MSHTML NVDAObject: make the HTMLNodeName and HTMLNodeUniqueNumber properties be cached for the lifetime of the object, not just the current core cycle. also replace one last missed use of self.HTMLNode.nodeName with self.HTMLNodeName. These changes do provide a small speed improvement for MSHTML. --- source/NVDAObjects/IAccessible/MSHTML.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/source/NVDAObjects/IAccessible/MSHTML.py b/source/NVDAObjects/IAccessible/MSHTML.py index d120fc36a..8522c0403 100644 --- a/source/NVDAObjects/IAccessible/MSHTML.py +++ b/source/NVDAObjects/IAccessible/MSHTML.py @@ -337,11 +337,8 @@ class MSHTML(IAccessible): clsList.append(EditableTextWithoutAutoSelectDetection) #fix for #974 #this fails on some control in vs2008 new project wizard - try: - nodeName = self.HTMLNode.nodeName - except COMError: - pass - else: + nodeName = self.HTMLNodeName + if nodeName: if nodeNamesToNVDARoles.get(nodeName) == controlTypes.ROLE_DOCUMENT: clsList.append(Body) elif nodeName == "OBJECT": @@ -716,13 +713,17 @@ class MSHTML(IAccessible): raise NotImplementedError def _get_HTMLNodeUniqueNumber(self): - return self.HTMLNode.uniqueNumber + if not hasattr(self,'_HTMLNodeUniqueNumber'): + self._HTMLNodeUniqueNumber=self.HTMLNode.uniqueNumber + return self._HTMLNodeUniqueNumber def _get_HTMLNodeName(self): - try: - return self.HTMLNode.nodeName - except (COMError,NameError): - return "" + if not hasattr(self,'_HTMLNodeName'): + try: + self._HTMLNodeName=self.HTMLNode.nodeName + except (COMError,NameError): + return "" + return self._HTMLNodeName class V6ComboBox(IAccessible): """The object which receives value change events for combo boxes in MSHTML/IE 6. -- 2.11.0