From 02b2b6d7b4d4de4354683c7b60785fbe5818c0d7 Mon Sep 17 00:00:00 2001 From: Leonard de Ruijter Date: Fri, 5 Jul 2019 21:38:14 +0200 Subject: [PATCH 1/6] Fix adobe reader int to NoneType comparison as well as other identified cases --- source/NVDAObjects/IAccessible/MSHTML.py | 2 +- source/NVDAObjects/IAccessible/adobeAcrobat.py | 4 ++-- source/virtualBuffers/adobeFlash.py | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/source/NVDAObjects/IAccessible/MSHTML.py b/source/NVDAObjects/IAccessible/MSHTML.py index 634a2d7bf46..a2cb7b443a5 100644 --- a/source/NVDAObjects/IAccessible/MSHTML.py +++ b/source/NVDAObjects/IAccessible/MSHTML.py @@ -1139,7 +1139,7 @@ def findExtraIAccessibleOverlayClasses(obj, clsList): clsList.append(MSAATextLeaf) return - if iaRole == oleacc.ROLE_SYSTEM_WINDOW and obj.event_objectID > 0: + if iaRole == oleacc.ROLE_SYSTEM_WINDOW and obj.event_objectID is not None and obj.event_objectID > 0: clsList.append(PluginWindow) elif iaRole == oleacc.ROLE_SYSTEM_CLIENT and obj.event_objectID == winUser.OBJID_CLIENT: clsList.append(RootClient) diff --git a/source/NVDAObjects/IAccessible/adobeAcrobat.py b/source/NVDAObjects/IAccessible/adobeAcrobat.py index a1563daff82..28b50bf280e 100644 --- a/source/NVDAObjects/IAccessible/adobeAcrobat.py +++ b/source/NVDAObjects/IAccessible/adobeAcrobat.py @@ -58,9 +58,9 @@ def initOverlayClass(self): log.debugWarning("Could not get IServiceProvider") return - if self.event_objectID > 0: + if self.event_objectID is not None and self.event_objectID > 0: self.accID = self.event_objectID - elif self.event_childID > 0: + elif self.event_childID is not None and self.event_childID > 0: self.accID = self.event_childID else: try: diff --git a/source/virtualBuffers/adobeFlash.py b/source/virtualBuffers/adobeFlash.py index a7f6c58bac4..91ec5b68a48 100644 --- a/source/virtualBuffers/adobeFlash.py +++ b/source/virtualBuffers/adobeFlash.py @@ -36,7 +36,7 @@ class AdobeFlash(VirtualBuffer): def __init__(self,rootNVDAObject): super(AdobeFlash,self).__init__(rootNVDAObject,backendName="adobeFlash") - self.isWindowless = rootNVDAObject.event_objectID > 0 + self.isWindowless = rootNVDAObject.event_objectID is not None and rootNVDAObject.event_objectID > 0 def __contains__(self,obj): if self.isWindowless: From ef432b8c13985a3c16575020c50adc02e261162b Mon Sep 17 00:00:00 2001 From: Leonard de Ruijter Date: Sat, 6 Jul 2019 09:30:32 +0200 Subject: [PATCH 2/6] Fix problem for Acrobat in normalizeStdName --- source/NVDAObjects/IAccessible/adobeAcrobat.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/NVDAObjects/IAccessible/adobeAcrobat.py b/source/NVDAObjects/IAccessible/adobeAcrobat.py index 28b50bf280e..6c48cb46569 100644 --- a/source/NVDAObjects/IAccessible/adobeAcrobat.py +++ b/source/NVDAObjects/IAccessible/adobeAcrobat.py @@ -82,10 +82,12 @@ def initOverlayClass(self): pass def _get_role(self): - try: - return normalizeStdName(self.pdDomNode.GetStdName())[0] - except (AttributeError, LookupError, COMError): - pass + stdName = self.pdDomNode.GetStdName() + if stdName is not None: + try: + return normalizeStdName(stdName)[0] + except (AttributeError, LookupError, COMError): + pass role = super(AcrobatNode, self).role if role == controlTypes.ROLE_PANE: From 5e4796d10891d86bccb65f774fbd7dd7d740a424 Mon Sep 17 00:00:00 2001 From: Leonard de Ruijter Date: Sat, 6 Jul 2019 12:39:12 +0200 Subject: [PATCH 3/6] Another attempt to fix Adobe --- source/NVDAObjects/IAccessible/adobeAcrobat.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/source/NVDAObjects/IAccessible/adobeAcrobat.py b/source/NVDAObjects/IAccessible/adobeAcrobat.py index 6c48cb46569..cceb38ee7e7 100644 --- a/source/NVDAObjects/IAccessible/adobeAcrobat.py +++ b/source/NVDAObjects/IAccessible/adobeAcrobat.py @@ -82,12 +82,10 @@ def initOverlayClass(self): pass def _get_role(self): - stdName = self.pdDomNode.GetStdName() - if stdName is not None: - try: - return normalizeStdName(stdName)[0] - except (AttributeError, LookupError, COMError): - pass + try: + return normalizeStdName(self.pdDomNode.GetStdName())[0] + except (AttributeError, LookupError, COMError, TypeError): + pass role = super(AcrobatNode, self).role if role == controlTypes.ROLE_PANE: From c9d1c1593d894ef25827f8e1416f050832c46aa7 Mon Sep 17 00:00:00 2001 From: Leonard de Ruijter Date: Tue, 9 Jul 2019 13:15:20 +0200 Subject: [PATCH 4/6] Log debugWarning for role fetching errors --- source/NVDAObjects/IAccessible/adobeAcrobat.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/NVDAObjects/IAccessible/adobeAcrobat.py b/source/NVDAObjects/IAccessible/adobeAcrobat.py index cceb38ee7e7..9ccd160a771 100644 --- a/source/NVDAObjects/IAccessible/adobeAcrobat.py +++ b/source/NVDAObjects/IAccessible/adobeAcrobat.py @@ -85,7 +85,7 @@ def _get_role(self): try: return normalizeStdName(self.pdDomNode.GetStdName())[0] except (AttributeError, LookupError, COMError, TypeError): - pass + log.debugWarning("Could not get role for AcrobatNode using normalizeStdName", exc_info=True) role = super(AcrobatNode, self).role if role == controlTypes.ROLE_PANE: From 83aa51ad06ffd3dfe488c31dafc9c2fdc3d45839 Mon Sep 17 00:00:00 2001 From: Leonard de Ruijter Date: Tue, 9 Jul 2019 14:30:45 +0200 Subject: [PATCH 5/6] Avoid raising TypeError --- source/NVDAObjects/IAccessible/adobeAcrobat.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/NVDAObjects/IAccessible/adobeAcrobat.py b/source/NVDAObjects/IAccessible/adobeAcrobat.py index 9ccd160a771..15acf0eefaa 100644 --- a/source/NVDAObjects/IAccessible/adobeAcrobat.py +++ b/source/NVDAObjects/IAccessible/adobeAcrobat.py @@ -39,7 +39,7 @@ } def normalizeStdName(stdName): - if "H1" <= stdName <= "H6": + if stdName and "H1" <= stdName <= "H6": return controlTypes.ROLE_HEADING, stdName[1] try: @@ -84,8 +84,8 @@ def initOverlayClass(self): def _get_role(self): try: return normalizeStdName(self.pdDomNode.GetStdName())[0] - except (AttributeError, LookupError, COMError, TypeError): - log.debugWarning("Could not get role for AcrobatNode using normalizeStdName", exc_info=True) + except (AttributeError, LookupError, COMError): + pass role = super(AcrobatNode, self).role if role == controlTypes.ROLE_PANE: From 0c944a409c189e931ff47550491ea6fa67139d8d Mon Sep 17 00:00:00 2001 From: Leonard de Ruijter Date: Wed, 10 Jul 2019 11:00:37 +0200 Subject: [PATCH 6/6] Fix rowspan en columnspan in braille. Fix from #9794 --- source/braille.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/braille.py b/source/braille.py index c43de84de51..76344b437c5 100644 --- a/source/braille.py +++ b/source/braille.py @@ -480,8 +480,11 @@ def getBrailleTextForProperties(**propertyValues): cellCoordsText=propertyValues.get('cellCoordsText') rowNumber = propertyValues.get("rowNumber") columnNumber = propertyValues.get("columnNumber") - rowSpan = propertyValues.get("rowSpan") - columnSpan = propertyValues.get("columnSpan") + # When fetching row and column span + # default the values to 1 to make further checks a lot simpler. + # After all, a table cell that has no rowspan implemented is assumed to span one row. + rowSpan = propertyValues.get("rowSpan") or 1 + columnSpan = propertyValues.get("columnSpan") or 1 includeTableCellCoords = propertyValues.get("includeTableCellCoords", True) if role is not None and not roleText: if role == controlTypes.ROLE_HEADING and level: