Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
ae097b6
Add config flag
LeonarddeR May 1, 2020
3b7bb3f
Use the config flag
LeonarddeR May 1, 2020
1724ead
Add experimental, very broken tree interceptor
LeonarddeR May 1, 2020
8600982
Add web module
LeonarddeR May 1, 2020
dcbe9be
Fix linting, for now
LeonarddeR May 1, 2020
b6aa782
Attempt to get a somewhat working experience
LeonarddeR May 1, 2020
75e7144
Please the linter
LeonarddeR May 1, 2020
83e65e7
Fix miscdeps
LeonarddeR May 2, 2020
57227de
Merge remote-tracking branch 'origin/master' into enforceIA2
LeonarddeR May 7, 2020
8501d00
Rewording and use of local helper binding handle
LeonarddeR May 7, 2020
4966f2b
Merge remote-tracking branch 'origin/master' into enforceIA2
LeonarddeR May 11, 2020
d923070
Merge remote-tracking branch 'origin/master' into enforceIA2
LeonarddeR Oct 2, 2020
7f81335
Merge branch 'enforceIA2' of github.com:leonardder/nvda into enforceIA2
LeonarddeR Oct 2, 2020
8c53dd6
Merge branch 'master' into enforceIA2
michaelDCurran Oct 26, 2020
e1d7166
Merge branch 'master' into enforceIA2
michaelDCurran Nov 3, 2020
b231132
UIATextInfo._getTextWithFieldsForUIARange: check each child to see if…
michaelDCurran Nov 3, 2020
8aad31d
speech.getObjectSpeech: If the given object should have its text pres…
michaelDCurran Nov 3, 2020
fa896fa
ChromiumUIA: as headings are exposed in the element tree, don't expos…
michaelDCurran Nov 4, 2020
61c73b4
UIATextInfo._getTextwithFieldsForUIARange: skip children that appear …
michaelDCurran Nov 4, 2020
636f581
UIA: make sure interactive / presentational lists are presented corre…
michaelDCurran Nov 5, 2020
b4a2863
embedded object characters in Edgium should not stop overriding label…
michaelDCurran Nov 5, 2020
af397b1
Fix linting issues
michaelDCurran Nov 5, 2020
58d2d9e
Merge branch 'master' into enforceIA2
michaelDCurran Nov 9, 2020
0234da2
Merge branch 'master' into enforceIA2
michaelDCurran Dec 14, 2020
a91d16f
Chromium with UIA: ignore layout tables when configured to do so.
michaelDCurran Dec 15, 2020
5da2437
Chromium with UIA: ensure the value of comboboxes are used as content…
michaelDCurran Dec 18, 2020
3a51721
Merge branch 'master' into enforceIA2
michaelDCurran Jan 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 50 additions & 13 deletions source/NVDAObjects/UIA/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,21 +647,41 @@ def _getTextWithFieldsForUIARange(self,rootElement,textRange,formatConfig,includ
if debug:
log.debug("NULL childRange. Skipping")
continue
clippedStart=clippedEnd=False
if index==lastChildIndex and childRange.CompareEndpoints(UIAHandler.TextPatternRangeEndpoint_Start,textRange,UIAHandler.TextPatternRangeEndpoint_End)>=0:
clippedStart = False
clippedEnd = False
if childRange.CompareEndpoints(
UIAHandler.TextPatternRangeEndpoint_End,
textRange,
UIAHandler.TextPatternRangeEndpoint_Start
) <= 0:
if debug:
log.debug("Child completely before textRange. Skipping")
continue
if childRange.CompareEndpoints(
UIAHandler.TextPatternRangeEndpoint_Start,
textRange,
UIAHandler.TextPatternRangeEndpoint_End
) >= 0:
if debug:
log.debug("Child at or past end of textRange. Breaking")
break
if index==lastChildIndex:
lastChildEndDelta=childRange.CompareEndpoints(UIAHandler.TextPatternRangeEndpoint_End,textRange,UIAHandler.TextPatternRangeEndpoint_End)
if lastChildEndDelta>0:
if debug:
log.debug(
"textRange ended part way through the child. "
"Crop end of childRange to fit"
)
childRange.MoveEndpointByRange(UIAHandler.TextPatternRangeEndpoint_End,textRange,UIAHandler.TextPatternRangeEndpoint_End)
clippedEnd=True
lastChildEndDelta = childRange.CompareEndpoints(
UIAHandler.TextPatternRangeEndpoint_End,
textRange,
UIAHandler.TextPatternRangeEndpoint_End
)
if lastChildEndDelta > 0:
if debug:
log.debug(
"textRange ended part way through the child. "
"Crop end of childRange to fit"
)
childRange.MoveEndpointByRange(
UIAHandler.TextPatternRangeEndpoint_End,
textRange,
UIAHandler.TextPatternRangeEndpoint_End
)
clippedEnd = True
childStartDelta=childRange.CompareEndpoints(UIAHandler.TextPatternRangeEndpoint_Start,tempRange,UIAHandler.TextPatternRangeEndpoint_End)
if childStartDelta>0:
# plain text before this child
Expand Down Expand Up @@ -893,7 +913,24 @@ def findOverlayClasses(self,clsList):
clsList.append(edge.EdgeList)
else:
clsList.append(edge.EdgeNode)
elif self.role == controlTypes.ROLE_DOCUMENT and UIAAutomationId == "Microsoft.Windows.PDF.DocumentView":
elif self.windowClassName == "Chrome_RenderWidgetHostHWND":
from . import chromium
from . import web
if (
self.UIATextPattern
and self.role == controlTypes.ROLE_DOCUMENT
and self.parent
and self.parent.role == controlTypes.ROLE_PANE
):
clsList.append(chromium.ChromiumUIADocument)
else:
if self.role == controlTypes.ROLE_LIST:
clsList.append(web.List)
clsList.append(chromium.ChromiumUIA)
elif (
self.role == controlTypes.ROLE_DOCUMENT
and self.UIAElement.cachedAutomationId == "Microsoft.Windows.PDF.DocumentView"
):
# PDFs
from . import edge
clsList.append(edge.EdgeHTMLRoot)
Expand Down
62 changes: 62 additions & 0 deletions source/NVDAObjects/UIA/chromium.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# A part of NonVisual Desktop Access (NVDA)
# This file is covered by the GNU General Public License.
# See the file COPYING for more details.
# Copyright (C) 2020 NV Access limited, Leonard de Ruijter

import UIAHandler
from . import web
import controlTypes


class ChromiumUIATextInfo(web.UIAWebTextInfo):

def _getFormatFieldAtRange(self, textRange, formatConfig, ignoreMixedValues=False):
formatField = super()._getFormatFieldAtRange(textRange, formatConfig, ignoreMixedValues=ignoreMixedValues)
# Headings are also exposed in the element tree,
# And therefore exposing in a formatField is redundant and causes duplicate reporting.
# So remove heading-level from the formatField if it exists.
try:
del formatField.field['heading-level']
except KeyError:
pass
return formatField

def _getControlFieldForObject(self, obj, isEmbedded=False, startOfNode=False, endOfNode=False):
field = super()._getControlFieldForObject(
obj,
isEmbedded=isEmbedded,
startOfNode=startOfNode,
endOfNode=endOfNode
)
# use the value of comboboxes as content.
if obj.role == controlTypes.ROLE_COMBOBOX:
field['content'] = obj.value
# Layout tables do not have the UIA table pattern
if field['role'] == controlTypes.ROLE_TABLE:
if not obj._getUIACacheablePropertyValue(UIAHandler.UIA_IsTablePatternAvailablePropertyId):
field['table-layout'] = True
# Currently no way to tell if author has explicitly set name.
# Therefore always report the name if the control is not of a type that
# by definition uses its name for content.
# this may cause some duplicate speaking,
# But that is currently better than nothing at all.
if not field.get('nameIsContent') and field.get('name'):
field['alwaysReportName'] = True
return field


class ChromiumUIA(web.UIAWeb):
_TextInfo = ChromiumUIATextInfo


class ChromiumUIATreeInterceptor(web.UIAWebTreeInterceptor):

def _get_documentConstantIdentifier(self):
return self.rootNVDAObject.parent._getUIACacheablePropertyValue(UIAHandler.UIA_AutomationIdPropertyId)


class ChromiumUIADocument(ChromiumUIA):
treeInterceptorClass = ChromiumUIATreeInterceptor

def _get_shouldCreateTreeInterceptor(self):
return self.role == controlTypes.ROLE_DOCUMENT
Loading