From: Michael Curran Date: Thu, 16 Jun 2011 04:24:42 +0000 (+1000) Subject: MSHTML NVDAObject: make the HTMLNodeName and HTMLNodeUniqueNumber properties be... X-Git-Tag: jpdev130418~1578 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=15ab77a3ad72654ee80c8e729ca71804ab96277f;p=nvdajp%2Fnvdajp.git 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. --- 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.