Skip to content

Commit 5687503

Browse files
authored
Merge 623dfe9 into 78fa572
2 parents 78fa572 + 623dfe9 commit 5687503

File tree

8 files changed

+70
-10
lines changed

8 files changed

+70
-10
lines changed

source/IAccessibleHandler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import UIAHandler
1818
from comInterfaces.Accessibility import *
1919
from comInterfaces.IAccessible2Lib import *
20+
from comInterfaces import IAccessible2Lib as IA2
2021
from logHandler import log
2122
import JABHandler
2223
import eventHandler
@@ -257,6 +258,7 @@ def flushEvents(self):
257258
IA2_ROLE_CONTENT_DELETION:controlTypes.ROLE_DELETED_CONTENT,
258259
IA2_ROLE_CONTENT_INSERTION:controlTypes.ROLE_INSERTED_CONTENT,
259260
IA2_ROLE_BLOCK_QUOTE:controlTypes.ROLE_BLOCKQUOTE,
261+
IA2.IA2_ROLE_LANDMARK: controlTypes.ROLE_LANDMARK,
260262
#some common string roles
261263
"frame":controlTypes.ROLE_FRAME,
262264
"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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,9 @@ def _get_roleText(self):
409409
"""
410410
return None
411411

412+
def _get_roleTextBraille(self):
413+
return self.roleText
414+
412415
def _get_value(self):
413416
"""The value of this object (example: the current percentage of a scrollbar, the selected option in a combo box).
414417
@rtype: str
@@ -724,6 +727,8 @@ def _get_presentationType(self):
724727
if not name and not description:
725728
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):
726729
return self.presType_layout
730+
if role == controlTypes.ROLE_LANDMARK and not config.conf["documentFormatting"]["reportLandmarks"]:
731+
return self.presType_layout
727732
if role == controlTypes.ROLE_TABLE and not config.conf["documentFormatting"]["reportTables"]:
728733
return self.presType_layout
729734
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/braille.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ def getBrailleTextForProperties(**propertyValues):
473473
if name:
474474
textList.append(name)
475475
role = propertyValues.get("role")
476-
roleText = propertyValues.get("roleText")
476+
roleText=propertyValues.get('roleText')
477477
states = propertyValues.get("states")
478478
positionInfo = propertyValues.get("positionInfo")
479479
level = positionInfo.get("level") if positionInfo else None
@@ -596,7 +596,7 @@ def update(self):
596596
text = getBrailleTextForProperties(
597597
name=obj.name,
598598
role=role,
599-
roleText=obj.roleText,
599+
roleText=obj.roleTextBraille,
600600
current=obj.isCurrent,
601601
placeholder=placeholderValue,
602602
value=obj.value if not NVDAObjectHasUsefulText(obj) else None ,
@@ -643,8 +643,9 @@ def getControlFieldBraille(info, field, ancestors, reportStart, formatConfig):
643643
value=field.get('value',None)
644644
current=field.get('current', None)
645645
placeholder=field.get('placeholder', None)
646-
roleText=field.get('roleText')
647-
646+
roleText=field.get('roleTextBraille')
647+
if not roleText:
648+
roleText=field.get('roleText')
648649
if presCat == field.PRESCAT_LAYOUT:
649650
text = []
650651
if current:

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)