Skip to content
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 63 commits into from Nov 2, 2016
Merged
Show file tree
Hide file tree
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 May 23, 2016
f0abdef
Re-implement rich text support for Edge, compatible with RS1.
michaelDCurran Jul 16, 2016
04fb955
Add missing import
michaelDCurran Jul 18, 2016
cf6b01d
EdgeTextInfo: ensure getTextWithFields never returns controlFields fo…
michaelDCurran Jul 23, 2016
5721dad
Edge: report landmarks
michaelDCurran Jul 25, 2016
2f0b581
EdgeTextInfo.getTextWithFields: chop redundant fields and text off th…
michaelDCurran Jul 25, 2016
9e94f47
Edge now correctly sets focus on its root container and or document, …
michaelDCurran Jul 25, 2016
72df067
Edge: fall back to name, value or description for embedded controls w…
michaelDCurran Jul 26, 2016
0b8dddc
UIATextInfo: implement support for more formatting (color, alignment,…
michaelDCurran Jul 26, 2016
d686581
Edge: Ensure previous heading quicknav does not skip over same-level …
michaelDCurran Jul 26, 2016
4f949c1
UIATextInfo._getControlFieldForObject: ensure controlFields stay uniq…
michaelDCurran Jul 27, 2016
eb984c7
Edge: Remove any whitespace directly after the end of an element as i…
michaelDCurran Jul 27, 2016
e5c1d27
Edge: _getTextWithFields_balanced and _getTextWithFields_unbalanced d…
michaelDCurran Jul 27, 2016
b7b8731
Edge: focusing a selectable list item (E.g. an auto suggestion) shoul…
michaelDCurran Jul 27, 2016
32bc550
Edge: Ensure a control's name is announced, (but not twice) with mov…
michaelDCurran Jul 28, 2016
2ac85de
UIA NVDAObject: Make use of UIA fullDescription in the description pr…
michaelDCurran Jul 28, 2016
0c8b95e
UIA NVDAObject's description property: only use fullDescription if it…
michaelDCurran Jul 28, 2016
9fe00d4
Edge: use localizedLandmarkType instead of localizedControlType when …
michaelDCurran Jul 28, 2016
a902070
Edge: expose the clickable state on text, groupings, sections and gra…
michaelDCurran Jul 28, 2016
14fb00f
Edge: _getTextWithFields_balanced: specifically handle detection of a…
michaelDCurran Jul 28, 2016
7039ab7
Edge: make use of some existing base code when walking formatted text.
michaelDCurran Jul 28, 2016
4e00155
Edge: integrate the main code from _getTextWithFields_balanced in to …
michaelDCurran Jul 28, 2016
9ecc0ec
Edge heading quicknav: re-implement using move by paragraph and getAt…
michaelDCurran Jul 29, 2016
1b30b65
speech.getFormatFieldSpeech: If the user has chosen to report heading…
michaelDCurran Jul 29, 2016
efe112f
Edge browseMode: allow aria-label / aria-labelledby to override conte…
michaelDCurran Jul 29, 2016
b98d4e7
Edge: detect iframes and give them an appropriate role.
michaelDCurran Jul 29, 2016
ad80630
Edge: work around MS Edge bug where expanding to character on an a co…
michaelDCurran Jul 29, 2016
924bf33
Edge browseMode: report number of items in lists such as in other bro…
michaelDCurran Jul 29, 2016
f871c63
Edge browseMode: rough implementation of quicknav/listing landmarks.
michaelDCurran Jul 29, 2016
b778343
Edge: provide _startOfNode and _endOfNode attributes on controlFields…
michaelDCurran Jul 30, 2016
f7a29a3
EdgeTextInfo: override move and expand to skip over element start pos…
michaelDCurran Jul 31, 2016
4c1e1d3
Edge: expose overridden content always via value, with a single space…
michaelDCurran Jul 31, 2016
ce57ef8
Edge: only expose heading levels in initial formatFields. Braille: su…
michaelDCurran Jul 31, 2016
4c76ce4
EdgeTextInfo.expand: don't try fixing up expanding of line and paragr…
michaelDCurran Aug 2, 2016
addb9f9
UIATextInfo: move spelling detection into getFormatfieldAtRange.
michaelDCurran Aug 10, 2016
ef752fb
UIATextInfo: abstract a lot of Edge code, replacing the old UIATextIn…
michaelDCurran Aug 15, 2016
aa22a01
Abstract more Edge code into the base UIA support, including a base U…
michaelDCurran Aug 15, 2016
ba471bb
UIA: don't raise an exception on mixed text attribute values if there…
michaelDCurran Aug 15, 2016
b6eebea
UIA: Initial support for Win10 Mail browseMode (UIA MS Word support).…
michaelDCurran Aug 16, 2016
ac83d7d
Edge: don't expose clickables if they are descendants of clickables.
michaelDCurran Aug 16, 2016
854c072
Add an appModule for Win10 Mail (hxmail) and provide browseMode autom…
michaelDCurran Aug 16, 2016
f1b1bff
Add missing imports
michaelDCurran Aug 16, 2016
d789aab
EdgeTextInfo.expand: only do special expanding for embedded children …
michaelDCurran Aug 16, 2016
8f88584
UIABrowseMode: don't use ReviewCursorManager as Mail does not need it…
michaelDCurran Aug 18, 2016
dd90809
Report position in a document when pressing tab or shift+tab.
michaelDCurran Aug 18, 2016
16b1097
UIAUtils: add more doc strings.
michaelDCurran Aug 31, 2016
e51cc5c
Win10 Mail: stop reporting 'edit' for each line of documents.
michaelDCurran Sep 5, 2016
30721d1
Improve performance of navigating in Edge browse Mode by about 20%.
michaelDCurran Sep 7, 2016
35754e6
Remove the need for overriding focusableNVDAObjectAtStart on the Edg…
michaelDCurran Sep 9, 2016
149c44a
UIATextInfo._getTextWithFieldsForUIARange: remove redundant check.
michaelDCurran Sep 9, 2016
d99d455
Review actions for #6271
michaelDCurran Sep 9, 2016
adcef1c
Edge: Report editable combo boxes as editable and allow them to be fo…
michaelDCurran Sep 12, 2016
b64d85a
Untested idea as to how to handle content overriding in controlFields.
jcsteh Sep 15, 2016
87a4c4e
Edge: Where content is replaced via aria-label etc, ensure that conte…
michaelDCurran Sep 21, 2016
1c4d6de
Braille: no longer support alwaysReportValue as it is not needed.
michaelDCurran Sep 21, 2016
cdcb25f
Address comments in #6271
michaelDCurran Sep 23, 2016
94fbd8e
EdgeTextInfo.expand: remove code that tries to exclude content from t…
michaelDCurran Sep 26, 2016
92f27b1
Edge NVDAObject: catch a case where a text range could be NULL.
michaelDCurran Sep 26, 2016
6afc061
UIATextInfo._getTextWithFieldsForUIARange: handle where IUIAutomation…
michaelDCurran Sep 29, 2016
49779ee
NVDAObjects.UIA: allow module load where UIA is unavailable (E.g. XP).
michaelDCurran Sep 30, 2016
4982945
Handle broken WPF UIA text pattern (E.g. 1Password):
michaelDCurran Oct 18, 2016
2b50f3a
Address review actions for #6271
michaelDCurran Oct 19, 2016
2316b08
Ignore COMError in IE 11 on Windows 7 during UIA text fetching.
michaelDCurran Nov 2, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
471 changes: 328 additions & 143 deletions source/NVDAObjects/UIA/__init__.py

Large diffs are not rendered by default.

856 changes: 382 additions & 474 deletions source/NVDAObjects/UIA/edge.py

Large diffs are not rendered by default.

126 changes: 126 additions & 0 deletions source/NVDAObjects/UIA/wordDocument.py
@@ -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=[]
Copy link
Contributor

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?

Copy link
Contributor

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.

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