OSDN Git Service

VBufStorage: make the getters for parent, previous, next, firstChild and lastChild...
authorMichael Curran <mick@kulgan.net>
Wed, 7 Nov 2012 05:30:33 +0000 (15:30 +1000)
committerMichael Curran <mick@kulgan.net>
Wed, 7 Nov 2012 05:30:33 +0000 (15:30 +1000)
nvdaHelper/vbufBackends/adobeAcrobat/adobeAcrobat.cpp
nvdaHelper/vbufBackends/gecko_ia2/gecko_ia2.cpp
nvdaHelper/vbufBackends/mshtml/mshtml.cpp
nvdaHelper/vbufBase/backend.cpp
nvdaHelper/vbufBase/storage.cpp
nvdaHelper/vbufBase/storage.h

index 8b9a697..8bc5a23 100644 (file)
@@ -429,7 +429,7 @@ AdobeAcrobatVBufStorage_controlFieldNode_t* AdobeAcrobatVBufBackend_t::fillVBuf(
                        parentNode->addAttribute(L"acrobat::stdname", stdName);\r
                        if (wcscmp(stdName, L"Span") == 0 || wcscmp(stdName, L"Link") == 0 || wcscmp(stdName, L"Quote") == 0) {\r
                                // This is an inline element.\r
-                               parentNode->setIsBlock(false);\r
+                               parentNode->isBlock=false;\r
                        }\r
                }\r
 \r
