mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 18:02:56 +00:00
[LIBXML2] Update to version 2.9.13. CORE-17766
This commit is contained in:
parent
df1adce32c
commit
7244e0c5c6
35 changed files with 1127 additions and 20110 deletions
52
sdk/lib/3rdparty/libxml2/HTMLtree.c
vendored
52
sdk/lib/3rdparty/libxml2/HTMLtree.c
vendored
|
@ -744,7 +744,7 @@ void
|
|||
htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
||||
xmlNodePtr cur, const char *encoding ATTRIBUTE_UNUSED,
|
||||
int format) {
|
||||
xmlNodePtr root;
|
||||
xmlNodePtr root, parent;
|
||||
xmlAttrPtr attr;
|
||||
const htmlElemDesc * info;
|
||||
|
||||
|
@ -755,6 +755,7 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
|||
}
|
||||
|
||||
root = cur;
|
||||
parent = cur->parent;
|
||||
while (1) {
|
||||
switch (cur->type) {
|
||||
case XML_HTML_DOCUMENT_NODE:
|
||||
|
@ -763,12 +764,28 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
|||
htmlDtdDumpOutput(buf, (xmlDocPtr) cur, NULL);
|
||||
}
|
||||
if (cur->children != NULL) {
|
||||
cur = cur->children;
|
||||
continue;
|
||||
/* Always validate cur->parent when descending. */
|
||||
if (cur->parent == parent) {
|
||||
parent = cur;
|
||||
cur = cur->children;
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
xmlOutputBufferWriteString(buf, "\n");
|
||||
}
|
||||
break;
|
||||
|
||||
case XML_ELEMENT_NODE:
|
||||
/*
|
||||
* Some users like lxml are known to pass nodes with a corrupted
|
||||
* tree structure. Fall back to a recursive call to handle this
|
||||
* case.
|
||||
*/
|
||||
if ((cur->parent != parent) && (cur->children != NULL)) {
|
||||
htmlNodeDumpFormatOutput(buf, doc, cur, encoding, format);
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* Get specific HTML info for that node.
|
||||
*/
|
||||
|
@ -817,6 +834,7 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
|||
(cur->name != NULL) &&
|
||||
(cur->name[0] != 'p')) /* p, pre, param */
|
||||
xmlOutputBufferWriteString(buf, "\n");
|
||||
parent = cur;
|
||||
cur = cur->children;
|
||||
continue;
|
||||
}
|
||||
|
@ -825,9 +843,9 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
|||
(info != NULL) && (!info->isinline)) {
|
||||
if ((cur->next->type != HTML_TEXT_NODE) &&
|
||||
(cur->next->type != HTML_ENTITY_REF_NODE) &&
|
||||
(cur->parent != NULL) &&
|
||||
(cur->parent->name != NULL) &&
|
||||
(cur->parent->name[0] != 'p')) /* p, pre, param */
|
||||
(parent != NULL) &&
|
||||
(parent->name != NULL) &&
|
||||
(parent->name[0] != 'p')) /* p, pre, param */
|
||||
xmlOutputBufferWriteString(buf, "\n");
|
||||
}
|
||||
|
||||
|
@ -842,9 +860,9 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
|||
break;
|
||||
if (((cur->name == (const xmlChar *)xmlStringText) ||
|
||||
(cur->name != (const xmlChar *)xmlStringTextNoenc)) &&
|
||||
((cur->parent == NULL) ||
|
||||
((xmlStrcasecmp(cur->parent->name, BAD_CAST "script")) &&
|
||||
(xmlStrcasecmp(cur->parent->name, BAD_CAST "style"))))) {
|
||||
((parent == NULL) ||
|
||||
((xmlStrcasecmp(parent->name, BAD_CAST "script")) &&
|
||||
(xmlStrcasecmp(parent->name, BAD_CAST "style"))))) {
|
||||
xmlChar *buffer;
|
||||
|
||||
buffer = xmlEncodeEntitiesReentrant(doc, cur->content);
|
||||
|
@ -902,13 +920,9 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
|||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* The parent should never be NULL here but we want to handle
|
||||
* corrupted documents gracefully.
|
||||
*/
|
||||
if (cur->parent == NULL)
|
||||
return;
|
||||
cur = cur->parent;
|
||||
cur = parent;
|
||||
/* cur->parent was validated when descending. */
|
||||
parent = cur->parent;
|
||||
|
||||
if ((cur->type == XML_HTML_DOCUMENT_NODE) ||
|
||||
(cur->type == XML_DOCUMENT_NODE)) {
|
||||
|
@ -939,9 +953,9 @@ htmlNodeDumpFormatOutput(xmlOutputBufferPtr buf, xmlDocPtr doc,
|
|||
(cur->next != NULL)) {
|
||||
if ((cur->next->type != HTML_TEXT_NODE) &&
|
||||
(cur->next->type != HTML_ENTITY_REF_NODE) &&
|
||||
(cur->parent != NULL) &&
|
||||
(cur->parent->name != NULL) &&
|
||||
(cur->parent->name[0] != 'p')) /* p, pre, param */
|
||||
(parent != NULL) &&
|
||||
(parent->name != NULL) &&
|
||||
(parent->name[0] != 'p')) /* p, pre, param */
|
||||
xmlOutputBufferWriteString(buf, "\n");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue