-
-
Notifications
You must be signed in to change notification settings - Fork 820
Revert live region changes to mshtml virtual buffer #11838
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| /* | ||
| This file is a part of the NVDA project. | ||
| URL: http://www.nvda-project.org/ | ||
| Copyright 2006-2020 NV Access Limited, Google LLC, Leonard de Ruijter | ||
| Copyright 2006-2015 NVDA contributers. | ||
| This program is free software: you can redistribute it and/or modify | ||
| it under the terms of the GNU General Public License version 2.0, as published by | ||
| the Free Software Foundation. | ||
|
|
@@ -20,7 +20,7 @@ This license can be found at: | |
| #include <mshtmdid.h> | ||
| #include <common/log.h> | ||
| #include "mshtml.h" | ||
| #include <remote/nvdaControllerInternal.h> | ||
| #include <remote/nvdaController.h> | ||
| #include <common/xml.h> | ||
| #include "node.h" | ||
|
|
||
|
|
@@ -124,15 +124,7 @@ class CDispatchChangeSink : public IDispatch { | |
| if(dispIdMember==DISPID_EVMETH_ONPROPERTYCHANGE||dispIdMember==DISPID_EVMETH_ONLOAD) { | ||
| this->storageNode->backend->invalidateSubtree(this->storageNode); | ||
| // Force the update to happen with no delay if we happen to be in a live region | ||
| if ( | ||
| this->storageNode->ariaLiveNode | ||
| && this->storageNode->ariaLiveNode != this->storageNode | ||
| && !this->storageNode->ariaLiveIsBusy | ||
| && ( | ||
| this->storageNode->ariaLiveIsTextRelevant | ||
| || this->storageNode->ariaLiveIsAdditionsRelevant | ||
| ) | ||
| ) { | ||
| if(this->storageNode->ariaLiveNode&&this->storageNode->ariaLiveNode!=this->storageNode&&!this->storageNode->ariaLiveIsBusy&&(this->storageNode->ariaLiveIsTextRelevant||this->storageNode->ariaLiveIsAdditionsRelevant)) { | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that it's better to Split long if statements onto several lines. Do you have a reason to change this here and others places? |
||
| this->storageNode->backend->forceUpdate(); | ||
| } | ||
| return S_OK; | ||
|
|
@@ -274,15 +266,7 @@ class CHTMLChangeSink : public IHTMLChangeSink { | |
| this->storageNode->backend->invalidateSubtree(invalidNode); | ||
| MshtmlVBufStorage_controlFieldNode_t* invalidMshtmlNode=(MshtmlVBufStorage_controlFieldNode_t*)invalidNode; | ||
| // Force the update to happen with no delay if we happen to be in a live region | ||
| if ( | ||
| invalidMshtmlNode->ariaLiveNode | ||
| && invalidMshtmlNode->ariaLiveNode != invalidMshtmlNode | ||
| && !invalidMshtmlNode->ariaLiveIsBusy | ||
| && ( | ||
| invalidMshtmlNode->ariaLiveIsTextRelevant | ||
| || invalidMshtmlNode->ariaLiveIsAdditionsRelevant | ||
| ) | ||
| ) { | ||
| if(invalidMshtmlNode->ariaLiveNode&&invalidMshtmlNode->ariaLiveNode!=invalidMshtmlNode&&!invalidMshtmlNode->ariaLiveIsBusy&&(invalidMshtmlNode->ariaLiveIsTextRelevant||invalidMshtmlNode->ariaLiveIsAdditionsRelevant)) { | ||
| this->storageNode->backend->forceUpdate(); | ||
| } | ||
| } | ||
|
|
@@ -369,18 +353,11 @@ MshtmlVBufStorage_controlFieldNode_t::~MshtmlVBufStorage_controlFieldNode_t() { | |
| } | ||
|
|
||
| void MshtmlVBufStorage_controlFieldNode_t::preProcessLiveRegion(const MshtmlVBufStorage_controlFieldNode_t* parent, const std::map<std::wstring,std::wstring>& attribsMap) { | ||
| auto i=attribsMap.find(L"HTMLAttrib::aria-live"); | ||
| auto i=attribsMap.find(L"HTMLAttrib::aria-live"); | ||
| if(i!=attribsMap.end()&&!i->second.empty()) { | ||
| bool isAriaLiveEnabled = i->second == L"polite" || i->second == L"assertive"; | ||
| this->ariaLiveNode = isAriaLiveEnabled ? this : nullptr; | ||
| this->ariaLivePoliteness = i->second; | ||
| this->ariaLiveNode=((i->second.compare(L"polite")==0)||(i->second.compare(L"assertive")==0))?this:NULL; | ||
| } else { | ||
| this->ariaLiveNode = parent? parent->ariaLiveNode : nullptr; | ||
| if (this->ariaLiveNode) { | ||
| this->ariaLivePoliteness = this->ariaLiveNode->ariaLivePoliteness; | ||
| } else { | ||
| this->ariaLivePoliteness = nullptr; | ||
| } | ||
| this->ariaLiveNode=parent?parent->ariaLiveNode:NULL; | ||
| } | ||
| i=attribsMap.find(L"HTMLAttrib::aria-relevant"); | ||
| if(i!=attribsMap.end()&&!i->second.empty()) { | ||
|
|
@@ -407,13 +384,13 @@ void MshtmlVBufStorage_controlFieldNode_t::preProcessLiveRegion(const MshtmlVBuf | |
| } else { | ||
| this->ariaLiveAtomicNode=parent?parent->ariaLiveAtomicNode:NULL; | ||
| } | ||
| LOG_DEBUG(L"preProcessLiveRegion: ariaLiveNode "<<ariaLiveNode<<L", ariaLiveIsTextRelevant "<<ariaLiveIsTextRelevant<<L", ariaLiveIsAdditionsRelevant "<<ariaLiveIsAdditionsRelevant<<L", ariaLiveIsBusy "<<ariaLiveIsBusy<<L", ariaLiveAtomicNode "<<ariaLiveAtomicNode); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assume that this line should be restored and the (new) comment should be removed |
||
| //LOG_INFO(L"preProcessLiveRegion: ariaLiveNode "<<ariaLiveNode<<L", ariaLiveIsTextRelevant "<<ariaLiveIsTextRelevant<<L", ariaLiveIsAdditionsRelevant "<<ariaLiveIsAdditionsRelevant<<L", ariaLiveIsBusy "<<ariaLiveIsBusy<<L", ariaLiveAtomicNode "<<ariaLiveAtomicNode); | ||
| } | ||
|
|
||
| void MshtmlVBufStorage_controlFieldNode_t::reportLiveText(wstring& text, wstring& politeness) { | ||
| void MshtmlVBufStorage_controlFieldNode_t::reportLiveText(wstring& text) { | ||
| for(auto c: text) { | ||
| if(!iswspace(c)) { | ||
| nvdaControllerInternal_reportLiveRegion(text.c_str(), politeness.c_str()); | ||
| nvdaController_speakText(text.c_str()); | ||
| break; | ||
| } | ||
| } | ||
|
|
@@ -422,23 +399,21 @@ void MshtmlVBufStorage_controlFieldNode_t::reportLiveText(wstring& text, wstring | |
| bool isNodeInLiveRegion(VBufStorage_fieldNode_t* node) { | ||
| if(!node) return false; | ||
| if(node->getFirstChild()) { | ||
| return ((MshtmlVBufStorage_controlFieldNode_t*)node)->ariaLiveNode != nullptr; | ||
| return ((MshtmlVBufStorage_controlFieldNode_t*)node)->ariaLiveNode!=NULL; | ||
| } | ||
| return true; | ||
| } | ||
|
|
||
| void MshtmlVBufStorage_controlFieldNode_t::reportLiveAddition() { | ||
| wstring text; //=(this->ariaLiveAtomicNode==this)?L"atomic: ":L"additions: "; | ||
| this->getTextInRange(0,this->getLength(),text,false,isNodeInLiveRegion); | ||
| this->reportLiveText(text, this->ariaLivePoliteness); | ||
| this->reportLiveText(text); | ||
| } | ||
|
|
||
| void MshtmlVBufStorage_controlFieldNode_t::postProcessLiveRegion(VBufStorage_controlFieldNode_t* oldNode, set<VBufStorage_controlFieldNode_t*>& atomicNodes) { | ||
| LOG_DEBUG(L"postProcessLiveRegion: ariaLiveNode "<<ariaLiveNode<<L", ariaLiveIsTextRelevant "<<ariaLiveIsTextRelevant<<L", ariaLiveIsAdditionsRelevant "<<ariaLiveIsAdditionsRelevant<<L", ariaLiveIsBusy "<<ariaLiveIsBusy<<L", ariaLiveAtomicNode "<<ariaLiveAtomicNode); | ||
| if (!this->ariaLiveNode || this->ariaLiveIsBusy) { | ||
| return; | ||
| } | ||
| bool reportNode=!oldNode && this->ariaLiveIsAdditionsRelevant && this->ariaLiveNode != this; | ||
| //LOG_INFO(L"preProcessLiveRegion: ariaLiveNode "<<ariaLiveNode<<L", ariaLiveIsTextRelevant "<<ariaLiveIsTextRelevant<<L", ariaLiveIsAdditionsRelevant "<<ariaLiveIsAdditionsRelevant<<L", ariaLiveIsBusy "<<ariaLiveIsBusy<<L", ariaLiveAtomicNode "<<ariaLiveAtomicNode); | ||
| if(!this->ariaLiveNode||this->ariaLiveIsBusy) return; | ||
| bool reportNode=!oldNode&&this->ariaLiveIsAdditionsRelevant&&this->ariaLiveNode!=this; | ||
| wstring newChildrenText; | ||
| if(!reportNode&&oldNode&&ariaLiveIsTextRelevant) { | ||
| // Find the first new text child | ||
|
|
@@ -494,7 +469,7 @@ void MshtmlVBufStorage_controlFieldNode_t::postProcessLiveRegion(VBufStorage_con | |
| } else if(reportNode) { | ||
| this->reportLiveAddition(); | ||
| } else if(!newChildrenText.empty()) { | ||
| this->reportLiveText(newChildrenText, this->ariaLivePoliteness); | ||
| this->reportLiveText(newChildrenText); | ||
| } | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,7 +1,7 @@ | ||||||
| /* | ||||||
| This file is a part of the NVDA project. | ||||||
| URL: http://www.nvda-project.org/ | ||||||
| Copyright 2006-2020 NV Access Limited, Google LLC, Leonard de Ruijter | ||||||
| Copyright 2006-2015 NVDA contributers. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| This program is free software: you can redistribute it and/or modify | ||||||
| it under the terms of the GNU General Public License version 2.0, as published by | ||||||
| the Free Software Foundation. | ||||||
|
|
@@ -31,14 +31,13 @@ class MshtmlVBufStorage_controlFieldNode_t : public VBufStorage_controlFieldNode | |||||
| IHTMLChangeSink* pHTMLChangeSink; | ||||||
| DWORD HTMLChangeSinkCookey; | ||||||
| std::wstring language; | ||||||
| MshtmlVBufStorage_controlFieldNode_t* ariaLiveNode; | ||||||
| std::wstring ariaLivePoliteness; | ||||||
| VBufStorage_controlFieldNode_t* ariaLiveNode; | ||||||
| unsigned int formatState; | ||||||
| bool ariaLiveIsTextRelevant; | ||||||
| bool ariaLiveIsAdditionsRelevant; | ||||||
| bool ariaLiveIsBusy; | ||||||
| VBufStorage_controlFieldNode_t* ariaLiveAtomicNode; | ||||||
| void reportLiveText(std::wstring& text, std::wstring& politeness); | ||||||
| void reportLiveText(std::wstring& text); | ||||||
| void reportLiveAddition(); | ||||||
| void preProcessLiveRegion(const MshtmlVBufStorage_controlFieldNode_t* parent, const std::map<std::wstring,std::wstring>& attribsMap); | ||||||
| void postProcessLiveRegion(VBufStorage_controlFieldNode_t* oldNode, std::set<VBufStorage_controlFieldNode_t*>& atomicNodes); | ||||||
|
|
||||||
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.