Skip to content

Commit 43028ba

Browse files
authored
Merge 5a207a9 into a8e8db1
2 parents a8e8db1 + 5a207a9 commit 43028ba

File tree

7 files changed

+61
-6
lines changed

7 files changed

+61
-6
lines changed

source/IAccessibleHandler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ def flushEvents(self):
255255
IA2_ROLE_CONTENT_DELETION:controlTypes.ROLE_DELETED_CONTENT,
256256
IA2_ROLE_CONTENT_INSERTION:controlTypes.ROLE_INSERTED_CONTENT,
257257
IA2_ROLE_BLOCK_QUOTE:controlTypes.ROLE_BLOCKQUOTE,
258+
IA2_ROLE_LANDMARK: controlTypes.ROLE_LANDMARK,
258259
#some common string roles
259260
"frame":controlTypes.ROLE_FRAME,
260261
"iframe":controlTypes.ROLE_INTERNALFRAME,

source/NVDAObjects/IAccessible/ia2Web.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ def _get_states(self):
6565
states.discard(controlTypes.STATE_EDITABLE)
6666
return states
6767

68+
def _get_landmark(self):
69+
if self.IAccessibleRole != IAccessibleHandler.IA2_ROLE_LANDMARK:
70+
return super().landmark
71+
return self.IA2Attributes.get('xml-roles', '').split(' ')[0]
72+
6873
class Document(Ia2Web):
6974
value = None
7075

source/NVDAObjects/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,8 @@ def _get_presentationType(self):
724724
if not name and not description:
725725
if role in (controlTypes.ROLE_WINDOW,controlTypes.ROLE_PANEL, controlTypes.ROLE_PROPERTYPAGE, controlTypes.ROLE_TEXTFRAME, controlTypes.ROLE_GROUPING,controlTypes.ROLE_OPTIONPANE,controlTypes.ROLE_INTERNALFRAME,controlTypes.ROLE_FORM,controlTypes.ROLE_TABLEBODY):
726726
return self.presType_layout
727+
if role == controlTypes.ROLE_LANDMARK and not config.conf["documentFormatting"]["reportLandmarks"]:
728+
return self.presType_layout
727729
if role == controlTypes.ROLE_TABLE and not config.conf["documentFormatting"]["reportTables"]:
728730
return self.presType_layout
729731
if role in (controlTypes.ROLE_TABLEROW,controlTypes.ROLE_TABLECOLUMN,controlTypes.ROLE_TABLECELL) and (not config.conf["documentFormatting"]["reportTables"] or not config.conf["documentFormatting"]["reportTableCellCoords"]):

source/controlTypes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@
152152
ROLE_CHARTELEMENT=146
153153
ROLE_DELETED_CONTENT=147
154154
ROLE_INSERTED_CONTENT=148
155+
ROLE_LANDMARK = 149
155156

156157
STATE_UNAVAILABLE=0X1
157158
STATE_FOCUSED=0X2
@@ -492,6 +493,8 @@
492493
ROLE_DELETED_CONTENT:_("deleted"),
493494
# Translators: Identifies inserted content.
494495
ROLE_INSERTED_CONTENT:_("inserted"),
496+
# Translators: Identifies a landmark.
497+
ROLE_LANDMARK: _("landmark"),
495498
}
496499

