From: Piotr Caban Subject: [PATCH 3/6 v2] msxml3: Store information about ignorrable whitespace nodes in xmlNode._private variable Message-Id: <564ECDFB.3050007@codeweavers.com> Date: Fri, 20 Nov 2015 08:38:35 +0100 Signed-off-by: Piotr Caban --- 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;