New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Initial support for Windows 10 anniversary versions of both Microsoft Edge and Windows 10 Mail. #6271
Merged
Merged
Initial support for Windows 10 anniversary versions of both Microsoft Edge and Windows 10 Mail. #6271
Changes from 56 commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
1b34c7a
Rewrite UIATextAttributeQuickNavIterator to allow previous heading qu…
michaelDCurran f0abdef
Re-implement rich text support for Edge, compatible with RS1.
michaelDCurran 04fb955
Add missing import
michaelDCurran cf6b01d
EdgeTextInfo: ensure getTextWithFields never returns controlFields fo…
michaelDCurran 5721dad
Edge: report landmarks
michaelDCurran 2f0b581
EdgeTextInfo.getTextWithFields: chop redundant fields and text off th…
michaelDCurran 9e94f47
Edge now correctly sets focus on its root container and or document, …
michaelDCurran 72df067
Edge: fall back to name, value or description for embedded controls w…
michaelDCurran 0b8dddc
UIATextInfo: implement support for more formatting (color, alignment,…
michaelDCurran d686581
Edge: Ensure previous heading quicknav does not skip over same-level …
michaelDCurran 4f949c1
UIATextInfo._getControlFieldForObject: ensure controlFields stay uniq…
michaelDCurran eb984c7
Edge: Remove any whitespace directly after the end of an element as i…
michaelDCurran e5c1d27
Edge: _getTextWithFields_balanced and _getTextWithFields_unbalanced d…
michaelDCurran b7b8731
Edge: focusing a selectable list item (E.g. an auto suggestion) shoul…
michaelDCurran 32bc550
Edge: Ensure a control's name is announced, (but not twice) with mov…
michaelDCurran 2ac85de
UIA NVDAObject: Make use of UIA fullDescription in the description pr…
michaelDCurran 0c8b95e
UIA NVDAObject's description property: only use fullDescription if it…
michaelDCurran 9fe00d4
Edge: use localizedLandmarkType instead of localizedControlType when …
michaelDCurran a902070
Edge: expose the clickable state on text, groupings, sections and gra…
michaelDCurran 14fb00f
Edge: _getTextWithFields_balanced: specifically handle detection of a…
michaelDCurran 7039ab7
Edge: make use of some existing base code when walking formatted text.
michaelDCurran 4e00155
Edge: integrate the main code from _getTextWithFields_balanced in to …
michaelDCurran 9ecc0ec
Edge heading quicknav: re-implement using move by paragraph and getAt…
michaelDCurran 1b30b65
speech.getFormatFieldSpeech: If the user has chosen to report heading…
michaelDCurran efe112f
Edge browseMode: allow aria-label / aria-labelledby to override conte…
michaelDCurran b98d4e7
Edge: detect iframes and give them an appropriate role.
michaelDCurran ad80630
Edge: work around MS Edge bug where expanding to character on an a co…
michaelDCurran 924bf33
Edge browseMode: report number of items in lists such as in other bro…
michaelDCurran f871c63
Edge browseMode: rough implementation of quicknav/listing landmarks.
michaelDCurran b778343
Edge: provide _startOfNode and _endOfNode attributes on controlFields…
michaelDCurran f7a29a3
EdgeTextInfo: override move and expand to skip over element start pos…
michaelDCurran 4c1e1d3
Edge: expose overridden content always via value, with a single space…
michaelDCurran ce57ef8
Edge: only expose heading levels in initial formatFields. Braille: su…
michaelDCurran 4c76ce4
EdgeTextInfo.expand: don't try fixing up expanding of line and paragr…
michaelDCurran addb9f9
UIATextInfo: move spelling detection into getFormatfieldAtRange.
michaelDCurran ef752fb
UIATextInfo: abstract a lot of Edge code, replacing the old UIATextIn…
michaelDCurran aa22a01
Abstract more Edge code into the base UIA support, including a base U…
michaelDCurran ba471bb
UIA: don't raise an exception on mixed text attribute values if there…
michaelDCurran b6eebea
UIA: Initial support for Win10 Mail browseMode (UIA MS Word support).…
michaelDCurran ac83d7d
Edge: don't expose clickables if they are descendants of clickables.
michaelDCurran 854c072
Add an appModule for Win10 Mail (hxmail) and provide browseMode autom…
michaelDCurran f1b1bff
Add missing imports
michaelDCurran d789aab
EdgeTextInfo.expand: only do special expanding for embedded children …
michaelDCurran 8f88584
UIABrowseMode: don't use ReviewCursorManager as Mail does not need it…
michaelDCurran dd90809
Report position in a document when pressing tab or shift+tab.
michaelDCurran 16b1097
UIAUtils: add more doc strings.
michaelDCurran e51cc5c
Win10 Mail: stop reporting 'edit' for each line of documents.
michaelDCurran 30721d1
Improve performance of navigating in Edge browse Mode by about 20%.
michaelDCurran 35754e6
Remove the need for overriding focusableNVDAObjectAtStart on the Edg…
michaelDCurran 149c44a
UIATextInfo._getTextWithFieldsForUIARange: remove redundant check.
michaelDCurran d99d455
Review actions for #6271
michaelDCurran adcef1c
Edge: Report editable combo boxes as editable and allow them to be fo…
michaelDCurran b64d85a
Untested idea as to how to handle content overriding in controlFields.
jcsteh 87a4c4e
Edge: Where content is replaced via aria-label etc, ensure that conte…
michaelDCurran 1c4d6de
Braille: no longer support alwaysReportValue as it is not needed.
michaelDCurran cdcb25f
Address comments in #6271
michaelDCurran 94fbd8e
EdgeTextInfo.expand: remove code that tries to exclude content from t…
michaelDCurran 92f27b1
Edge NVDAObject: catch a case where a text range could be NULL.
michaelDCurran 6afc061
UIATextInfo._getTextWithFieldsForUIARange: handle where IUIAutomation…
michaelDCurran 49779ee
NVDAObjects.UIA: allow module load where UIA is unavailable (E.g. XP).
michaelDCurran 4982945
Handle broken WPF UIA text pattern (E.g. 1Password):
michaelDCurran 2b50f3a
Address review actions for #6271
michaelDCurran 2316b08
Ignore COMError in IE 11 on Windows 7 during UIA text fetching.
michaelDCurran File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,126 @@ | ||
#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) 2016 NV Access Limited | ||
|
||
import controlTypes | ||
import textInfos | ||
import eventHandler | ||
import controlTypes | ||
import speech | ||
import api | ||
from UIABrowseMode import UIABrowseModeDocument | ||
from . import UIA, UIATextInfo | ||
|
||
class WordDocumentTextInfo(UIATextInfo): | ||
|
||
# UIA text range comparison for bookmarks works okay in this MS Word implementation | ||
# Thus __ne__ is useful | ||
def __ne__(self,other): | ||
return not self==other | ||
|
||
def _getControlFieldForObject(self,obj,isEmbedded=False,startOfNode=False,endOfNode=False): | ||
# Ignore strange editable text fields surrounding most inner fields (links, table cells etc) | ||
automationID=obj.UIAElement.cachedAutomationID | ||
if obj.role==controlTypes.ROLE_EDITABLETEXT and (automationID=='Body' or automationID.startswith('UIA_AutomationId_Word_Content')): | ||
return None | ||
field=super(WordDocumentTextInfo,self)._getControlFieldForObject(obj,isEmbedded=isEmbedded,startOfNode=startOfNode,endOfNode=endOfNode) | ||
if obj.role==controlTypes.ROLE_GRAPHIC: | ||
# Label graphics with a description before name as name seems to be auto-generated (E.g. "rectangle") | ||
field['value']=field.pop('description',None) or obj.description or field.pop('name',None) or obj.name | ||
return field | ||
|
||
def _getTextFromUIARange(self,range): | ||
t=super(WordDocumentTextInfo,self)._getTextFromUIARange(range) | ||
if t: | ||
# HTML emails expose a lot of vertical tab chars in their text | ||
# Really better as carage returns | ||
t=t.replace('\v','\r') | ||
# Remove end-of-row markers from the text - they are not useful | ||
t=t.replace('\x07','') | ||
return t | ||
|
||
def _isEndOfRow(self): | ||
""" Is this textInfo positioned on an end-of-row mark? """ | ||
info=self.copy() | ||
info.expand(textInfos.UNIT_CHARACTER) | ||
return info._rangeObj.getText(-1)==u'\u0007' | ||
|
||
def move(self,unit,direction,endPoint=None): | ||
if endPoint is None: | ||
res=super(WordDocumentTextInfo,self).move(unit,direction) | ||
if res==0: | ||
return 0 | ||
# Skip over end of Row marks | ||
while self._isEndOfRow(): | ||
if self.move(unit,1 if direction>0 else -1)==0: | ||
break | ||
return res | ||
return super(WordDocumentTextInfo,self).move(unit,direction,endPoint) | ||
|
||
def _get_isCollapsed(self): | ||
res=super(WordDocumentTextInfo,self).isCollapsed | ||
if res: | ||
return True | ||
# MS Word does not seem to be able to fully collapse ranges when on links and tables etc. | ||
# Therefore class a range as collapsed if it has no text | ||
return not bool(self.text) | ||
|
||
def getTextWithFields(self,formatConfig=None): | ||
fields=super(WordDocumentTextInfo,self).getTextWithFields(formatConfig=formatConfig) | ||
# MS Word can sometimes return a higher ancestor in its textRange's children. | ||
# E.g. a table inside a table header. | ||
# This does not cause a loop, but does cause information to be doubled | ||
# Detect these duplicates and remove them from the generated fields. | ||
seenStarts=set() | ||
pendingRemoves=[] | ||
index=0 | ||
for index,field in enumerate(fields): | ||
if isinstance(field,textInfos.FieldCommand) and field.command=="controlStart": | ||
runtimeID=field.field['runtimeID'] | ||
if runtimeID in seenStarts: | ||
pendingRemoves.append(field.field) | ||
else: | ||
seenStarts.add(runtimeID) | ||
elif seenStarts: | ||
seenStarts.clear() | ||
index=0 | ||
while index<len(fields): | ||
field=fields[index] | ||
if isinstance(field,textInfos.FieldCommand) and any(x is field.field for x in pendingRemoves): | ||
del fields[index] | ||
else: | ||
index+=1 | ||
return fields | ||
|
||
class WordBrowseModeDocument(UIABrowseModeDocument): | ||
|
||
def shouldSetFocusToObj(self,obj): | ||
# Ignore strange editable text fields surrounding most inner fields (links, table cells etc) | ||
if obj.role==controlTypes.ROLE_EDITABLETEXT and obj.UIAElement.cachedAutomationID.startswith('UIA_AutomationId_Word_Content'): | ||
return False | ||
return super(WordBrowseModeDocument,self).shouldSetFocusToObj(obj) | ||
|
||
def shouldPassThrough(self,obj,reason=None): | ||
# Ignore strange editable text fields surrounding most inner fields (links, table cells etc) | ||
if obj.role==controlTypes.ROLE_EDITABLETEXT and obj.UIAElement.cachedAutomationID.startswith('UIA_AutomationId_Word_Content'): | ||
return False | ||
return super(WordBrowseModeDocument,self).shouldPassThrough(obj,reason=reason) | ||
|
||
def script_tab(self,gesture): | ||
oldBookmark=self.rootNVDAObject.makeTextInfo(textInfos.POSITION_SELECTION).bookmark | ||
gesture.send() | ||
noTimeout,newInfo=self.rootNVDAObject._hasCaretMoved(oldBookmark,timeout=1) | ||
if not newInfo: | ||
return | ||
info=self.makeTextInfo(textInfos.POSITION_SELECTION) | ||
if not info.isCollapsed: | ||
speech.speakTextInfo(info,reason=controlTypes.REASON_FOCUS) | ||
script_shiftTab=script_tab | ||
|
||
class WordDocumentNode(UIA): | ||
TextInfo=WordDocumentTextInfo | ||
|
||
class WordDocument(WordDocumentNode): | ||
treeInterceptorClass=WordBrowseModeDocument | ||
shouldCreateTreeInterceptor=False |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason not to make these two sets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry; pendingRemoves shouldn't be, but I still wonder why seenStarts can't.