497500
stateLabels={

source/speech/__init__.py

Lines changed: 35 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from logHandler import log
2020
import api
2121
import controlTypes
22+
import aria
2223
import config
2324
import tones
2425
import synthDriverHandler
@@ -344,7 +345,29 @@ def speakObject(obj, reason=controlTypes.REASON_QUERY, _prefixSpeechCommand=None
344345
# objects that do not report as having navigableText should not report their text content either
345346
not obj._hasNavigableText
346347
)
347-
allowProperties={'name':True,'role':True,'roleText':True,'states':True,'value':True,'description':True,'keyboardShortcut':True,'positionInfo_level':True,'positionInfo_indexInGroup':True,'positionInfo_similarItemsInGroup':True,"cellCoordsText":True,"rowNumber":True,"columnNumber":True,"includeTableCellCoords":True,"columnCount":True,"rowCount":True,"rowHeaderText":True,"columnHeaderText":True,"rowSpan":True,"columnSpan":True}
348+
allowProperties = {
349+
'name': True,
350+
'role': True,
351+
'roleText': True,
352+
'states': True,
353+
'value': True,
354+
'description': True,
355+
'landmark': True,
356+
'keyboardShortcut': True,
357+
'positionInfo_level': True,
358+
'positionInfo_indexInGroup': True,
359+
'positionInfo_similarItemsInGroup': True,
360+
"cellCoordsText": True,
361+
"rowNumber": True,
362+
"columnNumber": True,
363+
"includeTableCellCoords": True,
364+
"columnCount": True,
365+
"rowCount": True,
366+
"rowHeaderText": True,
367+
"columnHeaderText": True,
368+
"rowSpan": True,
369+
"columnSpan": True
370+
}
348371

349372
if reason==controlTypes.REASON_FOCUSENTERED:
350373
allowProperties["value"]=False
@@ -372,8 +395,10 @@ def speakObject(obj, reason=controlTypes.REASON_QUERY, _prefixSpeechCommand=None
372395
if not formatConf["reportTableHeaders"]:
373396
allowProperties["rowHeaderText"]=False
374397
allowProperties["columnHeaderText"]=False
375-
if (not formatConf["reportTables"]
376-
or (not formatConf["reportTableCellCoords"] and not formatConf["reportTableHeaders"])):
398+
if (
399+
not formatConf["reportTables"]
400+
or (not formatConf["reportTableCellCoords"] and not formatConf["reportTableHeaders"])
401+
):
377402
# We definitely aren't reporting any table info at all.
378403
allowProperties["rowNumber"]=False
379404
allowProperties["columnNumber"]=False
@@ -1062,13 +1087,19 @@ def getSpeechTextForProperties(reason=controlTypes.REASON_QUERY,**propertyValues
10621087
else:
10631088
speakRole=False
10641089
role=controlTypes.ROLE_UNKNOWN
1090+
landmark = propertyValues.get('landmark') if role == controlTypes.ROLE_LANDMARK else None
10651091
value=propertyValues.get('value') if role not in controlTypes.silentValuesForRoles else None
10661092
cellCoordsText=propertyValues.get('cellCoordsText')
10671093
rowNumber=propertyValues.get('rowNumber')
10681094
columnNumber=propertyValues.get('columnNumber')
10691095
includeTableCellCoords=propertyValues.get('includeTableCellCoords',True)
1070-
if role==controlTypes.ROLE_CHARTELEMENT:
1096+
if (
1097+
role == controlTypes.ROLE_CHARTELEMENT
1098+
or (role == controlTypes.ROLE_LANDMARK and landmark == "region")
1099+
):
10711100
speakRole=False
1101+
if landmark and landmark in aria.landmarkRoles:
1102+
textList.append(aria.landmarkRoles[landmark])
10721103
roleText=propertyValues.get('roleText')
10731104
if speakRole and (roleText or reason not in (controlTypes.REASON_SAYALL,controlTypes.REASON_CARET,controlTypes.REASON_FOCUS) or not (name or value or cellCoordsText or rowNumber or columnNumber) or role not in controlTypes.silentRolesOnFocus) and (role!=controlTypes.ROLE_MATH or reason not in (controlTypes.REASON_CARET,controlTypes.REASON_SAYALL)):
10741105
textList.append(roleText if roleText else controlTypes.roleLabels[role])

source/textInfos/__init__.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,7 @@ def getPresentationCategory(self, ancestors, formatConfig, reason=controlTypes.R
7171
or (role in (controlTypes.ROLE_LIST, controlTypes.ROLE_LISTITEM) and controlTypes.STATE_READONLY in states and not formatConfig["reportLists"])
7272
or (role in (controlTypes.ROLE_FRAME, controlTypes.ROLE_INTERNALFRAME) and not formatConfig["reportFrames"])
7373
or (role in (controlTypes.ROLE_DELETED_CONTENT,controlTypes.ROLE_INSERTED_CONTENT) and not formatConfig["reportRevisions"])
74+
or role == controlTypes.ROLE_LANDMARK # Presentation handled by BrowseModeDocumentTextInfo
7475
):
7576
# This is just layout as far as the user is concerned.
7677
return self.PRESCAT_LAYOUT
@@ -110,8 +111,19 @@ def getPresentationCategory(self, ancestors, formatConfig, reason=controlTypes.R
110111
elif role in (controlTypes.ROLE_TABLECELL, controlTypes.ROLE_TABLECOLUMNHEADER, controlTypes.ROLE_TABLEROWHEADER):
111112
return self.PRESCAT_CELL
112113
elif (
113-
role in (controlTypes.ROLE_BLOCKQUOTE, controlTypes.ROLE_FRAME, controlTypes.ROLE_INTERNALFRAME, controlTypes.ROLE_TOOLBAR, controlTypes.ROLE_MENUBAR, controlTypes.ROLE_POPUPMENU, controlTypes.ROLE_TABLE)
114-
or (role == controlTypes.ROLE_EDITABLETEXT and (controlTypes.STATE_READONLY not in states or controlTypes.STATE_FOCUSABLE in states) and controlTypes.STATE_MULTILINE in states)
114+
role in (
115+
controlTypes.ROLE_BLOCKQUOTE,
116+
controlTypes.ROLE_FRAME,
117+
controlTypes.ROLE_INTERNALFRAME,
118+
controlTypes.ROLE_TOOLBAR,
119+
controlTypes.ROLE_MENUBAR,
120+
controlTypes.ROLE_POPUPMENU,
121+
controlTypes.ROLE_TABLE,
122+
)
123+
or (role == controlTypes.ROLE_EDITABLETEXT and (
124+
controlTypes.STATE_READONLY not in states
125+
or controlTypes.STATE_FOCUSABLE in states
126+
) and controlTypes.STATE_MULTILINE in states)
115127
or (role == controlTypes.ROLE_LIST and controlTypes.STATE_READONLY in states)
116128
or (controlTypes.STATE_FOCUSABLE in states and controlTypes.STATE_EDITABLE in states)
117129
):

source/virtualBuffers/gecko_ia2.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ def _searchableAttribsForNodeType(self,nodeType):
284284
attrs={"IAccessible::state_%s"%oleacc.STATE_SYSTEM_FOCUSABLE:[1]}
285285
elif nodeType=="landmark":
286286
attrs = [
287+
{"IAccessible::role": [IAccessibleHandler.IA2_ROLE_LANDMARK]},
287288
{"IAccessible2::attribute_xml-roles": [VBufStorage_findMatch_word(lr) for lr in aria.landmarkRoles if lr != "region"]},
288289
{"IAccessible2::attribute_xml-roles": [VBufStorage_findMatch_word("region")],
289290
"name": [VBufStorage_findMatch_notEmpty]}

0 commit comments

Comments
 (0)