Piotr Caban : msxml3: Store information about ignorrable whitespace nodes in xmlNode._private variable.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Dec 21 15:10:33 CST 2015


Module: wine
Branch: master
Commit: bc0eca60c6e13c3ab74c1988c83e20266e14ea2c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bc0eca60c6e13c3ab74c1988c83e20266e14ea2c

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Mon Dec 21 11:41:18 2015 +0100

msxml3: Store information about ignorrable whitespace nodes in xmlNode._private variable.

Signed-off-by: Piotr Caban <piotr at codeweavers.com>
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/msxml3/domdoc.c        | 7 +++++++
 dlls/msxml3/msxml_private.h | 3 +++
 dlls/msxml3/node.c          | 5 +++--
 3 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c
index 184a01f..e9f2504 100644
--- a/dlls/msxml3/domdoc.c
+++ b/dlls/msxml3/domdoc.c
@@ -448,7 +448,14 @@ static void sax_characters(void *ctx, const xmlChar *ch, int len)
             (!ctxt->node->last ||
             ((ctxt->node->last && (cur == '<' || ctxt->node->last->type != XML_TEXT_NODE))
            )))
+        {
+            /* Keep information about ignorable whitespace text node in previous or parent node */
+            if (ctxt->node->last)
+                *(DWORD*)&ctxt->node->last->_private |= NODE_PRIV_TRAILING_IGNORABLE_WS;
+            else if (ctxt->node->type != XML_DOCUMENT_NODE)
+                *(DWORD*)&ctxt->node->_private |= NODE_PRIV_CHILD_IGNORABLE_WS;
             return;
+        }
     }
 
     xmlSAX2Characters(ctxt, ch, len);
diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h
index 6c0376f..56be916 100644
--- a/dlls/msxml3/msxml_private.h
+++ b/dlls/msxml3/msxml_private.h
@@ -559,4 +559,7 @@ HRESULT detach_bsc(bsc_t*) DECLSPEC_HIDDEN;
 /* ... */
 #define E_XML_REQUIRED_ATTRIBUTE_MISSING    0xC00CE020
 
+#define NODE_PRIV_TRAILING_IGNORABLE_WS     0x40000000
+#define NODE_PRIV_CHILD_IGNORABLE_WS        0x80000000
+#define NODE_PRIV_REFCOUNT_MASK             ~(NODE_PRIV_TRAILING_IGNORABLE_WS|NODE_PRIV_CHILD_IGNORABLE_WS)
 #endif /* __MSXML_PRIVATE__ */
diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index 9c768bd..8914e05 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -398,7 +398,7 @@ HRESULT node_get_next_sibling(xmlnode *This, IXMLDOMNode **ret)
 
 static int node_get_inst_cnt(xmlNodePtr node)
 {
-    int ret = *(LONG *)&node->_private;
+    int ret = *(LONG *)&node->_private & NODE_PRIV_REFCOUNT_MASK;
     xmlNodePtr child;
 
     /* add attribute counts */
@@ -429,7 +429,8 @@ int xmlnode_get_inst_cnt(xmlnode *node)
     return node_get_inst_cnt(node->node);
 }
 
-/* _private field holds a number of COM instances spawned from this libxml2 node */
+/* _private field holds a number of COM instances spawned from this libxml2 node
+ * most significant bits are used to store information about ignorrable whitespace nodes */
 static void xmlnode_add_ref(xmlNodePtr node)
 {
     if (node->type == XML_DOCUMENT_NODE) return;




More information about the wine-cvs mailing list