@@ -640,7 +640,7 @@ AdobeAcrobatVBufStorage_controlFieldNode_t* AdobeAcrobatVBufBackend_t::fillVBuf(
                // No children, so this is a leaf node.\r
                if (!this->isXFA && !stdName) {\r
                        // Non-XFA leaf nodes with no stdName are inline.\r
-                       parentNode->setIsBlock(false);\r
+                       parentNode->isBlock=false;\r
                }\r
 \r
                // Get the name.\r
@@ -700,7 +700,7 @@ AdobeAcrobatVBufStorage_controlFieldNode_t* AdobeAcrobatVBufBackend_t::fillVBuf(
                // Always render a space for empty table cells.\r
                previousNode=buffer->addTextFieldNode(parentNode,previousNode,L" ");\r
                addAttrsToTextNode(previousNode);\r
-               parentNode->setIsBlock(false);\r
+               parentNode->isBlock=false;\r
        } else if (role == ROLE_SYSTEM_TABLE) {\r
                nhAssert(tableInfo);\r
                for (list<pair<AdobeAcrobatVBufStorage_controlFieldNode_t*, wstring>>::iterator it = tableInfo->nodesWithExplicitHeaders.begin(); it != tableInfo->nodesWithExplicitHeaders.end(); ++it)\r
index d6dda56..45ba9b8 100755 (executable)
@@ -374,7 +374,7 @@ VBufStorage_fieldNode_t* GeckoVBufBackend_t::fillVBuf(IAccessible2* pacc,
        } else {\r
                isBlockElement=FALSE;\r
        }\r
-       parentNode->setIsBlock(isBlockElement);\r
+       parentNode->isBlock=isBlockElement;\r
 \r
        BSTR name=NULL;\r
        if(pacc->get_accName(varChild,&name)!=S_OK)\r
@@ -692,7 +692,7 @@ VBufStorage_fieldNode_t* GeckoVBufBackend_t::fillVBuf(IAccessible2* pacc,
                        // Always render a space for empty table cells and unknowns.\r
                        previousNode=buffer->addTextFieldNode(parentNode,previousNode,L" ");\r
                        if(previousNode&&!locale.empty()) previousNode->addAttribute(L"language",locale);\r
-                       parentNode->setIsBlock(false);\r
+                       parentNode->isBlock=false;\r
                }\r
 \r
                if ((isInteractive || role == ROLE_SYSTEM_SEPARATOR) && parentNode->getLength() == 0) {\r
index 1dc6895..f0a7ba4 100755 (executable)
@@ -642,14 +642,14 @@ wostringstream tempStringStream;
                tempStringStream<<ID;\r
                attribsMap[L"table-id"]=tempStringStream.str();\r
        } else if(tableInfo&&(nodeName.compare(L"THEAD")==0||nodeName.compare(L"TBODY")==0||nodeName.compare(L"TFOOT")==0)) {\r
-               parentNode->setUpdateAncestor(tableInfo->tableNode);\r
+               parentNode->updateAncestor=tableInfo->tableNode;\r
        } else if(tableInfo&&nodeName.compare(L"TR")==0) {\r
                ++tableInfo->curRowNumber;\r
                tableInfo->curColumnNumber = 0;\r
-               parentNode->setUpdateAncestor(tableInfo->tableNode);\r
+               parentNode->updateAncestor=tableInfo->tableNode;\r
        } if(tableInfo&&(nodeName.compare(L"TD")==0||nodeName.compare(L"TH")==0)) {\r
                ++tableInfo->curColumnNumber;\r
-               parentNode->setUpdateAncestor(tableInfo->tableNode);\r
+               parentNode->updateAncestor=tableInfo->tableNode;\r
                handleColsSpannedByPrevRows(*tableInfo);\r
                tempStringStream.str(L"");\r
                tempStringStream<<tableInfo->tableID;\r
@@ -743,7 +743,7 @@ VBufStorage_fieldNode_t* MshtmlVBufBackend_t::fillVBuf(VBufStorage_buffer_t* buf
 \r
        //Handle text nodes\r
        if(!shouldSkipText) { \r
-               wstring s=getTextFromHTMLDOMNode(pHTMLDOMNode,allowPreformattedText,(parentNode&&parentNode->getIsBlock()&&!previousNode));\r
+               wstring s=getTextFromHTMLDOMNode(pHTMLDOMNode,allowPreformattedText,(parentNode&&parentNode->isBlock&&!previousNode));\r
                if(!s.empty()) {\r
                        LOG_DEBUG(L"Got text from node");\r
                        VBufStorage_textFieldNode_t* textNode=buffer->addTextFieldNode(parentNode,previousNode,s);\r
@@ -859,7 +859,7 @@ VBufStorage_fieldNode_t* MshtmlVBufBackend_t::fillVBuf(VBufStorage_buffer_t* buf
        nhAssert(parentNode);\r
        previousNode=NULL;\r
 \r
-       parentNode->setIsHidden(hidden||dontRender);\r
+       parentNode->isHidden=(hidden||dontRender);\r
        //We do not want to render any content for dontRender nodes\r
        if(dontRender) {\r
                return parentNode;\r
@@ -1209,7 +1209,7 @@ VBufStorage_fieldNode_t* MshtmlVBufBackend_t::fillVBuf(VBufStorage_buffer_t* buf
        }\r
 \r
        //Update block setting on node\r
-       parentNode->setIsBlock(isBlock);\r
+       parentNode->isBlock=isBlock;\r
 \r
        //Add all the collected attributes to the node\r
        for(tempIter=attribsMap.begin();tempIter!=attribsMap.end();++tempIter) {\r
index c09709c..c24afdd 100644 (file)
@@ -130,8 +130,7 @@ void VBufBackend_t::renderThread_terminate() {
 }\r
 \r
 bool VBufBackend_t::invalidateSubtree(VBufStorage_controlFieldNode_t* node) {\r
-       VBufStorage_controlFieldNode_t* updateAncestor=node->getUpdateAncestor();\r
-       if(updateAncestor) node=updateAncestor;\r
+       if(node->updateAncestor) node=node->updateAncestor;\r
        if(!isNodeInBuffer(node)) {\r
                LOG_DEBUGWARNING(L"Node at "<<node<<L" not in buffer at "<<this);\r
                return false;\r
index 74a0c14..7a9854a 100644 (file)
@@ -292,36 +292,6 @@ VBufStorage_fieldNode_t::~VBufStorage_fieldNode_t() {
        LOG_DEBUG(L"fieldNode being destroied");\r
 }\r
 \r
-VBufStorage_controlFieldNode_t* VBufStorage_fieldNode_t::getParent() {\r
-       LOG_DEBUG(L"parent at "<<parent);\r
-       return parent;\r
-}\r
-\r
-VBufStorage_controlFieldNode_t* VBufStorage_fieldNode_t::getUpdateAncestor() {\r
-       LOG_DEBUG(L"updateAncestor at "<<updateAncestor);\r
-       return updateAncestor;\r
-}\r
-\r
-VBufStorage_fieldNode_t* VBufStorage_fieldNode_t::getPrevious() {\r
-       LOG_DEBUG(L"previous at "<<previous);\r
-       return previous;\r
-}\r
-\r
-VBufStorage_fieldNode_t* VBufStorage_fieldNode_t::getNext() {\r
-       LOG_DEBUG(L"next at "<<next);\r
-       return next;\r
-}\r
-\r
-VBufStorage_fieldNode_t* VBufStorage_fieldNode_t::getFirstChild() {\r
-       LOG_DEBUG(L"first child at "<<firstChild);\r
-       return firstChild;\r
-}\r
-\r
-VBufStorage_fieldNode_t* VBufStorage_fieldNode_t::getLastChild() {\r
-       LOG_DEBUG(L"last child at "<<lastChild);\r
-       return lastChild;\r
-}\r
-\r
 bool VBufStorage_fieldNode_t::addAttribute(const std::wstring& name, const std::wstring& value) {\r
        LOG_DEBUG(L"Adding attribute "<<name<<L" with value "<<value);\r
        this->attributes[name]=value;\r
@@ -345,22 +315,6 @@ std::wstring VBufStorage_fieldNode_t::getDebugInfo() const {
        return s.str();\r
 }\r
 \r
-void VBufStorage_fieldNode_t::setIsBlock(bool isBlock) {\r
-       this->isBlock=isBlock;\r
-}\r
-\r
-void VBufStorage_fieldNode_t::setIsHidden(bool isHidden) {\r
-       this->isHidden=isHidden;\r
-}\r
-\r
-void VBufStorage_fieldNode_t::setUpdateAncestor(VBufStorage_controlFieldNode_t* node) {\r
-       this->updateAncestor=node;\r
-}\r
-\r
-int VBufStorage_fieldNode_t::getLength() {\r
-               return this->length;\r
-       }\r
-\r
 //controlFieldNode implementation\r
 \r
 void VBufStorage_controlFieldNode_t::generateMarkupTagName(std::wstring& text) {\r
index 35c2eef..4f68c51 100644 (file)
@@ -137,21 +137,6 @@ class VBufStorage_fieldNode_t {
        int length;\r
 \r
 /**\r
- * true if this field should cause a line break at its start and end when a buffer is calculating lines.\r
- */\r
-       bool isBlock;\r
-\r
-       /**\r
-       * True if this node his hidden - searches will not locate this node.\r
-       */\r
-       bool isHidden;\r
-\r
-/**\r
- * points to an optional ancestor node which should be re-rendered instead of this node, if this node changes.\r
- */\r
-       VBufStorage_controlFieldNode_t* updateAncestor;\r
-\r
-       /**\r
  * a map to hold attributes for this field.\r
  */\r
        VBufStorage_attributeMap_t attributes;\r
@@ -237,32 +222,48 @@ class VBufStorage_fieldNode_t {
        public:\r
 \r
 /**\r
+ * true if this field should cause a line break at its start and end when a buffer is calculating lines.\r
+ */\r
+       bool isBlock;\r
+\r
+       /**\r
+       * True if this node his hidden - searches will not locate this node.\r
+       */\r
+       bool isHidden;\r
+\r
+/**\r
+ * points to an optional ancestor node which should be re-rendered instead of this node, if this node changes.\r
+ */\r
+       VBufStorage_controlFieldNode_t* updateAncestor;\r
+\r
+/**\r
  * points to this node's parent control field node.\r
  * it is garenteed that this node will be one of the parent's children (firstChild [next next...] or lastChild [previous previous...]).\r
  */\r
-       VBufStorage_controlFieldNode_t* getParent();\r
+       inline VBufStorage_controlFieldNode_t* getParent() { return this->parent; }\r
 \r
 /**\r
  * points to the node directly before this node that shares the same parent as this node. \r
  */\r
-       VBufStorage_fieldNode_t* getPrevious();\r
+       inline VBufStorage_fieldNode_t* getPrevious() { return this->previous; }\r
 \r
 /**\r
  * points to the node directly after this node that shares the same parent as this node.\r
  */\r
-       VBufStorage_fieldNode_t* getNext();\r
+       inline VBufStorage_fieldNode_t* getNext() { return this->next; }\r
+\r
 \r
 /**\r
  * points to this node's first child. \r
  * The child will have no previous node, and it will have this node as its parent.\r
  */\r
-       VBufStorage_fieldNode_t* getFirstChild();\r
+       inline VBufStorage_fieldNode_t* getFirstChild() { return this->firstChild; }\r
 \r
 /**\r
  * points to this node's last child.\r
  * the child will have no next node, and it will have this node as its parent.\r
  */\r
-       VBufStorage_fieldNode_t* getLastChild();\r
+       inline VBufStorage_fieldNode_t* getLastChild() { return this->lastChild; }\r
 \r
 /**\r
  * Adds an attribute to this field.\r
@@ -293,40 +294,9 @@ class VBufStorage_fieldNode_t {
        virtual std::wstring getDebugInfo() const;\r
 \r
 /**\r
- * Set whether this field is a block element.\r
- * If this is true, this field should cause a line break at its start and end when a buffer is calculating lines.\r
- * @param isBlock true if this field is a block element, false otherwise.\r
- */\r
-       void setIsBlock(bool isBlock);\r
-\r
-/**\r
- * Set whether this field is a hidden node.\r
- * If this is true, this field should not be found when searching by attributes.\r
- * @param isBlock true if this field is a hidden element, false otherwise.\r
- */\r
-       void setIsHidden(bool isHidden);\r
-\r
-/**\r
- * points to an optional ancestor node which should be re-rendered instead of this node, if this node changes.\r
- */\r
-       VBufStorage_controlFieldNode_t* getUpdateAncestor();\r
-\r
-/**\r
- * points to an optional ancestor node which should be re-rendered instead of this node, if this node changes.\r
- */\r
-       void setUpdateAncestor(VBufStorage_controlFieldNode_t* updateAncestor);\r
-\r
-/**\r
- * Getter for isBlock\r
- */\r
-       bool getIsBlock() {\r
-               return isBlock;\r
-       }\r
-\r
-/**\r
  * Retreave the length of this node.\r
  */\r
-       int getLength();\r
+       inline int getLength() { return this->length; }\r
 \r
 };\r
 \r