NVDA Helper
In-process and lite high-speed utilities for NVDA
|
Renders content in to a storage buffer for linea access. More...
#include <backend.h>
Public Member Functions | |
VBufBackend_t (int docHandle, int ID) | |
constructor | |
virtual void | initialize () |
Initializes the state of the backend and performs an initial rendering of content. | |
virtual bool | invalidateSubtree (VBufStorage_controlFieldNode_t *) |
marks a particular node as invalid, so that its content is re-rendered on next update. | |
virtual void | forceUpdate () |
Forces any invalidated nodes to be updated right now. | |
virtual void | terminate () |
Clears the content of the backend and terminates any code used for rendering. | |
virtual void | destroy () |
Destructs and deletes the backend. | |
VBufStorage_controlFieldNode_t * | reuseExistingNodeInRender (VBufStorage_controlFieldNode_t *parent, VBufStorage_fieldNode_t *previous, int docHandle, int ID) |
Fetches an existing node from this backend, so that it can be added to a temporary buffer as a reference node during a partial render. | |
![]() | |
VBufStorage_buffer_t () | |
~VBufStorage_buffer_t () | |
Destructor. | |
VBufStorage_controlFieldNode_t * | addControlFieldNode (VBufStorage_controlFieldNode_t *parent, VBufStorage_fieldNode_t *previous, int docHandle, int ID, bool isBlock) |
Adds a control field in to the buffer. | |
VBufStorage_controlFieldNode_t * | addControlFieldNode (VBufStorage_controlFieldNode_t *parent, VBufStorage_fieldNode_t *previous, VBufStorage_controlFieldNode_t *node) |
VBufStorage_textFieldNode_t * | addTextFieldNode (VBufStorage_controlFieldNode_t *parent, VBufStorage_fieldNode_t *previous, const std::wstring &text) |
Adds a text field in to the buffer. | |
VBufStorage_textFieldNode_t * | addTextFieldNode (VBufStorage_controlFieldNode_t *parent, VBufStorage_fieldNode_t *previous, VBufStorage_textFieldNode_t *node) |
virtual bool | isNodeInBuffer (VBufStorage_fieldNode_t *node) |
finds out if the given node exists in this buffer. | |
bool | replaceSubtrees (std::map< VBufStorage_fieldNode_t *, VBufStorage_buffer_t * > &m) |
Removes the given nodes from the buffer and then merges the content of the new buffers in the removed node's position. | |
bool | removeFieldNode (VBufStorage_fieldNode_t *node, bool removeDescendants=true) |
disassociates from this buffer, and deletes, the given field and its descendants. | |
void | clearBuffer () |
virtual bool | getFieldNodeOffsets (VBufStorage_fieldNode_t *node, int *startOffset, int *endOffset) |
Calculates the start and end character offsets of the given node in the buffer. | |
virtual bool | isFieldNodeAtOffset (VBufStorage_fieldNode_t *node, int offset) |
finds out if a given field is positioned at a given character offset in this buffer. | |
virtual VBufStorage_textFieldNode_t * | locateTextFieldNodeAtOffset (int offset, int *nodeStartOffset, int *nodeEndOffset) |
locates the text field node at the given offset | |
virtual VBufStorage_controlFieldNode_t * | locateControlFieldNodeAtOffset (int offset, int *startOffset, int *endOffset, int *docHandle, int *ID) |
locates the deepest control field node at the given offset | |
virtual VBufStorage_controlFieldNode_t * | getControlFieldNodeWithIdentifier (int docHandle, int ID) |
locates the controlFieldNode with the given identifier | |
virtual bool | getIdentifierFromControlFieldNode (VBufStorage_controlFieldNode_t *node, int *docHandle, int *ID) |
Retreaves the identifier for the given controlFieldNode. | |
virtual VBufStorage_fieldNode_t * | findNodeByAttributes (int offset, VBufStorage_findDirection_t direction, const std::wstring &attribs, const std::wstring ®exp, int *startOffset, int *endOffset) |
Finds a field node that contains particular attributes. | |
virtual bool | getSelectionOffsets (int *startOffset, int *endOffset) const |
Retreaves the current selection offsets for the buffer. | |
virtual bool | setSelectionOffsets (int startOffset, int endOffset) |
sets the selection offsets for the buffer. | |
virtual int | getTextLength () const |
retreaves the length of all the text in the buffer. | |
virtual bool | getTextInRange (int startOffset, int endOffset, std::wstring &text, bool useMarkup=false) |
Retreaves the text in the buffer between given offsets, optionally containing markup. | |
virtual bool | getLineOffsets (int offset, int maxLineLength, bool useScreenLayout, int *startOffset, int *endOffset) |
Expands the given offset to the start and end offsets of the containing line. | |
virtual bool | hasContent () |
Does this buffer have content? true if there is content, false otherwise. | |
virtual bool | isDescendantNode (VBufStorage_fieldNode_t *parent, VBufStorage_fieldNode_t *descendant) |
Is one node a descendant of another. | |
VBufStorage_referenceNode_t * | addReferenceNodeToBuffer (VBufStorage_controlFieldNode_t *parent, VBufStorage_fieldNode_t *previous, VBufStorage_controlFieldNode_t *node) |
Adds a reference node to the buffer at the location given by parent and previous, pointing to the given existing node in another buffer. | |
virtual std::wstring | getDebugInfo () const |
Public Attributes | |
const int | rootDocHandle |
identifies the window or document where the backend starts rendering from | |
const int | rootID |
Represents the ID in the window or document where the backend starts rendering. | |
LockableObject | lock |
Useful for cerializing access to the buffer. | |
Protected Member Functions | |
void | requestUpdate () |
Requests that the backend should update any invalid nodes when it can in the next little while. | |
void | cancelPendingUpdate () |
Cancels any pending request to update invalid nodes. | |
virtual void | renderThread_initialize () |
Sets up any code in the render thread. | |
virtual void | renderThread_terminate () |
Terminates any code in the render thread. | |
virtual void | render (VBufStorage_buffer_t *buffer, int docHandle, int ID, VBufStorage_controlFieldNode_t *oldNode=NULL)=0 |
Renders content starting from the given doc handle and ID, in to the given buffer. | |
void | update () |
Updates the content of the buffer. | |
virtual | ~VBufBackend_t () |
Destructor, (protected as you must use the destroy method). | |
![]() | |
bool | unlinkFieldNode (VBufStorage_fieldNode_t *node, bool removeDescendants=true) |
Unlinks this node from its parent and siblings. | |
void | forgetControlFieldNode (VBufStorage_controlFieldNode_t *node) |
removes the controlFieldNode from the buffer's controlFieldNodesByIdentifier set. | |
bool | insertNode (VBufStorage_controlFieldNode_t *parent, VBufStorage_fieldNode_t *previous, VBufStorage_fieldNode_t *node) |
Inserts the given fieldNode in to the buffer's tree of nodes. | |
void | deleteSubtree (VBufStorage_fieldNode_t *node) |
disassociates the given node and its descendants from this buffer and deletes the node and its descendants. | |
void | deleteNode (VBufStorage_fieldNode_t *node) |
disassociates the given node from this buffer and deletes the node. | |
Protected Attributes | |
VBufStorage_controlFieldNodeList_t | pendingInvalidSubtreesList |
the list of control field nodes that should be re-rendered the next time the backend is updated. | |
VBufStorage_controlFieldNodeList_t | workingInvalidSubtreesList |
The list of invalid subtrees currently being re-rendered by update. | |
const int | renderThreadID |
The thread ID of the rendering thread. | |
![]() | |
std::list< VBufStorage_referenceNode_t * > | referenceNodes |
Holds all the reference nodes for this buffer. | |
VBufStorage_fieldNode_t * | rootNode |
points to the first node in the tree of nodes. | |
std::set< VBufStorage_fieldNode_t * > | nodes |
Holds pointers to all nodes in the buffer. | |
std::map< VBufStorage_controlFieldNodeIdentifier_t, VBufStorage_controlFieldNode_t * > | controlFieldNodesByIdentifier |
holds pointers to all control field nodes in this buffer, searchable by the control's unique identifier. | |
int | selectionStart |
the offset at where the current selection starts. | |
int | selectionLength |
The length of the selection. | |
Static Protected Attributes | |
static VBufBackendSet_t | runningBackends |
The set of currently running backends. | |
Renders content in to a storage buffer for linea access.
|
protectedvirtual |
Destructor, (protected as you must use the destroy method).
References LOG_DEBUG, nhAssert, and runningBackends.
constructor
docHandle | uniquely identifies the document or window containing the content to ve rendered |
ID | uniquely identifies where to start rendering from in the document or window |
storageBuffer | the storage buffer to render the content in |
References LOG_DEBUG.
|
protected |
Requests that the backend should update any invalid nodes when it can in the next little while.
References LOG_DEBUG, and nhAssert.
Referenced by invalidateSubtree().
|
protected |
Cancels any pending request to update invalid nodes.
References LOG_DEBUG.
Referenced by forceUpdate(), and renderThread_terminate().
|
protectedvirtual |
Sets up any code in the render thread.
Reimplemented in AdobeAcrobatVBufBackend_t, GeckoVBufBackend_t, lotusNotesRichTextVBufBackend_t, and WebKitVBufBackend_t.
References LOG_DEBUG, registerWinEventHook(), runningBackends, and update().
Referenced by initialize(), AdobeAcrobatVBufBackend_t::renderThread_initialize(), GeckoVBufBackend_t::renderThread_initialize(), lotusNotesRichTextVBufBackend_t::renderThread_initialize(), and WebKitVBufBackend_t::renderThread_initialize().
|
protectedvirtual |
Terminates any code in the render thread.
Reimplemented in AdobeAcrobatVBufBackend_t, GeckoVBufBackend_t, lotusNotesRichTextVBufBackend_t, and WebKitVBufBackend_t.
References cancelPendingUpdate(), VBufStorage_buffer_t::clearBuffer(), LOG_DEBUG, runningBackends, and unregisterWinEventHook().
Referenced by AdobeAcrobatVBufBackend_t::renderThread_terminate(), GeckoVBufBackend_t::renderThread_terminate(), lotusNotesRichTextVBufBackend_t::renderThread_terminate(), WebKitVBufBackend_t::renderThread_terminate(), and terminate().
|
protectedpure virtual |
Renders content starting from the given doc handle and ID, in to the given buffer.
The buffer will always start off empty as even for subtree re-rendering, a temp buffer is provided.
buffer | the buffer to render content in. |
docHandle | the doc handle to start from |
ID | the ID to start from. |
oldNode | an optional node that will be replaced by the rendered content (useful for retreaving cached data) |
Implemented in AdobeAcrobatVBufBackend_t, GeckoVBufBackend_t, lotusNotesRichTextVBufBackend_t, MshtmlVBufBackend_t, and WebKitVBufBackend_t.
Referenced by update().
|
protected |
Updates the content of the buffer.
If no content yet exists it renders the entire document. If content exists it only re-renders nodes marked as invalid.
References LockableObject::acquire(), VBufStorage_controlFieldNode_t::getDebugInfo(), VBufStorage_controlFieldNode_t::getIdentifier(), VBufStorage_buffer_t::hasContent(), lock, LOG_DEBUG, LOG_DEBUGWARNING, nhAssert, nvdaControllerInternal_vbufChangeNotify(), pendingInvalidSubtreesList, LockableObject::release(), render(), VBufStorage_buffer_t::replaceSubtrees(), rootDocHandle, rootID, VBufStorage_buffer_t::VBufStorage_buffer_t(), and workingInvalidSubtreesList.
Referenced by forceUpdate(), and renderThread_initialize().
|
virtual |
Initializes the state of the backend and performs an initial rendering of content.
References execInThread(), LOG_DEBUG, LOG_ERROR, registerWindowsHook(), renderThread_initialize(), renderThreadID, and rootDocHandle.
Referenced by VBufRemote_createBuffer().
|
virtual |
marks a particular node as invalid, so that its content is re-rendered on next update.
node | the node that should be invalidated. |
References VBufStorage_controlFieldNode_t::allowReuseInAncestorUpdate, VBufStorage_controlFieldNode_t::getDebugInfo(), VBufStorage_fieldNode_t::getParent(), VBufStorage_buffer_t::isNodeInBuffer(), lock, LOG_DEBUG, LOG_DEBUGWARNING, markNodeAsNonreusableIfInAncestor(), pendingInvalidSubtreesList, requestUpdate(), VBufStorage_controlFieldNode_t::requiresParentUpdate, and LockableObject::scopedAcquire().
Referenced by CDispatchChangeSink::IDispatch::Invoke(), CHTMLChangeSink::IHTMLChangeSink::Notify(), AdobeAcrobatVBufBackend_t::renderThread_winEventProcHook(), GeckoVBufBackend_t::renderThread_winEventProcHook(), lotusNotesRichTextVBufBackend_t::renderThread_winEventProcHook(), and WebKitVBufBackend_t::renderThread_winEventProcHook().
|
virtual |
Forces any invalidated nodes to be updated right now.
References cancelPendingUpdate(), and update().
Referenced by CDispatchChangeSink::IDispatch::Invoke(), CHTMLChangeSink::IHTMLChangeSink::Notify(), and GeckoVBufBackend_t::renderThread_winEventProcHook().
|
virtual |
Clears the content of the backend and terminates any code used for rendering.
References execInThread(), LOG_DEBUG, LOG_ERROR, renderThread_terminate(), renderThreadID, rootDocHandle, runningBackends, and unregisterWindowsHook().
Referenced by VBufRemote_destroyBuffer().
|
virtual |
Destructs and deletes the backend.
Must be used rather than delete as this will handle crossing CRT boundaries.
Referenced by VBufRemote_destroyBuffer().
VBufStorage_controlFieldNode_t * VBufBackend_t::reuseExistingNodeInRender | ( | VBufStorage_controlFieldNode_t * | parent, |
VBufStorage_fieldNode_t * | previous, | ||
int | docHandle, | ||
int | ID ) |
Fetches an existing node from this backend, so that it can be added to a temporary buffer as a reference node during a partial render.
This method should only be called from within a backend's render method. If the node exists but it is currently marked for re-rendering, The node is unmarked for re-rendering, but not returned. this allows the current render in progress (that called this method) to go ahead and re-render that node itself like it had never existed.
References VBufStorage_controlFieldNode_t::alwaysRerenderChildren, VBufStorage_controlFieldNode_t::alwaysRerenderDescendants, VBufStorage_buffer_t::getControlFieldNodeWithIdentifier(), VBufStorage_fieldNode_t::getPrevious(), LOG_DEBUG, VBufStorage_referenceNode_t::referenceNode, and workingInvalidSubtreesList.
|
protected |
the list of control field nodes that should be re-rendered the next time the backend is updated.
the list is in an order such that any parent is before any child.
Referenced by invalidateSubtree(), and update().
|
protected |
The list of invalid subtrees currently being re-rendered by update.
Referenced by reuseExistingNodeInRender(), and update().
|
staticprotected |
The set of currently running backends.
Referenced by renderThread_initialize(), renderThread_terminate(), AdobeAcrobatVBufBackend_t::renderThread_winEventProcHook(), GeckoVBufBackend_t::renderThread_winEventProcHook(), lotusNotesRichTextVBufBackend_t::renderThread_winEventProcHook(), WebKitVBufBackend_t::renderThread_winEventProcHook(), terminate(), and ~VBufBackend_t().
|
protected |
The thread ID of the rendering thread.
Referenced by initialize(), and terminate().
const int VBufBackend_t::rootDocHandle |
identifies the window or document where the backend starts rendering from
Referenced by MshtmlVBufBackend_t::getDeepestControlFieldNodeForHTMLElement(), initialize(), GeckoVBufBackend_t::renderThread_initialize(), GeckoVBufBackend_t::renderThread_winEventProcHook(), terminate(), and update().
const int VBufBackend_t::rootID |
Represents the ID in the window or document where the backend starts rendering.
Referenced by MshtmlVBufBackend_t::fillVBuf(), GeckoVBufBackend_t::renderThread_initialize(), GeckoVBufBackend_t::renderThread_winEventProcHook(), and update().
LockableObject VBufBackend_t::lock |
Useful for cerializing access to the buffer.
Referenced by invalidateSubtree(), update(), VBufRemote_destroyBuffer(), VBufRemote_findNodeByAttributes(), VBufRemote_getControlFieldNodeWithIdentifier(), VBufRemote_getFieldNodeOffsets(), VBufRemote_getIdentifierFromControlFieldNode(), VBufRemote_getLineOffsets(), VBufRemote_getSelectionOffsets(), VBufRemote_getTextInRange(), VBufRemote_getTextLength(), VBufRemote_isFieldNodeAtOffset(), VBufRemote_locateControlFieldNodeAtOffset(), VBufRemote_locateTextFieldNodeAtOffset(), and VBufRemote_setSelectionOffsets().