Skip to content

Commit

Permalink
UIA NVDAObject: implement a presentationType property which only allo…
Browse files Browse the repository at this point in the history
…ws PresType_content if the IUAElement itself is both a control element and content element. (#7019)
  • Loading branch information
michaelDCurran committed Apr 12, 2017
1 parent 8f5336f commit 3c6696c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions source/NVDAObjects/UIA/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -871,6 +871,13 @@ def _get_states(self):
states.add(controlTypes.STATE_CHECKED)
return states

def _get_presentationType(self):
presentationType=super(UIA,self).presentationType
# UIA NVDAObjects can only be considered content if UI Automation considers them both a control and content.
if presentationType==self.presType_content and not (self.UIAElement.cachedIsContentElement and self.UIAElement.cachedIsControlElement):
presentationType=self.presType_layout
return presentationType

def correctAPIForRelation(self, obj, relation=None):
if obj and self.windowHandle != obj.windowHandle and not obj.UIAElement.cachedNativeWindowHandle:
# The target element is not the root element for the window, so don't change API class; i.e. always use UIA.
Expand Down
2 changes: 1 addition & 1 deletion source/_UIAHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ def MTAThreadFunc(self):
import UIAHandler
self.ItemIndex_PropertyId=NVDAHelper.localLib.registerUIAProperty(byref(ItemIndex_Property_GUID),u"ItemIndex",1)
self.ItemCount_PropertyId=NVDAHelper.localLib.registerUIAProperty(byref(ItemCount_Property_GUID),u"ItemCount",1)
for propertyId in (UIA_FrameworkIdPropertyId,UIA_AutomationIdPropertyId,UIA_ClassNamePropertyId,UIA_ControlTypePropertyId,UIA_ProviderDescriptionPropertyId,UIA_ProcessIdPropertyId,UIA_IsTextPatternAvailablePropertyId):
for propertyId in (UIA_FrameworkIdPropertyId,UIA_AutomationIdPropertyId,UIA_ClassNamePropertyId,UIA_ControlTypePropertyId,UIA_ProviderDescriptionPropertyId,UIA_ProcessIdPropertyId,UIA_IsTextPatternAvailablePropertyId,UIA_IsContentElementPropertyId,UIA_IsControlElementPropertyId):
self.baseCacheRequest.addProperty(propertyId)
self.baseCacheRequest.addPattern(UIA_TextPatternId)
self.rootElement=self.clientObject.getRootElementBuildCache(self.baseCacheRequest)
Expand Down

0 comments on commit 3c6696c

Please sign in to comment.