Gitweb links:
...log
http://git.netsurf-browser.org/libdom.git/shortlog/42bf19d6fe00cb29824b5bc86759183e5a832db6
...commit
http://git.netsurf-browser.org/libdom.git/commit/42bf19d6fe00cb29824b5bc86759183e5a832db6
...tree
http://git.netsurf-browser.org/libdom.git/tree/42bf19d6fe00cb29824b5bc86759183e5a832db6
The branch, master has been updated
via 42bf19d6fe00cb29824b5bc86759183e5a832db6 (commit)
from a1cb751bb8579a9071b255aa3c89abce0394b206 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/libdom.git/commit/?id=42bf19d6fe00cb29824b5bc86759183e5a832db6
commit 42bf19d6fe00cb29824b5bc86759183e5a832db6
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
DOM Document: Fix find by ID, when called with global tree root.
Fixes: NetSurf bug #2466.
diff --git a/src/core/document.c b/src/core/document.c
index 14fd1b9..7c0bcdc 100644
--- a/src/core/document.c
+++ b/src/core/document.c
@@ -1393,23 +1393,23 @@ dom_exception _dom_find_element_by_id(dom_node_internal
*root,
}
if (node->first_child != NULL) {
- /* Has children */
+ /* Move to child */
node = node->first_child;
- } else if (node->next != NULL) {
- /* No children, but has siblings */
- node = node->next;
} else {
- /* No children or siblings.
- * Find first unvisited relation. */
- dom_node_internal *parent = node->parent;
-
- while (parent != root &&
- node == parent->last_child) {
- node = parent;
- parent = parent->parent;
+ while (node != NULL) {
+ if (node->next != NULL) {
+ /* Move to next sibling */
+ node = node->next;
+ break;
+ } else if (node->parent != root) {
+ /* Move back up to ancestors to
+ * get to next siblings */
+ node = node->parent;
+ } else {
+ /* No more nodes below root. */
+ node = NULL;
+ }
}
-
- node = node->next;
}
}
-----------------------------------------------------------------------
Summary of changes:
src/core/document.c | 28 ++++++++++++++--------------
1 file changed, 14 insertions(+), 14 deletions(-)
diff --git a/src/core/document.c b/src/core/document.c
index 14fd1b9..7c0bcdc 100644
--- a/src/core/document.c
+++ b/src/core/document.c
@@ -1393,23 +1393,23 @@ dom_exception _dom_find_element_by_id(dom_node_internal
*root,
}
if (node->first_child != NULL) {
- /* Has children */
+ /* Move to child */
node = node->first_child;
- } else if (node->next != NULL) {
- /* No children, but has siblings */
- node = node->next;
} else {
- /* No children or siblings.
- * Find first unvisited relation. */
- dom_node_internal *parent = node->parent;
-
- while (parent != root &&
- node == parent->last_child) {
- node = parent;
- parent = parent->parent;
+ while (node != NULL) {
+ if (node->next != NULL) {
+ /* Move to next sibling */
+ node = node->next;
+ break;
+ } else if (node->parent != root) {
+ /* Move back up to ancestors to
+ * get to next siblings */
+ node = node->parent;
+ } else {
+ /* No more nodes below root. */
+ node = NULL;
+ }
}
-
- node = node->next;
}
}
--
Document Object Model library
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org