NVDA Helper
In-process and lite high-speed utilities for NVDA
VBufBackend_t Class Referenceabstract

Renders content in to a storage buffer for linea access. More...

#include <backend.h>

Inheritance diagram for VBufBackend_t:
VBufStorage_buffer_t AdobeAcrobatVBufBackend_t GeckoVBufBackend_t MshtmlVBufBackend_t WebKitVBufBackend_t lotusNotesRichTextVBufBackend_t

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_treuseExistingNodeInRender (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.
 
- Public Member Functions inherited from VBufStorage_buffer_t
 VBufStorage_buffer_t ()
 
 ~VBufStorage_buffer_t ()
 Destructor.
 
VBufStorage_controlFieldNode_taddControlFieldNode (VBufStorage_controlFieldNode_t *parent, VBufStorage_fieldNode_t *previous, int docHandle, int ID, bool isBlock)
 Adds a control field in to the buffer.
 
VBufStorage_controlFieldNode_taddControlFieldNode (VBufStorage_controlFieldNode_t *parent, VBufStorage_fieldNode_t *previous, VBufStorage_controlFieldNode_t *node)
 
VBufStorage_textFieldNode_taddTextFieldNode (VBufStorage_controlFieldNode_t *parent, VBufStorage_fieldNode_t *previous, const std::wstring &text)
 Adds a text field in to the buffer.
 
VBufStorage_textFieldNode_taddTextFieldNode (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_tlocateTextFieldNodeAtOffset (int offset, int *nodeStartOffset, int *nodeEndOffset)
 locates the text field node at the given offset
 
virtual VBufStorage_controlFieldNode_tlocateControlFieldNodeAtOffset (int offset, int *startOffset, int *endOffset, int *docHandle, int *ID)
 locates the deepest control field node at the given offset
 
virtual VBufStorage_controlFieldNode_tgetControlFieldNodeWithIdentifier (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_tfindNodeByAttributes (int offset, VBufStorage_findDirection_t direction, const std::wstring &attribs, const std::wstring &regexp, 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_taddReferenceNodeToBuffer (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).
 
- Protected Member Functions inherited from VBufStorage_buffer_t
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.
 
- Protected Attributes inherited from VBufStorage_buffer_t
std::list< VBufStorage_referenceNode_t * > referenceNodes
 Holds all the reference nodes for this buffer.
 
VBufStorage_fieldNode_trootNode
 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.
 

Detailed Description

Renders content in to a storage buffer for linea access.

Constructor & Destructor Documentation

◆ ~VBufBackend_t()

VBufBackend_t::~VBufBackend_t ( )
protectedvirtual

Destructor, (protected as you must use the destroy method).

References LOG_DEBUG, nhAssert, and runningBackends.

◆ VBufBackend_t()

VBufBackend_t::VBufBackend_t ( int docHandle,
int ID )

constructor

Parameters
docHandleuniquely identifies the document or window containing the content to ve rendered
IDuniquely identifies where to start rendering from in the document or window
storageBufferthe storage buffer to render the content in

References LOG_DEBUG.

Member Function Documentation

◆ requestUpdate()

void VBufBackend_t::requestUpdate ( )
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().

◆ cancelPendingUpdate()

void VBufBackend_t::cancelPendingUpdate ( )
protected

Cancels any pending request to update invalid nodes.

References LOG_DEBUG.

Referenced by forceUpdate(), and renderThread_terminate().

◆ renderThread_initialize()

◆ renderThread_terminate()

◆ render()

virtual void VBufBackend_t::render ( VBufStorage_buffer_t * buffer,
int docHandle,
int ID,
VBufStorage_controlFieldNode_t * oldNode = NULL )
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.

Parameters
bufferthe buffer to render content in.
docHandlethe doc handle to start from
IDthe ID to start from.
oldNodean 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().

◆ update()

◆ initialize()

void VBufBackend_t::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().

◆ invalidateSubtree()

◆ forceUpdate()

void VBufBackend_t::forceUpdate ( )
virtual

◆ terminate()

void VBufBackend_t::terminate ( )
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().

◆ destroy()

void VBufBackend_t::destroy ( )
virtual

Destructs and deletes the backend.

Must be used rather than delete as this will handle crossing CRT boundaries.

Referenced by VBufRemote_destroyBuffer().

◆ reuseExistingNodeInRender()

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.

Member Data Documentation

◆ pendingInvalidSubtreesList

VBufStorage_controlFieldNodeList_t VBufBackend_t::pendingInvalidSubtreesList
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().

◆ workingInvalidSubtreesList

VBufStorage_controlFieldNodeList_t VBufBackend_t::workingInvalidSubtreesList
protected

The list of invalid subtrees currently being re-rendered by update.

Referenced by reuseExistingNodeInRender(), and update().

◆ runningBackends

◆ renderThreadID

const int VBufBackend_t::renderThreadID
protected

The thread ID of the rendering thread.

Referenced by initialize(), and terminate().

◆ rootDocHandle

const int VBufBackend_t::rootDocHandle

◆ rootID

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().

◆ lock


The documentation for this class was generated from the following files: