diff options
author | John-Mark Bell <jmb@netsurf-browser.org> | 2024-02-04 19:28:30 +0000 |
---|---|---|
committer | John-Mark Bell <jmb@netsurf-browser.org> | 2024-02-04 22:38:49 +0000 |
commit | 60d232cc848997789bbe97aaf09748ad7aedc224 (patch) | |
tree | 019c20e77977fdd2aba2a263ef255c7ebb0993f5 /content/handlers/html/box/manager.c | |
parent | abd621e972cfac28d2e4d9184c059df7d310aeae (diff) | |
download | netsurf-60d232cc848997789bbe97aaf09748ad7aedc224.tar.gz netsurf-60d232cc848997789bbe97aaf09748ad7aedc224.tar.bz2 |
HTML/Docs: flag node removal on subsequent element only
Diffstat (limited to 'content/handlers/html/box/manager.c')
-rw-r--r-- | content/handlers/html/box/manager.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/content/handlers/html/box/manager.c b/content/handlers/html/box/manager.c index c70e747bf..02db4ef48 100644 --- a/content/handlers/html/box/manager.c +++ b/content/handlers/html/box/manager.c @@ -215,7 +215,7 @@ _find_parent_element_or_document(dom_node *target) } static dom_exception -_foreach_element_sibling(dom_node *cur, +_next_element_sibling(dom_node *cur, dom_exception (*cb)(dom_node *, void *), void *pw) { dom_node *sibling = NULL; @@ -232,14 +232,15 @@ _foreach_element_sibling(dom_node *cur, if (exc == DOM_NO_ERR && sibling != NULL) { dom_node_type sibling_type; - exc = dom_node_get_node_type(sibling, &sibling_type); + cur = sibling; + sibling = NULL; + + exc = dom_node_get_node_type(cur, &sibling_type); if (exc == DOM_NO_ERR && sibling_type == DOM_ELEMENT_NODE) { - exc = cb(sibling, pw); + exc = cb(cur, pw); + break; } - - cur = sibling; - sibling = NULL; } } while (exc == DOM_NO_ERR && cur != NULL); @@ -333,8 +334,8 @@ box_manager_handle_dom_event(dom_event *evt, void *pw) if (target_type == DOM_ELEMENT_NODE) { /* Mark nodes as structurally changed */ if (computed_type == corestring_dom_DOMNodeRemoved) { - /* All subsequent sibling elements */ - exc = _foreach_element_sibling((dom_node *) target, + /* Node removed: subsequent sibling element */ + exc = _next_element_sibling((dom_node *) target, _set_node_flags, (void *) BM_DOM_FLAG_STRUCTURE_CHANGED); } else { |