Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: third_party/libxslt/libxslt/numbers.c

Issue 2411263002: Roll libxslt to 8345634c5482ca04293ae1862d52fa9dd764aeca (Closed)
Patch Set: config.log Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/libxslt/libxslt/attributes.c ('k') | third_party/libxslt/libxslt/preproc.c » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/libxslt/libxslt/numbers.c
diff --git a/third_party/libxslt/libxslt/numbers.c b/third_party/libxslt/libxslt/numbers.c
index 3b932a59ba55d0e744caf2327017e10aec95327b..e78c46b6357b7bc5f0cc4c523a6e359f8f86460b 100644
--- a/third_party/libxslt/libxslt/numbers.c
+++ b/third_party/libxslt/libxslt/numbers.c
@@ -616,25 +616,7 @@ xsltNumberFormatGetAnyLevel(xsltTransformContextPtr context,
{
int amount = 0;
int cnt = 0;
- xmlNodePtr cur;
-
- /* select the starting node */
- switch (node->type) {
- case XML_ELEMENT_NODE:
- cur = node;
- break;
- case XML_ATTRIBUTE_NODE:
- cur = ((xmlAttrPtr) node)->parent;
- break;
- case XML_TEXT_NODE:
- case XML_PI_NODE:
- case XML_COMMENT_NODE:
- cur = node->parent;
- break;
- default:
- cur = NULL;
- break;
- }
+ xmlNodePtr cur = node;
while (cur != NULL) {
/* process current node */
@@ -653,16 +635,25 @@ xsltNumberFormatGetAnyLevel(xsltTransformContextPtr context,
(cur->type == XML_HTML_DOCUMENT_NODE))
break; /* while */
- while ((cur->prev != NULL) && ((cur->prev->type == XML_DTD_NODE) ||
- (cur->prev->type == XML_XINCLUDE_START) ||
- (cur->prev->type == XML_XINCLUDE_END)))
- cur = cur->prev;
- if (cur->prev != NULL) {
- for (cur = cur->prev; cur->last != NULL; cur = cur->last);
- } else {
- cur = cur->parent;
- }
-
+ if (cur->type == XML_NAMESPACE_DECL) {
+ /*
+ * The XPath module stores the parent of a namespace node in
+ * the ns->next field.
+ */
+ cur = (xmlNodePtr) ((xmlNsPtr) cur)->next;
+ } else if (cur->type == XML_ATTRIBUTE_NODE) {
+ cur = cur->parent;
+ } else {
+ while ((cur->prev != NULL) && ((cur->prev->type == XML_DTD_NODE) ||
+ (cur->prev->type == XML_XINCLUDE_START) ||
+ (cur->prev->type == XML_XINCLUDE_END)))
+ cur = cur->prev;
+ if (cur->prev != NULL) {
+ for (cur = cur->prev; cur->last != NULL; cur = cur->last);
+ } else {
+ cur = cur->parent;
+ }
+ }
}
array[amount++] = (double) cnt;
« no previous file with comments | « third_party/libxslt/libxslt/attributes.c ('k') | third_party/libxslt/libxslt/preproc.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698