Lines Matching refs:node

45 lxb_dom_node_by_tag_name_cb(lxb_dom_node_t *node, void *ctx);
48 lxb_dom_node_by_tag_name_cb_all(lxb_dom_node_t *node, void *ctx);
51 lxb_dom_node_by_class_name_cb(lxb_dom_node_t *node, void *ctx);
54 lxb_dom_node_by_attr_cb(lxb_dom_node_t *node, void *ctx);
82 lxb_dom_node_text_content_size(lxb_dom_node_t *node, void *ctx);
85 lxb_dom_node_text_content_concatenate(lxb_dom_node_t *node, void *ctx);
107 const lxb_dom_node_t *node, bool is_attr) in lxb_dom_node_interface_clone() argument
116 if (lxb_dom_node_interface_copy(new, node, is_attr) != LXB_STATUS_OK) { in lxb_dom_node_interface_clone()
124 lxb_dom_node_interface_destroy(lxb_dom_node_t *node) in lxb_dom_node_interface_destroy() argument
126 lxb_dom_document_t *doc = node->owner_document; in lxb_dom_node_interface_destroy()
129 doc->ev_destroy(node); in lxb_dom_node_interface_destroy()
132 return lexbor_mraw_free(node->owner_document->mraw, node); in lxb_dom_node_interface_destroy()
248 lxb_dom_node_destroy(lxb_dom_node_t *node) in lxb_dom_node_destroy() argument
250 lxb_dom_node_remove(node); in lxb_dom_node_destroy()
252 if (node->owner_document->ev_destroy != NULL) { in lxb_dom_node_destroy()
253 node->owner_document->ev_destroy(node); in lxb_dom_node_destroy()
256 return lxb_dom_document_destroy_interface(node); in lxb_dom_node_destroy()
263 lxb_dom_node_t *node = root; in lxb_dom_node_destroy_deep() local
265 while (node != NULL) { in lxb_dom_node_destroy_deep()
266 if (node->first_child != NULL) { in lxb_dom_node_destroy_deep()
267 node = node->first_child; in lxb_dom_node_destroy_deep()
270 while(node != root && node->next == NULL) { in lxb_dom_node_destroy_deep()
271 tmp = node->parent; in lxb_dom_node_destroy_deep()
273 lxb_dom_node_destroy(node); in lxb_dom_node_destroy_deep()
275 node = tmp; in lxb_dom_node_destroy_deep()
278 if (node == root) { in lxb_dom_node_destroy_deep()
279 lxb_dom_node_destroy(node); in lxb_dom_node_destroy_deep()
284 tmp = node->next; in lxb_dom_node_destroy_deep()
286 lxb_dom_node_destroy(node); in lxb_dom_node_destroy_deep()
288 node = tmp; in lxb_dom_node_destroy_deep()
296 lxb_dom_node_clone(lxb_dom_node_t *node, bool deep) in lxb_dom_node_clone() argument
298 return lxb_dom_document_import_node(node->owner_document, node, deep); in lxb_dom_node_clone()
302 lxb_dom_node_name(lxb_dom_node_t *node, size_t *len) in lxb_dom_node_name() argument
304 switch (node->type) { in lxb_dom_node_name()
306 return lxb_dom_element_tag_name(lxb_dom_interface_element(node), in lxb_dom_node_name()
310 return lxb_dom_attr_qualified_name(lxb_dom_interface_attr(node), in lxb_dom_node_name()
328 … return lxb_dom_processing_instruction_target(lxb_dom_interface_processing_instruction(node), in lxb_dom_node_name()
346 return lxb_dom_document_type_name(lxb_dom_interface_document_type(node), in lxb_dom_node_name()
368 lxb_dom_node_insert_child_wo_events(lxb_dom_node_t *to, lxb_dom_node_t *node) in lxb_dom_node_insert_child_wo_events() argument
371 to->last_child->next = node; in lxb_dom_node_insert_child_wo_events()
374 to->first_child = node; in lxb_dom_node_insert_child_wo_events()
377 node->parent = to; in lxb_dom_node_insert_child_wo_events()
378 node->next = NULL; in lxb_dom_node_insert_child_wo_events()
379 node->prev = to->last_child; in lxb_dom_node_insert_child_wo_events()
381 to->last_child = node; in lxb_dom_node_insert_child_wo_events()
385 lxb_dom_node_insert_child(lxb_dom_node_t *to, lxb_dom_node_t *node) in lxb_dom_node_insert_child() argument
387 lxb_dom_node_insert_child_wo_events(to, node); in lxb_dom_node_insert_child()
389 if (node->owner_document->ev_insert != NULL) { in lxb_dom_node_insert_child()
390 node->owner_document->ev_insert(node); in lxb_dom_node_insert_child()
395 lxb_dom_node_insert_before_wo_events(lxb_dom_node_t *to, lxb_dom_node_t *node) in lxb_dom_node_insert_before_wo_events() argument
398 to->prev->next = node; in lxb_dom_node_insert_before_wo_events()
402 to->parent->first_child = node; in lxb_dom_node_insert_before_wo_events()
406 node->parent = to->parent; in lxb_dom_node_insert_before_wo_events()
407 node->next = to; in lxb_dom_node_insert_before_wo_events()
408 node->prev = to->prev; in lxb_dom_node_insert_before_wo_events()
410 to->prev = node; in lxb_dom_node_insert_before_wo_events()
414 lxb_dom_node_insert_before(lxb_dom_node_t *to, lxb_dom_node_t *node) in lxb_dom_node_insert_before() argument
416 lxb_dom_node_insert_before_wo_events(to, node); in lxb_dom_node_insert_before()
418 if (node->owner_document->ev_insert != NULL) { in lxb_dom_node_insert_before()
419 node->owner_document->ev_insert(node); in lxb_dom_node_insert_before()
424 lxb_dom_node_insert_after_wo_events(lxb_dom_node_t *to, lxb_dom_node_t *node) in lxb_dom_node_insert_after_wo_events() argument
427 to->next->prev = node; in lxb_dom_node_insert_after_wo_events()
431 to->parent->last_child = node; in lxb_dom_node_insert_after_wo_events()
435 node->parent = to->parent; in lxb_dom_node_insert_after_wo_events()
436 node->next = to->next; in lxb_dom_node_insert_after_wo_events()
437 node->prev = to; in lxb_dom_node_insert_after_wo_events()
438 to->next = node; in lxb_dom_node_insert_after_wo_events()
442 lxb_dom_node_insert_after(lxb_dom_node_t *to, lxb_dom_node_t *node) in lxb_dom_node_insert_after() argument
444 lxb_dom_node_insert_after_wo_events(to, node); in lxb_dom_node_insert_after()
446 if (node->owner_document->ev_insert != NULL) { in lxb_dom_node_insert_after()
447 node->owner_document->ev_insert(node); in lxb_dom_node_insert_after()
452 lxb_dom_node_remove_wo_events(lxb_dom_node_t *node) in lxb_dom_node_remove_wo_events() argument
454 if (node->parent != NULL) { in lxb_dom_node_remove_wo_events()
455 if (node->parent->first_child == node) { in lxb_dom_node_remove_wo_events()
456 node->parent->first_child = node->next; in lxb_dom_node_remove_wo_events()
459 if (node->parent->last_child == node) { in lxb_dom_node_remove_wo_events()
460 node->parent->last_child = node->prev; in lxb_dom_node_remove_wo_events()
464 if (node->next != NULL) { in lxb_dom_node_remove_wo_events()
465 node->next->prev = node->prev; in lxb_dom_node_remove_wo_events()
468 if (node->prev != NULL) { in lxb_dom_node_remove_wo_events()
469 node->prev->next = node->next; in lxb_dom_node_remove_wo_events()
472 node->parent = NULL; in lxb_dom_node_remove_wo_events()
473 node->next = NULL; in lxb_dom_node_remove_wo_events()
474 node->prev = NULL; in lxb_dom_node_remove_wo_events()
478 lxb_dom_node_remove(lxb_dom_node_t *node) in lxb_dom_node_remove() argument
480 if (node->owner_document->ev_remove != NULL) { in lxb_dom_node_remove()
481 node->owner_document->ev_remove(node); in lxb_dom_node_remove()
484 lxb_dom_node_remove_wo_events(node); in lxb_dom_node_remove()
488 lxb_dom_node_replace_all(lxb_dom_node_t *parent, lxb_dom_node_t *node) in lxb_dom_node_replace_all() argument
494 lxb_dom_node_insert_child(parent, node); in lxb_dom_node_replace_all()
504 lxb_dom_node_t *node = root->first_child; in lxb_dom_node_simple_walk() local
506 while (node != NULL) { in lxb_dom_node_simple_walk()
507 action = walker_cb(node, ctx); in lxb_dom_node_simple_walk()
512 if (node->first_child != NULL && action != LEXBOR_ACTION_NEXT) { in lxb_dom_node_simple_walk()
513 node = node->first_child; in lxb_dom_node_simple_walk()
516 while(node != root && node->next == NULL) { in lxb_dom_node_simple_walk()
517 node = node->parent; in lxb_dom_node_simple_walk()
520 if (node == root) { in lxb_dom_node_simple_walk()
524 node = node->next; in lxb_dom_node_simple_walk()
659 lxb_dom_node_by_tag_name_cb_all(lxb_dom_node_t *node, void *ctx) in lxb_dom_node_by_tag_name_cb_all() argument
661 if (node->type != LXB_DOM_NODE_TYPE_ELEMENT) { in lxb_dom_node_by_tag_name_cb_all()
667 cb_ctx->status = lxb_dom_collection_append(cb_ctx->col, node); in lxb_dom_node_by_tag_name_cb_all()
676 lxb_dom_node_by_tag_name_cb(lxb_dom_node_t *node, void *ctx) in lxb_dom_node_by_tag_name_cb() argument
678 if (node->type != LXB_DOM_NODE_TYPE_ELEMENT) { in lxb_dom_node_by_tag_name_cb()
684 if (node->local_name == cb_ctx->name_id in lxb_dom_node_by_tag_name_cb()
685 && node->prefix == cb_ctx->prefix_id) in lxb_dom_node_by_tag_name_cb()
687 cb_ctx->status = lxb_dom_collection_append(cb_ctx->col, node); in lxb_dom_node_by_tag_name_cb()
718 lxb_dom_node_by_class_name_cb(lxb_dom_node_t *node, void *ctx) in lxb_dom_node_by_class_name_cb() argument
720 if (node->type != LXB_DOM_NODE_TYPE_ELEMENT) { in lxb_dom_node_by_class_name_cb()
725 lxb_dom_element_t *el = lxb_dom_interface_element(node); in lxb_dom_node_by_class_name_cb()
741 lxb_dom_document_t *doc = el->node.owner_document; in lxb_dom_node_by_class_name_cb()
758 node); in lxb_dom_node_by_class_name_cb()
786 cb_ctx->status = lxb_dom_collection_append(cb_ctx->col, node); in lxb_dom_node_by_class_name_cb()
941 lxb_dom_node_by_attr_cb(lxb_dom_node_t *node, void *ctx) in lxb_dom_node_by_attr_cb() argument
943 if (node->type != LXB_DOM_NODE_TYPE_ELEMENT) { in lxb_dom_node_by_attr_cb()
949 lxb_dom_element_t *el = lxb_dom_interface_element(node); in lxb_dom_node_by_attr_cb()
959 cb_ctx->status = lxb_dom_collection_append(cb_ctx->col, node); in lxb_dom_node_by_attr_cb()
1085 lxb_dom_node_text_content(lxb_dom_node_t *node, size_t *len) in lxb_dom_node_text_content() argument
1090 switch (node->type) { in lxb_dom_node_text_content()
1093 lxb_dom_node_simple_walk(node, lxb_dom_node_text_content_size, in lxb_dom_node_text_content()
1096 text = lxb_dom_document_create_text(node->owner_document, in lxb_dom_node_text_content()
1102 lxb_dom_node_simple_walk(node, lxb_dom_node_text_content_concatenate, in lxb_dom_node_text_content()
1112 attr_text = lxb_dom_attr_value(lxb_dom_interface_attr(node), &length); in lxb_dom_node_text_content()
1117 text = lxb_dom_document_create_text(node->owner_document, in lxb_dom_node_text_content()
1134 ch_data = lxb_dom_interface_character_data(node); in lxb_dom_node_text_content()
1137 text = lxb_dom_document_create_text(node->owner_document, in lxb_dom_node_text_content()
1171 lxb_dom_node_text_content_size(lxb_dom_node_t *node, void *ctx) in lxb_dom_node_text_content_size() argument
1173 if (node->type == LXB_DOM_NODE_TYPE_TEXT) { in lxb_dom_node_text_content_size()
1174 *((size_t *) ctx) += lxb_dom_interface_text(node)->char_data.data.length; in lxb_dom_node_text_content_size()
1181 lxb_dom_node_text_content_concatenate(lxb_dom_node_t *node, void *ctx) in lxb_dom_node_text_content_concatenate() argument
1183 if (node->type != LXB_DOM_NODE_TYPE_TEXT) { in lxb_dom_node_text_content_concatenate()
1188 lxb_dom_character_data_t *ch_data = &lxb_dom_interface_text(node)->char_data; in lxb_dom_node_text_content_concatenate()
1198 lxb_dom_node_text_content_set(lxb_dom_node_t *node, in lxb_dom_node_text_content_set() argument
1203 switch (node->type) { in lxb_dom_node_text_content_set()
1208 text = lxb_dom_document_create_text_node(node->owner_document, in lxb_dom_node_text_content_set()
1214 status = lxb_dom_node_replace_all(node, lxb_dom_interface_node(text)); in lxb_dom_node_text_content_set()
1225 return lxb_dom_attr_set_existing_value(lxb_dom_interface_attr(node), in lxb_dom_node_text_content_set()
1231 return lxb_dom_character_data_replace(lxb_dom_interface_character_data(node), in lxb_dom_node_text_content_set()
1247 lxb_dom_node_t *node = root->first_child; in lxb_dom_node_is_empty() local
1249 while (node != NULL) { in lxb_dom_node_is_empty()
1250 if(node->local_name != LXB_TAG__EM_COMMENT) { in lxb_dom_node_is_empty()
1251 if(node->local_name != LXB_TAG__TEXT) in lxb_dom_node_is_empty()
1254 str = &lxb_dom_interface_text(node)->char_data.data; in lxb_dom_node_is_empty()
1267 if(node->first_child != NULL) { in lxb_dom_node_is_empty()
1268 node = node->first_child; in lxb_dom_node_is_empty()
1271 while(node != root && node->next == NULL) { in lxb_dom_node_is_empty()
1272 node = node->parent; in lxb_dom_node_is_empty()
1275 if(node == root) { in lxb_dom_node_is_empty()
1279 node = node->next; in lxb_dom_node_is_empty()
1287 lxb_dom_node_tag_id_noi(lxb_dom_node_t *node) in lxb_dom_node_tag_id_noi() argument
1289 return lxb_dom_node_tag_id(node); in lxb_dom_node_tag_id_noi()
1293 lxb_dom_node_next_noi(lxb_dom_node_t *node) in lxb_dom_node_next_noi() argument
1295 return lxb_dom_node_next(node); in lxb_dom_node_next_noi()
1299 lxb_dom_node_prev_noi(lxb_dom_node_t *node) in lxb_dom_node_prev_noi() argument
1301 return lxb_dom_node_prev(node); in lxb_dom_node_prev_noi()
1305 lxb_dom_node_parent_noi(lxb_dom_node_t *node) in lxb_dom_node_parent_noi() argument
1307 return lxb_dom_node_parent(node); in lxb_dom_node_parent_noi()
1311 lxb_dom_node_first_child_noi(lxb_dom_node_t *node) in lxb_dom_node_first_child_noi() argument
1313 return lxb_dom_node_first_child(node); in lxb_dom_node_first_child_noi()
1317 lxb_dom_node_last_child_noi(lxb_dom_node_t *node) in lxb_dom_node_last_child_noi() argument
1319 return lxb_dom_node_last_child(node); in lxb_dom_node_last_child_noi()