summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2016-02-05 20:31:46 (GMT)
committer Michael Drake <michael.drake@codethink.co.uk>2016-02-05 20:31:46 (GMT)
commit68c446328f2d874384b2d7ca6afb42b9d7fe4a17 (patch)
treefe7e75b5deb3fcf3d1b2864f962ffa2117480eef
parente9257f8c49dacf49feebad32780ffb7e6a7f013c (diff)
parentd19eda00d250fae4b18ce41c941e709d7d384ff5 (diff)
downloadlibdom-68c446328f2d874384b2d7ca6afb42b9d7fe4a17.tar.gz
libdom-68c446328f2d874384b2d7ca6afb42b9d7fe4a17.tar.bz2
Merge branch 'tlsa/fix-html-element-copy-constructors'
-rw-r--r--src/core/element.c77
-rw-r--r--src/core/element.h5
-rw-r--r--src/html/html_anchor_element.c35
-rw-r--r--src/html/html_anchor_element.h9
-rw-r--r--src/html/html_applet_element.c35
-rw-r--r--src/html/html_applet_element.h9
-rw-r--r--src/html/html_area_element.c35
-rw-r--r--src/html/html_area_element.h9
-rw-r--r--src/html/html_base_element.c35
-rw-r--r--src/html/html_base_element.h9
-rw-r--r--src/html/html_basefont_element.c35
-rw-r--r--src/html/html_basefont_element.h9
-rw-r--r--src/html/html_body_element.c35
-rw-r--r--src/html/html_body_element.h9
-rw-r--r--src/html/html_br_element.c35
-rw-r--r--src/html/html_br_element.h9
-rw-r--r--src/html/html_button_element.c39
-rw-r--r--src/html/html_button_element.h9
-rw-r--r--src/html/html_directory_element.c35
-rw-r--r--src/html/html_directory_element.h9
-rw-r--r--src/html/html_div_element.c35
-rw-r--r--src/html/html_div_element.h9
-rw-r--r--src/html/html_dlist_element.c35
-rw-r--r--src/html/html_dlist_element.h9
-rw-r--r--src/html/html_element.c32
-rw-r--r--src/html/html_element.h6
-rw-r--r--src/html/html_fieldset_element.c35
-rw-r--r--src/html/html_fieldset_element.h9
-rw-r--r--src/html/html_font_element.c35
-rw-r--r--src/html/html_font_element.h9
-rw-r--r--src/html/html_form_element.c35
-rw-r--r--src/html/html_form_element.h9
-rw-r--r--src/html/html_frame_element.c35
-rw-r--r--src/html/html_frame_element.h9
-rw-r--r--src/html/html_frameset_element.c35
-rw-r--r--src/html/html_frameset_element.h9
-rw-r--r--src/html/html_head_element.c35
-rw-r--r--src/html/html_head_element.h9
-rw-r--r--src/html/html_heading_element.c35
-rw-r--r--src/html/html_heading_element.h9
-rw-r--r--src/html/html_hr_element.c35
-rw-r--r--src/html/html_hr_element.h9
-rw-r--r--src/html/html_html_element.c35
-rw-r--r--src/html/html_html_element.h9
-rw-r--r--src/html/html_iframe_element.c35
-rw-r--r--src/html/html_iframe_element.h9
-rw-r--r--src/html/html_image_element.c35
-rw-r--r--src/html/html_image_element.h9
-rw-r--r--src/html/html_input_element.c47
-rw-r--r--src/html/html_input_element.h9
-rw-r--r--src/html/html_isindex_element.c35
-rw-r--r--src/html/html_isindex_element.h9
-rw-r--r--src/html/html_label_element.c35
-rw-r--r--src/html/html_label_element.h9
-rw-r--r--src/html/html_legend_element.c35
-rw-r--r--src/html/html_legend_element.h9
-rw-r--r--src/html/html_li_element.c35
-rw-r--r--src/html/html_li_element.h9
-rw-r--r--src/html/html_link_element.c35
-rw-r--r--src/html/html_link_element.h9
-rw-r--r--src/html/html_map_element.c37
-rw-r--r--src/html/html_map_element.h11
-rw-r--r--src/html/html_menu_element.c35
-rw-r--r--src/html/html_menu_element.h9
-rw-r--r--src/html/html_meta_element.c35
-rw-r--r--src/html/html_meta_element.h9
-rw-r--r--src/html/html_mod_element.c35
-rw-r--r--src/html/html_mod_element.h9
-rw-r--r--src/html/html_object_element.c35
-rw-r--r--src/html/html_object_element.h9
-rw-r--r--src/html/html_olist_element.c35
-rw-r--r--src/html/html_olist_element.h9
-rw-r--r--src/html/html_opt_group_element.c35
-rw-r--r--src/html/html_opt_group_element.h9
-rw-r--r--src/html/html_option_element.c38
-rw-r--r--src/html/html_option_element.h9
-rw-r--r--src/html/html_paragraph_element.c35
-rw-r--r--src/html/html_paragraph_element.h9
-rw-r--r--src/html/html_param_element.c35
-rw-r--r--src/html/html_param_element.h9
-rw-r--r--src/html/html_pre_element.c35
-rw-r--r--src/html/html_pre_element.h9
-rw-r--r--src/html/html_quote_element.c35
-rw-r--r--src/html/html_quote_element.h9
-rw-r--r--src/html/html_script_element.c35
-rw-r--r--src/html/html_script_element.h9
-rw-r--r--src/html/html_select_element.c41
-rw-r--r--src/html/html_select_element.h9
-rw-r--r--src/html/html_style_element.c35
-rw-r--r--src/html/html_style_element.h9
-rw-r--r--src/html/html_table_element.c42
-rw-r--r--src/html/html_table_element.h15
-rw-r--r--src/html/html_tablecaption_element.c35
-rw-r--r--src/html/html_tablecaption_element.h9
-rw-r--r--src/html/html_tablecell_element.c35
-rw-r--r--src/html/html_tablecell_element.h9
-rw-r--r--src/html/html_tablecol_element.c35
-rw-r--r--src/html/html_tablecol_element.h9
-rw-r--r--src/html/html_tablerow_element.c37
-rw-r--r--src/html/html_tablerow_element.h10
-rw-r--r--src/html/html_tablesection_element.c37
-rw-r--r--src/html/html_tablesection_element.h10
-rw-r--r--src/html/html_text_area_element.c44
-rw-r--r--src/html/html_text_area_element.h9
-rw-r--r--src/html/html_title_element.c35
-rw-r--r--src/html/html_title_element.h9
-rw-r--r--src/html/html_ulist_element.c35
-rw-r--r--src/html/html_ulist_element.h9
108 files changed, 2263 insertions, 202 deletions
diff --git a/src/core/element.c b/src/core/element.c
index a86dc65..bbf4c2b 100644
--- a/src/core/element.c
+++ b/src/core/element.c
@@ -1515,51 +1515,70 @@ void __dom_element_destroy(struct dom_node_internal *node)
* are all specified. For the methods like importNode and adoptNode,
* this will make _dom_element_copy can be used in them.
*/
-dom_exception _dom_element_copy(dom_node_internal *old,
+dom_exception _dom_element_copy(dom_node_internal *old,
dom_node_internal **copy)
{
- dom_element *olde = (dom_element *) old;
- dom_element *e;
+ dom_element *new_node;
dom_exception err;
- uint32_t classnr;
-
- e = malloc(sizeof(dom_element));
- if (e == NULL)
+
+ new_node = malloc(sizeof(dom_element));
+ if (new_node == NULL)
return DOM_NO_MEM_ERR;
- err = dom_node_copy_internal(old, e);
+ err = dom_element_copy_internal(old, new_node);
if (err != DOM_NO_ERR) {
- free(e);
+ free(new_node);
return err;
}
- if (olde->attributes != NULL) {
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_element_copy_internal(dom_element *old, dom_element *new)
+{
+ dom_exception err;
+ uint32_t classnr;
+
+ if (old->attributes != NULL) {
/* Copy the attribute list */
- e->attributes = _dom_element_attr_list_clone(olde->attributes,
- e);
+ new->attributes = _dom_element_attr_list_clone(
+ old->attributes, new);
} else {
- e->attributes = NULL;
+ new->attributes = NULL;
}
-
- if (olde->n_classes > 0) {
- e->n_classes = olde->n_classes;
- e->classes = malloc(sizeof(lwc_string *) * e->n_classes);
- for (classnr = 0; classnr < e->n_classes; ++classnr)
- e->classes[classnr] =
- lwc_string_ref(olde->classes[classnr]);
- } else {
- e->n_classes = 0;
- e->classes = NULL;
- }
-
- e->id_ns = NULL;
- e->id_name = NULL;
- /* TODO: deal with dom_type_info, it get no definition ! */
+ if (old->n_classes > 0) {
+ new->n_classes = old->n_classes;
+ new->classes = malloc(sizeof(lwc_string *) * new->n_classes);
+ if (new->classes == NULL) {
+ err = DOM_NO_MEM_ERR;
+ goto error;
+ }
+ for (classnr = 0; classnr < new->n_classes; ++classnr)
+ new->classes[classnr] =
+ lwc_string_ref(old->classes[classnr]);
+ } else {
+ new->n_classes = 0;
+ new->classes = NULL;
+ }
+
+ err = dom_node_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ goto error;
+ }
- *copy = (dom_node_internal *) e;
+ new->id_ns = NULL;
+ new->id_name = NULL;
+
+ /* TODO: deal with dom_type_info, it get no definition ! */
return DOM_NO_ERR;
+
+error:
+ free(new->classes);
+ return err;
}
diff --git a/src/core/element.h b/src/core/element.h
index 5873396..c89ddc0 100644
--- a/src/core/element.h
+++ b/src/core/element.h
@@ -231,6 +231,11 @@ dom_exception _dom_element_copy(dom_node_internal *old,
_dom_element_copy
/* Helper functions*/
+dom_exception _dom_element_copy_internal(dom_element *old,
+ dom_element *new);
+#define dom_element_copy_internal(o, n) _dom_element_copy_internal( \
+ (dom_element *) (o), (dom_element *) (n))
+
dom_exception _dom_element_get_id(struct dom_element *ele, dom_string **id);
extern struct dom_element_vtable _dom_element_vtable;
diff --git a/src/html/html_anchor_element.c b/src/html/html_anchor_element.c
index e23ae45..8d64c2b 100644
--- a/src/html/html_anchor_element.c
+++ b/src/html/html_anchor_element.c
@@ -110,10 +110,39 @@ void _dom_virtual_html_anchor_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_anchor_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_anchor_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_anchor_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_anchor_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_anchor_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_anchor_element_copy_internal(
+ dom_html_anchor_element *old,
+ dom_html_anchor_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_anchor_element.h b/src/html/html_anchor_element.h
index b79daf9..791956b 100644
--- a/src/html/html_anchor_element.h
+++ b/src/html/html_anchor_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_anchor_element_copy(dom_node_internal *old,
_dom_virtual_html_anchor_element_destroy, \
_dom_html_anchor_element_copy
+/* Helper functions*/
+dom_exception _dom_html_anchor_element_copy_internal(
+ dom_html_anchor_element *old,
+ dom_html_anchor_element *new);
+#define dom_html_anchor_element_copy_internal(o, n) \
+ _dom_html_anchor_element_copy_internal( \
+ (dom_html_anchor_element *) (o), \
+ (dom_html_anchor_element *) (n))
+
#endif
diff --git a/src/html/html_applet_element.c b/src/html/html_applet_element.c
index 2a28293..93ea1b5 100644
--- a/src/html/html_applet_element.c
+++ b/src/html/html_applet_element.c
@@ -110,10 +110,39 @@ void _dom_virtual_html_applet_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_applet_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_applet_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_applet_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_applet_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_applet_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_applet_element_copy_internal(
+ dom_html_applet_element *old,
+ dom_html_applet_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_applet_element.h b/src/html/html_applet_element.h
index 20bef1f..466c127 100644
--- a/src/html/html_applet_element.h
+++ b/src/html/html_applet_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_applet_element_copy(dom_node_internal *old,
_dom_virtual_html_applet_element_destroy, \
_dom_html_applet_element_copy
+/* Helper functions*/
+dom_exception _dom_html_applet_element_copy_internal(
+ dom_html_applet_element *old,
+ dom_html_applet_element *new);
+#define dom_html_applet_element_copy_internal(o, n) \
+ _dom_html_applet_element_copy_internal( \
+ (dom_html_applet_element *) (o), \
+ (dom_html_applet_element *) (n))
+
#endif
diff --git a/src/html/html_area_element.c b/src/html/html_area_element.c
index 4a2cefb..828b073 100644
--- a/src/html/html_area_element.c
+++ b/src/html/html_area_element.c
@@ -165,10 +165,39 @@ void _dom_virtual_html_area_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_area_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_area_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_area_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_area_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_area_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_area_element_copy_internal(
+ dom_html_area_element *old,
+ dom_html_area_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_area_element.h b/src/html/html_area_element.h
index 73462b2..2c765f6 100644
--- a/src/html/html_area_element.h
+++ b/src/html/html_area_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_area_element_copy(dom_node_internal *old,
_dom_virtual_html_area_element_destroy, \
_dom_html_area_element_copy
+/* Helper functions*/
+dom_exception _dom_html_area_element_copy_internal(
+ dom_html_area_element *old,
+ dom_html_area_element *new);
+#define dom_html_area_element_copy_internal(o, n) \
+ _dom_html_area_element_copy_internal( \
+ (dom_html_area_element *) (o), \
+ (dom_html_area_element *) (n))
+
#endif
diff --git a/src/html/html_base_element.c b/src/html/html_base_element.c
index cda0707..0034f7c 100644
--- a/src/html/html_base_element.c
+++ b/src/html/html_base_element.c
@@ -105,10 +105,39 @@ void _dom_virtual_html_base_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_base_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_base_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_base_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_base_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_base_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_base_element_copy_internal(
+ dom_html_base_element *old,
+ dom_html_base_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_base_element.h b/src/html/html_base_element.h
index 608b99f..1b26ee9 100644
--- a/src/html/html_base_element.h
+++ b/src/html/html_base_element.h
@@ -48,5 +48,14 @@ dom_exception _dom_html_base_element_copy(dom_node_internal *old,
_dom_virtual_html_base_element_destroy, \
_dom_html_base_element_copy
+/* Helper functions*/
+dom_exception _dom_html_base_element_copy_internal(
+ dom_html_base_element *old,
+ dom_html_base_element *new);
+#define dom_html_base_element_copy_internal(o, n) \
+ _dom_html_base_element_copy_internal( \
+ (dom_html_base_element *) (o), \
+ (dom_html_base_element *) (n))
+
#endif
diff --git a/src/html/html_basefont_element.c b/src/html/html_basefont_element.c
index eab5a79..ac1183d 100644
--- a/src/html/html_basefont_element.c
+++ b/src/html/html_basefont_element.c
@@ -133,10 +133,39 @@ void _dom_virtual_html_base_font_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_base_font_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_base_font_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_base_font_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_base_font_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_base_font_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_base_font_element_copy_internal(
+ dom_html_base_font_element *old,
+ dom_html_base_font_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_basefont_element.h b/src/html/html_basefont_element.h
index 90e886e..f4ef704 100644
--- a/src/html/html_basefont_element.h
+++ b/src/html/html_basefont_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_base_font_element_copy(dom_node_internal *old,
_dom_virtual_html_base_font_element_destroy, \
_dom_html_base_font_element_copy
+/* Helper functions*/
+dom_exception _dom_html_base_font_element_copy_internal(
+ dom_html_base_font_element *old,
+ dom_html_base_font_element *new);
+#define dom_html_base_font_element_copy_internal(o, n) \
+ _dom_html_base_font_element_copy_internal( \
+ (dom_html_base_font_element *) (o), \
+ (dom_html_base_font_element *) (n))
+
#endif
diff --git a/src/html/html_body_element.c b/src/html/html_body_element.c
index 655fdb0..0fc4b13 100644
--- a/src/html/html_body_element.c
+++ b/src/html/html_body_element.c
@@ -107,10 +107,39 @@ void _dom_virtual_html_body_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_body_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_body_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_body_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_body_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_body_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_body_element_copy_internal(
+ dom_html_body_element *old,
+ dom_html_body_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_body_element.h b/src/html/html_body_element.h
index 765c44d..8b2e0a2 100644
--- a/src/html/html_body_element.h
+++ b/src/html/html_body_element.h
@@ -48,5 +48,14 @@ dom_exception _dom_html_body_element_copy(dom_node_internal *old,
_dom_virtual_html_body_element_destroy, \
_dom_html_body_element_copy
+/* Helper functions*/
+dom_exception _dom_html_body_element_copy_internal(
+ dom_html_body_element *old,
+ dom_html_body_element *new);
+#define dom_html_body_element_copy_internal(o, n) \
+ _dom_html_body_element_copy_internal( \
+ (dom_html_body_element *) (o), \
+ (dom_html_body_element *) (n))
+
#endif
diff --git a/src/html/html_br_element.c b/src/html/html_br_element.c
index 0cc9194..74e3ea8 100644
--- a/src/html/html_br_element.c
+++ b/src/html/html_br_element.c
@@ -110,10 +110,39 @@ void _dom_virtual_html_br_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_br_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_br_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_br_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_br_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_br_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_br_element_copy_internal(
+ dom_html_br_element *old,
+ dom_html_br_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_br_element.h b/src/html/html_br_element.h
index 75cbc49..127c994 100644
--- a/src/html/html_br_element.h
+++ b/src/html/html_br_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_br_element_copy(dom_node_internal *old,
_dom_virtual_html_br_element_destroy, \
_dom_html_br_element_copy
+/* Helper functions*/
+dom_exception _dom_html_br_element_copy_internal(
+ dom_html_br_element *old,
+ dom_html_br_element *new);
+#define dom_html_br_element_copy_internal(o, n) \
+ _dom_html_br_element_copy_internal( \
+ (dom_html_br_element *) (o), \
+ (dom_html_br_element *) (n))
+
#endif
diff --git a/src/html/html_button_element.c b/src/html/html_button_element.c
index a9c34d5..04a17dd 100644
--- a/src/html/html_button_element.c
+++ b/src/html/html_button_element.c
@@ -142,10 +142,43 @@ void _dom_virtual_html_button_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_button_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_button_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_button_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_button_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_button_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_button_element_copy_internal(
+ dom_html_button_element *old,
+ dom_html_button_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ /* TODO: We don't seem to keep a ref to form element, so just
+ * copy the pointer for now. */
+ new->form = old->form;
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_button_element.h b/src/html/html_button_element.h
index 9734106..43adae4 100644
--- a/src/html/html_button_element.h
+++ b/src/html/html_button_element.h
@@ -55,5 +55,14 @@ dom_exception _dom_html_button_element_copy(dom_node_internal *old,
dom_exception _dom_html_button_element_set_form(
dom_html_button_element *button, dom_html_form_element *form);
+/* Helper functions*/
+dom_exception _dom_html_button_element_copy_internal(
+ dom_html_button_element *old,
+ dom_html_button_element *new);
+#define dom_html_button_element_copy_internal(o, n) \
+ _dom_html_button_element_copy_internal( \
+ (dom_html_button_element *) (o), \
+ (dom_html_button_element *) (n))
+
#endif
diff --git a/src/html/html_directory_element.c b/src/html/html_directory_element.c
index e50a353..585af1c 100644
--- a/src/html/html_directory_element.c
+++ b/src/html/html_directory_element.c
@@ -137,9 +137,38 @@ void _dom_virtual_html_directory_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_directory_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_directory_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_directory_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_directory_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_directory_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_directory_element_copy_internal(
+ dom_html_directory_element *old,
+ dom_html_directory_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
diff --git a/src/html/html_directory_element.h b/src/html/html_directory_element.h
index 14497f6..d4c91d7 100644
--- a/src/html/html_directory_element.h
+++ b/src/html/html_directory_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_directory_element_copy(dom_node_internal *old,
_dom_virtual_html_directory_element_destroy, \
_dom_html_directory_element_copy
+/* Helper functions*/
+dom_exception _dom_html_directory_element_copy_internal(
+ dom_html_directory_element *old,
+ dom_html_directory_element *new);
+#define dom_html_directory_element_copy_internal(o, n) \
+ _dom_html_directory_element_copy_internal( \
+ (dom_html_directory_element *) (o), \
+ (dom_html_directory_element *) (n))
+
#endif
diff --git a/src/html/html_div_element.c b/src/html/html_div_element.c
index 5ebb971..b061246 100644
--- a/src/html/html_div_element.c
+++ b/src/html/html_div_element.c
@@ -109,10 +109,39 @@ void _dom_virtual_html_div_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_div_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_div_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_div_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_div_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_div_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_div_element_copy_internal(
+ dom_html_div_element *old,
+ dom_html_div_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_div_element.h b/src/html/html_div_element.h
index 931d201..0ab5526 100644
--- a/src/html/html_div_element.h
+++ b/src/html/html_div_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_div_element_copy(dom_node_internal *old,
_dom_virtual_html_div_element_destroy, \
_dom_html_div_element_copy
+/* Helper functions*/
+dom_exception _dom_html_div_element_copy_internal(
+ dom_html_div_element *old,
+ dom_html_div_element *new);
+#define dom_html_div_element_copy_internal(o, n) \
+ _dom_html_div_element_copy_internal( \
+ (dom_html_div_element *) (o), \
+ (dom_html_div_element *) (n))
+
#endif
diff --git a/src/html/html_dlist_element.c b/src/html/html_dlist_element.c
index e2fccc9..ab9d4c3 100644
--- a/src/html/html_dlist_element.c
+++ b/src/html/html_dlist_element.c
@@ -137,9 +137,38 @@ void _dom_virtual_html_dlist_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_dlist_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_dlist_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_dlist_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_dlist_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_dlist_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_dlist_element_copy_internal(
+ dom_html_dlist_element *old,
+ dom_html_dlist_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
diff --git a/src/html/html_dlist_element.h b/src/html/html_dlist_element.h
index aeca232..ff6a6e4 100644
--- a/src/html/html_dlist_element.h
+++ b/src/html/html_dlist_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_dlist_element_copy(dom_node_internal *old,
_dom_virtual_html_dlist_element_destroy, \
_dom_html_dlist_element_copy
+/* Helper functions*/
+dom_exception _dom_html_dlist_element_copy_internal(
+ dom_html_dlist_element *old,
+ dom_html_dlist_element *new);
+#define dom_html_dlist_element_copy_internal(o, n) \
+ _dom_html_dlist_element_copy_internal( \
+ (dom_html_dlist_element *) (o), \
+ (dom_html_dlist_element *) (n))
+
#endif
diff --git a/src/html/html_element.c b/src/html/html_element.c
index 85380ff..65a75ca 100644
--- a/src/html/html_element.c
+++ b/src/html/html_element.c
@@ -101,7 +101,37 @@ void _dom_html_element_destroy(dom_node_internal *node)
dom_exception _dom_html_element_copy(dom_node_internal *old,
dom_node_internal **copy)
{
- return _dom_element_copy(old, copy);
+ dom_html_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_element_copy_internal(
+ dom_html_element *old, dom_html_element *new)
+{
+ dom_exception err;
+
+ err = dom_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ new->type = old->type;
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_element.h b/src/html/html_element.h
index 92c96ab..0290569 100644
--- a/src/html/html_element.h
+++ b/src/html/html_element.h
@@ -156,6 +156,12 @@ dom_exception dom_html_element_get_dom_ulong_property(dom_html_element *ele,
dom_exception dom_html_element_set_dom_ulong_property(dom_html_element *ele,
const char *name, uint32_t len, dom_ulong value);
+/* Helper functions*/
+dom_exception _dom_html_element_copy_internal(dom_html_element *old,
+ dom_html_element *new);
+#define dom_html_element_copy_internal(o, n) _dom_html_element_copy_internal( \
+ (dom_html_element *) (o), (dom_html_element *) (n))
+
extern struct dom_html_element_vtable _dom_html_element_vtable;
#endif
diff --git a/src/html/html_fieldset_element.c b/src/html/html_fieldset_element.c
index c6224bf..c869822 100644
--- a/src/html/html_fieldset_element.c
+++ b/src/html/html_fieldset_element.c
@@ -109,10 +109,39 @@ void _dom_virtual_html_field_set_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_field_set_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_field_set_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_field_set_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_field_set_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_field_set_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_field_set_element_copy_internal(
+ dom_html_field_set_element *old,
+ dom_html_field_set_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/**
diff --git a/src/html/html_fieldset_element.h b/src/html/html_fieldset_element.h
index 0560cf2..13fc522 100644
--- a/src/html/html_fieldset_element.h
+++ b/src/html/html_fieldset_element.h
@@ -49,5 +49,14 @@ dom_exception _dom_html_field_set_element_copy(dom_node_internal *old,
_dom_virtual_html_field_set_element_destroy, \
_dom_html_field_set_element_copy
+/* Helper functions*/
+dom_exception _dom_html_field_set_element_copy_internal(
+ dom_html_field_set_element *old,
+ dom_html_field_set_element *new);
+#define dom_html_field_set_element_copy_internal(o, n) \
+ _dom_html_field_set_element_copy_internal( \
+ (dom_html_field_set_element *) (o), \
+ (dom_html_field_set_element *) (n))
+
#endif
diff --git a/src/html/html_font_element.c b/src/html/html_font_element.c
index b77d7b6..ecedfb0 100644
--- a/src/html/html_font_element.c
+++ b/src/html/html_font_element.c
@@ -110,10 +110,39 @@ void _dom_virtual_html_font_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_font_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_font_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_font_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_font_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_font_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_font_element_copy_internal(
+ dom_html_font_element *old,
+ dom_html_font_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_font_element.h b/src/html/html_font_element.h
index 41f22ce..60b220c 100644
--- a/src/html/html_font_element.h
+++ b/src/html/html_font_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_font_element_copy(dom_node_internal *old,
_dom_virtual_html_font_element_destroy, \
_dom_html_font_element_copy
+/* Helper functions*/
+dom_exception _dom_html_font_element_copy_internal(
+ dom_html_font_element *old,
+ dom_html_font_element *new);
+#define dom_html_font_element_copy_internal(o, n) \
+ _dom_html_font_element_copy_internal( \
+ (dom_html_font_element *) (o), \
+ (dom_html_font_element *) (n))
+
#endif
diff --git a/src/html/html_form_element.c b/src/html/html_form_element.c
index 42eb96f..1dd1992 100644
--- a/src/html/html_form_element.c
+++ b/src/html/html_form_element.c
@@ -121,10 +121,39 @@ void _dom_virtual_html_form_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_form_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_form_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_form_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_form_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_form_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_form_element_copy_internal(
+ dom_html_form_element *old,
+ dom_html_form_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_form_element.h b/src/html/html_form_element.h
index bab3ef8..4987820 100644
--- a/src/html/html_form_element.h
+++ b/src/html/html_form_element.h
@@ -50,5 +50,14 @@ dom_exception _dom_html_form_element_copy(dom_node_internal *old,
_dom_virtual_html_form_element_destroy, \
_dom_html_form_element_copy
+/* Helper functions*/
+dom_exception _dom_html_form_element_copy_internal(
+ dom_html_form_element *old,
+ dom_html_form_element *new);
+#define dom_html_form_element_copy_internal(o, n) \
+ _dom_html_form_element_copy_internal( \
+ (dom_html_form_element *) (o), \
+ (dom_html_form_element *) (n))
+
#endif
diff --git a/src/html/html_frame_element.c b/src/html/html_frame_element.c
index 4835667..fe6859c 100644
--- a/src/html/html_frame_element.c
+++ b/src/html/html_frame_element.c
@@ -137,10 +137,39 @@ void _dom_virtual_html_frame_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_frame_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_frame_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_frame_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_frame_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_frame_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_frame_element_copy_internal(
+ dom_html_frame_element *old,
+ dom_html_frame_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_frame_element.h b/src/html/html_frame_element.h
index 0bef1dc..8ad3d7b 100644
--- a/src/html/html_frame_element.h
+++ b/src/html/html_frame_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_frame_element_copy(dom_node_internal *old,
_dom_virtual_html_frame_element_destroy, \
_dom_html_frame_element_copy
+/* Helper functions*/
+dom_exception _dom_html_frame_element_copy_internal(
+ dom_html_frame_element *old,
+ dom_html_frame_element *new);
+#define dom_html_frame_element_copy_internal(o, n) \
+ _dom_html_frame_element_copy_internal( \
+ (dom_html_frame_element *) (o), \
+ (dom_html_frame_element *) (n))
+
#endif
diff --git a/src/html/html_frameset_element.c b/src/html/html_frameset_element.c
index 4af3c19..be44d5d 100644
--- a/src/html/html_frameset_element.c
+++ b/src/html/html_frameset_element.c
@@ -109,10 +109,39 @@ void _dom_virtual_html_frame_set_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_frame_set_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_frame_set_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_frame_set_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_frame_set_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_frame_set_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_frame_set_element_copy_internal(
+ dom_html_frame_set_element *old,
+ dom_html_frame_set_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_frameset_element.h b/src/html/html_frameset_element.h
index 7d97018..4427a58 100644
--- a/src/html/html_frameset_element.h
+++ b/src/html/html_frameset_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_frame_set_element_copy(dom_node_internal *old,
_dom_virtual_html_frame_set_element_destroy, \
_dom_html_frame_set_element_copy
+/* Helper functions*/
+dom_exception _dom_html_frame_set_element_copy_internal(
+ dom_html_frame_set_element *old,
+ dom_html_frame_set_element *new);
+#define dom_html_frame_set_element_copy_internal(o, n) \
+ _dom_html_frame_set_element_copy_internal( \
+ (dom_html_frame_set_element *) (o), \
+ (dom_html_frame_set_element *) (n))
+
#endif
diff --git a/src/html/html_head_element.c b/src/html/html_head_element.c
index 85665f3..ff02b1f 100644
--- a/src/html/html_head_element.c
+++ b/src/html/html_head_element.c
@@ -105,10 +105,39 @@ void _dom_virtual_html_head_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_head_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_head_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_head_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_head_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_head_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_head_element_copy_internal(
+ dom_html_head_element *old,
+ dom_html_head_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_head_element.h b/src/html/html_head_element.h
index 08659fd..63953a3 100644
--- a/src/html/html_head_element.h
+++ b/src/html/html_head_element.h
@@ -48,5 +48,14 @@ dom_exception _dom_html_head_element_copy(dom_node_internal *old,
_dom_virtual_html_head_element_destroy, \
_dom_html_head_element_copy
+/* Helper functions*/
+dom_exception _dom_html_head_element_copy_internal(
+ dom_html_head_element *old,
+ dom_html_head_element *new);
+#define dom_html_head_element_copy_internal(o, n) \
+ _dom_html_head_element_copy_internal( \
+ (dom_html_head_element *) (o), \
+ (dom_html_head_element *) (n))
+
#endif
diff --git a/src/html/html_heading_element.c b/src/html/html_heading_element.c
index b81c55d..8ab2c5a 100644
--- a/src/html/html_heading_element.c
+++ b/src/html/html_heading_element.c
@@ -109,10 +109,39 @@ void _dom_virtual_html_heading_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_heading_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_heading_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_heading_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_heading_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_heading_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_heading_element_copy_internal(
+ dom_html_heading_element *old,
+ dom_html_heading_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_heading_element.h b/src/html/html_heading_element.h
index 543f9a9..4765d65 100644
--- a/src/html/html_heading_element.h
+++ b/src/html/html_heading_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_heading_element_copy(dom_node_internal *old,
_dom_virtual_html_heading_element_destroy, \
_dom_html_heading_element_copy
+/* Helper functions*/
+dom_exception _dom_html_heading_element_copy_internal(
+ dom_html_heading_element *old,
+ dom_html_heading_element *new);
+#define dom_html_heading_element_copy_internal(o, n) \
+ _dom_html_heading_element_copy_internal( \
+ (dom_html_heading_element *) (o), \
+ (dom_html_heading_element *) (n))
+
#endif
diff --git a/src/html/html_hr_element.c b/src/html/html_hr_element.c
index 6d96c84..e6086f5 100644
--- a/src/html/html_hr_element.c
+++ b/src/html/html_hr_element.c
@@ -137,10 +137,39 @@ void _dom_virtual_html_hr_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_hr_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_hr_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_hr_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_hr_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_hr_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_hr_element_copy_internal(
+ dom_html_hr_element *old,
+ dom_html_hr_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_hr_element.h b/src/html/html_hr_element.h
index 63b5bbc..e0eb40b 100644
--- a/src/html/html_hr_element.h
+++ b/src/html/html_hr_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_hr_element_copy(dom_node_internal *old,
_dom_virtual_html_hr_element_destroy, \
_dom_html_hr_element_copy
+/* Helper functions*/
+dom_exception _dom_html_hr_element_copy_internal(
+ dom_html_hr_element *old,
+ dom_html_hr_element *new);
+#define dom_html_hr_element_copy_internal(o, n) \
+ _dom_html_hr_element_copy_internal( \
+ (dom_html_hr_element *) (o), \
+ (dom_html_hr_element *) (n))
+
#endif
diff --git a/src/html/html_html_element.c b/src/html/html_html_element.c
index dccc8a5..9cdcd5e 100644
--- a/src/html/html_html_element.c
+++ b/src/html/html_html_element.c
@@ -106,10 +106,39 @@ void _dom_virtual_html_html_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_html_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_html_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_html_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_html_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_html_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_html_element_copy_internal(
+ dom_html_html_element *old,
+ dom_html_html_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_html_element.h b/src/html/html_html_element.h
index 78da8f1..d3a872f 100644
--- a/src/html/html_html_element.h
+++ b/src/html/html_html_element.h
@@ -48,5 +48,14 @@ dom_exception _dom_html_html_element_copy(dom_node_internal *old,
_dom_virtual_html_html_element_destroy, \
_dom_html_html_element_copy
+/* Helper functions*/
+dom_exception _dom_html_html_element_copy_internal(
+ dom_html_html_element *old,
+ dom_html_html_element *new);
+#define dom_html_html_element_copy_internal(o, n) \
+ _dom_html_html_element_copy_internal( \
+ (dom_html_html_element *) (o), \
+ (dom_html_html_element *) (n))
+
#endif
diff --git a/src/html/html_iframe_element.c b/src/html/html_iframe_element.c
index 5ff5d26..4d7272b 100644
--- a/src/html/html_iframe_element.c
+++ b/src/html/html_iframe_element.c
@@ -109,10 +109,39 @@ void _dom_virtual_html_iframe_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_iframe_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_iframe_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_iframe_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_iframe_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_iframe_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_iframe_element_copy_internal(
+ dom_html_iframe_element *old,
+ dom_html_iframe_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_iframe_element.h b/src/html/html_iframe_element.h
index 07ed091..df15234 100644
--- a/src/html/html_iframe_element.h
+++ b/src/html/html_iframe_element.h
@@ -49,5 +49,14 @@ dom_exception _dom_html_iframe_element_copy(dom_node_internal *old,
_dom_virtual_html_iframe_element_destroy, \
_dom_html_iframe_element_copy
+/* Helper functions*/
+dom_exception _dom_html_iframe_element_copy_internal(
+ dom_html_iframe_element *old,
+ dom_html_iframe_element *new);
+#define dom_html_iframe_element_copy_internal(o, n) \
+ _dom_html_iframe_element_copy_internal( \
+ (dom_html_iframe_element *) (o), \
+ (dom_html_iframe_element *) (n))
+
#endif
diff --git a/src/html/html_image_element.c b/src/html/html_image_element.c
index db8b8b5..3cdd15f 100644
--- a/src/html/html_image_element.c
+++ b/src/html/html_image_element.c
@@ -110,10 +110,39 @@ void _dom_virtual_html_image_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_image_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_image_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_image_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_image_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_image_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_image_element_copy_internal(
+ dom_html_image_element *old,
+ dom_html_image_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_image_element.h b/src/html/html_image_element.h
index d17c513..3c9913a 100644
--- a/src/html/html_image_element.h
+++ b/src/html/html_image_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_image_element_copy(dom_node_internal *old,
_dom_virtual_html_image_element_destroy, \
_dom_html_image_element_copy
+/* Helper functions*/
+dom_exception _dom_html_image_element_copy_internal(
+ dom_html_image_element *old,
+ dom_html_image_element *new);
+#define dom_html_image_element_copy_internal(o, n) \
+ _dom_html_image_element_copy_internal( \
+ (dom_html_image_element *) (o), \
+ (dom_html_image_element *) (n))
+
#endif
diff --git a/src/html/html_input_element.c b/src/html/html_input_element.c
index 2dc0dc3..079b55e 100644
--- a/src/html/html_input_element.c
+++ b/src/html/html_input_element.c
@@ -303,10 +303,51 @@ void _dom_virtual_html_input_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_input_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_input_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_input_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_input_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_input_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_input_element_copy_internal(
+ dom_html_input_element *old,
+ dom_html_input_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ /* TODO: We don't seem to keep a ref to form element, so just
+ * copy the pointer for now. */
+ new->form = old->form;
+
+ new->default_checked = old->default_checked;
+ new->default_checked_set = old->default_checked_set;
+ new->default_value = old->default_value == NULL ?
+ NULL : dom_string_ref(old->default_value);
+ new->default_value_set = old->default_value_set;
+ new->checked = old->checked;
+ new->checked_set = old->checked_set;
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_input_element.h b/src/html/html_input_element.h
index b445888..3600561 100644
--- a/src/html/html_input_element.h
+++ b/src/html/html_input_element.h
@@ -61,5 +61,14 @@ dom_exception _dom_html_input_element_copy(dom_node_internal *old,
dom_exception _dom_html_input_element_set_form(
dom_html_input_element *input, dom_html_form_element *form);
+/* Helper functions*/
+dom_exception _dom_html_input_element_copy_internal(
+ dom_html_input_element *old,
+ dom_html_input_element *new);
+#define dom_html_input_element_copy_internal(o, n) \
+ _dom_html_input_element_copy_internal( \
+ (dom_html_input_element *) (o), \
+ (dom_html_input_element *) (n))
+
#endif
diff --git a/src/html/html_isindex_element.c b/src/html/html_isindex_element.c
index 82c7296..40cb99c 100644
--- a/src/html/html_isindex_element.c
+++ b/src/html/html_isindex_element.c
@@ -107,10 +107,39 @@ void _dom_virtual_html_isindex_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_isindex_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_isindex_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_isindex_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_isindex_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_isindex_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_isindex_element_copy_internal(
+ dom_html_isindex_element *old,
+ dom_html_isindex_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_isindex_element.h b/src/html/html_isindex_element.h
index 697e2eb..0cb7f4e 100644
--- a/src/html/html_isindex_element.h
+++ b/src/html/html_isindex_element.h
@@ -48,5 +48,14 @@ dom_exception _dom_html_isindex_element_copy(dom_node_internal *old,
_dom_virtual_html_isindex_element_destroy, \
_dom_html_isindex_element_copy
+/* Helper functions*/
+dom_exception _dom_html_isindex_element_copy_internal(
+ dom_html_isindex_element *old,
+ dom_html_isindex_element *new);
+#define dom_html_isindex_element_copy_internal(o, n) \
+ _dom_html_isindex_element_copy_internal( \
+ (dom_html_isindex_element *) (o), \
+ (dom_html_isindex_element *) (n))
+
#endif
diff --git a/src/html/html_label_element.c b/src/html/html_label_element.c
index e5730a2..3864cc4 100644
--- a/src/html/html_label_element.c
+++ b/src/html/html_label_element.c
@@ -107,10 +107,39 @@ void _dom_virtual_html_label_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_label_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_label_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_label_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_label_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_label_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_label_element_copy_internal(
+ dom_html_label_element *old,
+ dom_html_label_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/**
diff --git a/src/html/html_label_element.h b/src/html/html_label_element.h
index 4eb042c..f4aca98 100644
--- a/src/html/html_label_element.h
+++ b/src/html/html_label_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_label_element_copy(dom_node_internal *old,
_dom_virtual_html_label_element_destroy, \
_dom_html_label_element_copy
+/* Helper functions*/
+dom_exception _dom_html_label_element_copy_internal(
+ dom_html_label_element *old,
+ dom_html_label_element *new);
+#define dom_html_label_element_copy_internal(o, n) \
+ _dom_html_label_element_copy_internal( \
+ (dom_html_label_element *) (o), \
+ (dom_html_label_element *) (n))
+
#endif
diff --git a/src/html/html_legend_element.c b/src/html/html_legend_element.c
index 842916f..efb712b 100644
--- a/src/html/html_legend_element.c
+++ b/src/html/html_legend_element.c
@@ -144,10 +144,39 @@ void _dom_virtual_html_legend_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_legend_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_legend_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_legend_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_legend_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_legend_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_legend_element_copy_internal(
+ dom_html_legend_element *old,
+ dom_html_legend_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_legend_element.h b/src/html/html_legend_element.h
index 50b9b51..226042a 100644
--- a/src/html/html_legend_element.h
+++ b/src/html/html_legend_element.h
@@ -49,5 +49,14 @@ dom_exception _dom_html_legend_element_copy(dom_node_internal *old,
_dom_virtual_html_legend_element_destroy, \
_dom_html_legend_element_copy
+/* Helper functions*/
+dom_exception _dom_html_legend_element_copy_internal(
+ dom_html_legend_element *old,
+ dom_html_legend_element *new);
+#define dom_html_legend_element_copy_internal(o, n) \
+ _dom_html_legend_element_copy_internal( \
+ (dom_html_legend_element *) (o), \
+ (dom_html_legend_element *) (n))
+
#endif
diff --git a/src/html/html_li_element.c b/src/html/html_li_element.c
index 3af8fea..84becf9 100644
--- a/src/html/html_li_element.c
+++ b/src/html/html_li_element.c
@@ -133,10 +133,39 @@ void _dom_virtual_html_li_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_li_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_li_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_li_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_li_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_li_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_li_element_copy_internal(
+ dom_html_li_element *old,
+ dom_html_li_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_li_element.h b/src/html/html_li_element.h
index 74dd5af..894802d 100644
--- a/src/html/html_li_element.h
+++ b/src/html/html_li_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_li_element_copy(dom_node_internal *old,
_dom_virtual_html_li_element_destroy, \
_dom_html_li_element_copy
+/* Helper functions*/
+dom_exception _dom_html_li_element_copy_internal(
+ dom_html_li_element *old,
+ dom_html_li_element *new);
+#define dom_html_li_element_copy_internal(o, n) \
+ _dom_html_li_element_copy_internal( \
+ (dom_html_li_element *) (o), \
+ (dom_html_li_element *) (n))
+
#endif
diff --git a/src/html/html_link_element.c b/src/html/html_link_element.c
index 10a2e7a..87fe980 100644
--- a/src/html/html_link_element.c
+++ b/src/html/html_link_element.c
@@ -138,10 +138,39 @@ void _dom_virtual_html_link_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_link_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_link_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_link_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_link_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_link_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_link_element_copy_internal(
+ dom_html_link_element *old,
+ dom_html_link_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_link_element.h b/src/html/html_link_element.h
index d75b0ff..6371a33 100644
--- a/src/html/html_link_element.h
+++ b/src/html/html_link_element.h
@@ -48,5 +48,14 @@ dom_exception _dom_html_link_element_copy(dom_node_internal *old,
_dom_virtual_html_link_element_destroy, \
_dom_html_link_element_copy
+/* Helper functions*/
+dom_exception _dom_html_link_element_copy_internal(
+ dom_html_link_element *old,
+ dom_html_link_element *new);
+#define dom_html_link_element_copy_internal(o, n) \
+ _dom_html_link_element_copy_internal( \
+ (dom_html_link_element *) (o), \
+ (dom_html_link_element *) (n))
+
#endif
diff --git a/src/html/html_map_element.c b/src/html/html_map_element.c
index 980f002..3b10222 100644
--- a/src/html/html_map_element.c
+++ b/src/html/html_map_element.c
@@ -112,10 +112,39 @@ void _dom_virtual_html_map_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_map_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_map_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_map_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_map_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_map_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_map_element_copy_internal(
+ dom_html_map_element *old,
+ dom_html_map_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
@@ -161,7 +190,7 @@ dom_exception dom_html_map_element_set_##attr( \
SIMPLE_GET_SET(name);
/* The callback function for _dom_html_collection_create*/
-bool callback(struct dom_node_internal *node, void *ctx)
+static bool callback(struct dom_node_internal *node, void *ctx)
{
if(node->type == DOM_ELEMENT_NODE &&
dom_string_caseless_isequal(node->name,
diff --git a/src/html/html_map_element.h b/src/html/html_map_element.h
index ede8a71..7e0e3dc 100644
--- a/src/html/html_map_element.h
+++ b/src/html/html_map_element.h
@@ -49,6 +49,13 @@ dom_exception _dom_html_map_element_copy(dom_node_internal *old,
_dom_virtual_html_map_element_destroy, \
_dom_html_map_element_copy
-#endif
+/* Helper functions*/
+dom_exception _dom_html_map_element_copy_internal(
+ dom_html_map_element *old,
+ dom_html_map_element *new);
+#define dom_html_map_element_copy_internal(o, n) \
+ _dom_html_map_element_copy_internal( \
+ (dom_html_map_element *) (o), \
+ (dom_html_map_element *) (n))
-bool callback(struct dom_node_internal *node, void *ctx);
+#endif
diff --git a/src/html/html_menu_element.c b/src/html/html_menu_element.c
index 1226c70..09eadb6 100644
--- a/src/html/html_menu_element.c
+++ b/src/html/html_menu_element.c
@@ -137,9 +137,38 @@ void _dom_virtual_html_menu_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_menu_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_menu_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_menu_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_menu_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_menu_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_menu_element_copy_internal(
+ dom_html_menu_element *old,
+ dom_html_menu_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
diff --git a/src/html/html_menu_element.h b/src/html/html_menu_element.h
index f206315..04f285f 100644
--- a/src/html/html_menu_element.h
+++ b/src/html/html_menu_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_menu_element_copy(dom_node_internal *old,
_dom_virtual_html_menu_element_destroy, \
_dom_html_menu_element_copy
+/* Helper functions*/
+dom_exception _dom_html_menu_element_copy_internal(
+ dom_html_menu_element *old,
+ dom_html_menu_element *new);
+#define dom_html_menu_element_copy_internal(o, n) \
+ _dom_html_menu_element_copy_internal( \
+ (dom_html_menu_element *) (o), \
+ (dom_html_menu_element *) (n))
+
#endif
diff --git a/src/html/html_meta_element.c b/src/html/html_meta_element.c
index 56eaa34..4098daf 100644
--- a/src/html/html_meta_element.c
+++ b/src/html/html_meta_element.c
@@ -105,10 +105,39 @@ void _dom_virtual_html_meta_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_meta_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_meta_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_meta_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_meta_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_meta_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_meta_element_copy_internal(
+ dom_html_meta_element *old,
+ dom_html_meta_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_meta_element.h b/src/html/html_meta_element.h
index d92e5fd..65b625c 100644
--- a/src/html/html_meta_element.h
+++ b/src/html/html_meta_element.h
@@ -48,5 +48,14 @@ dom_exception _dom_html_meta_element_copy(dom_node_internal *old,
_dom_virtual_html_meta_element_destroy, \
_dom_html_meta_element_copy
+/* Helper functions*/
+dom_exception _dom_html_meta_element_copy_internal(
+ dom_html_meta_element *old,
+ dom_html_meta_element *new);
+#define dom_html_meta_element_copy_internal(o, n) \
+ _dom_html_meta_element_copy_internal( \
+ (dom_html_meta_element *) (o), \
+ (dom_html_meta_element *) (n))
+
#endif
diff --git a/src/html/html_mod_element.c b/src/html/html_mod_element.c
index d952a1b..20cb042 100644
--- a/src/html/html_mod_element.c
+++ b/src/html/html_mod_element.c
@@ -110,10 +110,39 @@ void _dom_virtual_html_mod_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_mod_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_mod_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_mod_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_mod_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_mod_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_mod_element_copy_internal(
+ dom_html_mod_element *old,
+ dom_html_mod_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_mod_element.h b/src/html/html_mod_element.h
index 0e4c49e..c9fbc4c 100644
--- a/src/html/html_mod_element.h
+++ b/src/html/html_mod_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_mod_element_copy(dom_node_internal *old,
_dom_virtual_html_mod_element_destroy, \
_dom_html_mod_element_copy
+/* Helper functions*/
+dom_exception _dom_html_mod_element_copy_internal(
+ dom_html_mod_element *old,
+ dom_html_mod_element *new);
+#define dom_html_mod_element_copy_internal(o, n) \
+ _dom_html_mod_element_copy_internal( \
+ (dom_html_mod_element *) (o), \
+ (dom_html_mod_element *) (n))
+
#endif
diff --git a/src/html/html_object_element.c b/src/html/html_object_element.c
index 914510d..e926aef 100644
--- a/src/html/html_object_element.c
+++ b/src/html/html_object_element.c
@@ -112,10 +112,39 @@ void _dom_virtual_html_object_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_object_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_object_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_object_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_object_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_object_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_object_element_copy_internal(
+ dom_html_object_element *old,
+ dom_html_object_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_object_element.h b/src/html/html_object_element.h
index b569c9d..55eddb5 100644
--- a/src/html/html_object_element.h
+++ b/src/html/html_object_element.h
@@ -50,5 +50,14 @@ dom_exception _dom_html_object_element_copy(dom_node_internal *old,
_dom_virtual_html_object_element_destroy, \
_dom_html_object_element_copy
+/* Helper functions*/
+dom_exception _dom_html_object_element_copy_internal(
+ dom_html_object_element *old,
+ dom_html_object_element *new);
+#define dom_html_object_element_copy_internal(o, n) \
+ _dom_html_object_element_copy_internal( \
+ (dom_html_object_element *) (o), \
+ (dom_html_object_element *) (n))
+
#endif
diff --git a/src/html/html_olist_element.c b/src/html/html_olist_element.c
index 411cc98..c89d11f 100644
--- a/src/html/html_olist_element.c
+++ b/src/html/html_olist_element.c
@@ -157,10 +157,39 @@ void _dom_virtual_html_olist_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_olist_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_olist_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_olist_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_olist_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_olist_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_olist_element_copy_internal(
+ dom_html_olist_element *old,
+ dom_html_olist_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_olist_element.h b/src/html/html_olist_element.h
index b06b277..bf8e79e 100644
--- a/src/html/html_olist_element.h
+++ b/src/html/html_olist_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_olist_element_copy(dom_node_internal *old,
_dom_virtual_html_olist_element_destroy, \
_dom_html_olist_element_copy
+/* Helper functions*/
+dom_exception _dom_html_olist_element_copy_internal(
+ dom_html_olist_element *old,
+ dom_html_olist_element *new);
+#define dom_html_olist_element_copy_internal(o, n) \
+ _dom_html_olist_element_copy_internal( \
+ (dom_html_olist_element *) (o), \
+ (dom_html_olist_element *) (n))
+
#endif
diff --git a/src/html/html_opt_group_element.c b/src/html/html_opt_group_element.c
index 0181111..6af0a29 100644
--- a/src/html/html_opt_group_element.c
+++ b/src/html/html_opt_group_element.c
@@ -140,10 +140,39 @@ void _dom_virtual_html_opt_group_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_opt_group_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_opt_group_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_opt_group_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_opt_group_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_opt_group_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_opt_group_element_copy_internal(
+ dom_html_opt_group_element *old,
+ dom_html_opt_group_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_opt_group_element.h b/src/html/html_opt_group_element.h
index 94dcf9e..a34bb75 100644
--- a/src/html/html_opt_group_element.h
+++ b/src/html/html_opt_group_element.h
@@ -48,4 +48,13 @@ dom_exception _dom_html_opt_group_element_copy(dom_node_internal *old,
_dom_virtual_html_opt_group_element_destroy, \
_dom_html_opt_group_element_copy
+/* Helper functions*/
+dom_exception _dom_html_opt_group_element_copy_internal(
+ dom_html_opt_group_element *old,
+ dom_html_opt_group_element *new);
+#define dom_html_opt_group_element_copy_internal(o, n) \
+ _dom_html_opt_group_element_copy_internal( \
+ (dom_html_opt_group_element *) (o), \
+ (dom_html_opt_group_element *) (n))
+
#endif
diff --git a/src/html/html_option_element.c b/src/html/html_option_element.c
index a4dec3c..a593ebe 100644
--- a/src/html/html_option_element.c
+++ b/src/html/html_option_element.c
@@ -445,9 +445,41 @@ void _dom_virtual_html_option_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_option_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_option_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_option_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_option_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_option_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_option_element_copy_internal(
+ dom_html_option_element *old,
+ dom_html_option_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ new->default_selected = old->default_selected;
+ new->default_selected_set = old->default_selected_set;
+
+ return DOM_NO_ERR;
}
diff --git a/src/html/html_option_element.h b/src/html/html_option_element.h
index b1f8b64..4b7d0b1 100644
--- a/src/html/html_option_element.h
+++ b/src/html/html_option_element.h
@@ -50,5 +50,14 @@ dom_exception _dom_html_option_element_copy(dom_node_internal *old,
_dom_virtual_html_option_element_destroy, \
_dom_html_option_element_copy
+/* Helper functions*/
+dom_exception _dom_html_option_element_copy_internal(
+ dom_html_option_element *old,
+ dom_html_option_element *new);
+#define dom_html_option_element_copy_internal(o, n) \
+ _dom_html_option_element_copy_internal( \
+ (dom_html_option_element *) (o), \
+ (dom_html_option_element *) (n))
+
#endif
diff --git a/src/html/html_paragraph_element.c b/src/html/html_paragraph_element.c
index bb8c1b3..2b2f420 100644
--- a/src/html/html_paragraph_element.c
+++ b/src/html/html_paragraph_element.c
@@ -109,10 +109,39 @@ void _dom_virtual_html_paragraph_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_paragraph_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_paragraph_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_paragraph_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_paragraph_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_paragraph_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_paragraph_element_copy_internal(
+ dom_html_paragraph_element *old,
+ dom_html_paragraph_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_paragraph_element.h b/src/html/html_paragraph_element.h
index 7495a76..d52fefa 100644
--- a/src/html/html_paragraph_element.h
+++ b/src/html/html_paragraph_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_paragraph_element_copy(dom_node_internal *old,
_dom_virtual_html_paragraph_element_destroy, \
_dom_html_paragraph_element_copy
+/* Helper functions*/
+dom_exception _dom_html_paragraph_element_copy_internal(
+ dom_html_paragraph_element *old,
+ dom_html_paragraph_element *new);
+#define dom_html_paragraph_element_copy_internal(o, n) \
+ _dom_html_paragraph_element_copy_internal( \
+ (dom_html_paragraph_element *) (o), \
+ (dom_html_paragraph_element *) (n))
+
#endif
diff --git a/src/html/html_param_element.c b/src/html/html_param_element.c
index 4c7ee89..c75e1ce 100644
--- a/src/html/html_param_element.c
+++ b/src/html/html_param_element.c
@@ -109,10 +109,39 @@ void _dom_virtual_html_param_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_param_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_param_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_param_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_param_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_param_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_param_element_copy_internal(
+ dom_html_param_element *old,
+ dom_html_param_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_param_element.h b/src/html/html_param_element.h
index f56a6a5..821590e 100644
--- a/src/html/html_param_element.h
+++ b/src/html/html_param_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_param_element_copy(dom_node_internal *old,
_dom_virtual_html_param_element_destroy, \
_dom_html_param_element_copy
+/* Helper functions*/
+dom_exception _dom_html_param_element_copy_internal(
+ dom_html_param_element *old,
+ dom_html_param_element *new);
+#define dom_html_param_element_copy_internal(o, n) \
+ _dom_html_param_element_copy_internal( \
+ (dom_html_param_element *) (o), \
+ (dom_html_param_element *) (n))
+
#endif
diff --git a/src/html/html_pre_element.c b/src/html/html_pre_element.c
index 502e4d8..64c8c3d 100644
--- a/src/html/html_pre_element.c
+++ b/src/html/html_pre_element.c
@@ -133,9 +133,38 @@ void _dom_virtual_html_pre_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_pre_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_pre_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_pre_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_pre_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_pre_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_pre_element_copy_internal(
+ dom_html_pre_element *old,
+ dom_html_pre_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
diff --git a/src/html/html_pre_element.h b/src/html/html_pre_element.h
index d9dc6d8..0a5e422 100644
--- a/src/html/html_pre_element.h
+++ b/src/html/html_pre_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_pre_element_copy(dom_node_internal *old,
_dom_virtual_html_pre_element_destroy, \
_dom_html_pre_element_copy
+/* Helper functions*/
+dom_exception _dom_html_pre_element_copy_internal(
+ dom_html_pre_element *old,
+ dom_html_pre_element *new);
+#define dom_html_pre_element_copy_internal(o, n) \
+ _dom_html_pre_element_copy_internal( \
+ (dom_html_pre_element *) (o), \
+ (dom_html_pre_element *) (n))
+
#endif
diff --git a/src/html/html_quote_element.c b/src/html/html_quote_element.c
index f2263c3..cf3e0c5 100644
--- a/src/html/html_quote_element.c
+++ b/src/html/html_quote_element.c
@@ -109,10 +109,39 @@ void _dom_virtual_html_quote_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_quote_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_quote_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_quote_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_quote_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_quote_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_quote_element_copy_internal(
+ dom_html_quote_element *old,
+ dom_html_quote_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_quote_element.h b/src/html/html_quote_element.h
index f62f2ec..baecef3 100644
--- a/src/html/html_quote_element.h
+++ b/src/html/html_quote_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_quote_element_copy(dom_node_internal *old,
_dom_virtual_html_quote_element_destroy, \
_dom_html_quote_element_copy
+/* Helper functions*/
+dom_exception _dom_html_quote_element_copy_internal(
+ dom_html_quote_element *old,
+ dom_html_quote_element *new);
+#define dom_html_quote_element_copy_internal(o, n) \
+ _dom_html_quote_element_copy_internal( \
+ (dom_html_quote_element *) (o), \
+ (dom_html_quote_element *) (n))
+
#endif
diff --git a/src/html/html_script_element.c b/src/html/html_script_element.c
index 534c390..d20d727 100644
--- a/src/html/html_script_element.c
+++ b/src/html/html_script_element.c
@@ -109,10 +109,39 @@ void _dom_virtual_html_script_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_script_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_script_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_script_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_script_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_script_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_script_element_copy_internal(
+ dom_html_script_element *old,
+ dom_html_script_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_script_element.h b/src/html/html_script_element.h
index c15e445..9b1d704 100644
--- a/src/html/html_script_element.h
+++ b/src/html/html_script_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_script_element_copy(dom_node_internal *old,
_dom_virtual_html_script_element_destroy, \
_dom_html_script_element_copy
+/* Helper functions*/
+dom_exception _dom_html_script_element_copy_internal(
+ dom_html_script_element *old,
+ dom_html_script_element *new);
+#define dom_html_script_element_copy_internal(o, n) \
+ _dom_html_script_element_copy_internal( \
+ (dom_html_script_element *) (o), \
+ (dom_html_script_element *) (n))
+
#endif
diff --git a/src/html/html_select_element.c b/src/html/html_select_element.c
index fe06e5d..ff549b2 100644
--- a/src/html/html_select_element.c
+++ b/src/html/html_select_element.c
@@ -113,10 +113,45 @@ void _dom_virtual_html_select_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_select_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_select_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_select_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_select_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_select_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_select_element_copy_internal(
+ dom_html_select_element *old,
+ dom_html_select_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ /* TODO: We don't seem to keep a ref to form element, so just
+ * copy the pointer for now. */
+ new->form = old->form;
+
+ new->selected = old->selected;
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_select_element.h b/src/html/html_select_element.h
index d7dc0a4..abde182 100644
--- a/src/html/html_select_element.h
+++ b/src/html/html_select_element.h
@@ -58,5 +58,14 @@ dom_exception _dom_html_select_element_copy(dom_node_internal *old,
dom_exception _dom_html_select_element_set_form(
dom_html_select_element *select, dom_html_form_element *form);
+/* Helper functions*/
+dom_exception _dom_html_select_element_copy_internal(
+ dom_html_select_element *old,
+ dom_html_select_element *new);
+#define dom_html_select_element_copy_internal(o, n) \
+ _dom_html_select_element_copy_internal( \
+ (dom_html_select_element *) (o), \
+ (dom_html_select_element *) (n))
+
#endif
diff --git a/src/html/html_style_element.c b/src/html/html_style_element.c
index 7434096..ae845be 100644
--- a/src/html/html_style_element.c
+++ b/src/html/html_style_element.c
@@ -105,10 +105,39 @@ void _dom_virtual_html_style_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_style_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_style_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_style_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_style_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_style_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_style_element_copy_internal(
+ dom_html_style_element *old,
+ dom_html_style_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
diff --git a/src/html/html_style_element.h b/src/html/html_style_element.h
index e21b9cf..61b6aa7 100644
--- a/src/html/html_style_element.h
+++ b/src/html/html_style_element.h
@@ -48,5 +48,14 @@ dom_exception _dom_html_style_element_copy(dom_node_internal *old,
_dom_virtual_html_style_element_destroy, \
_dom_html_style_element_copy
+/* Helper functions*/
+dom_exception _dom_html_style_element_copy_internal(
+ dom_html_style_element *old,
+ dom_html_style_element *new);
+#define dom_html_style_element_copy_internal(o, n) \
+ _dom_html_style_element_copy_internal( \
+ (dom_html_style_element *) (o), \
+ (dom_html_style_element *) (n))
+
#endif
diff --git a/src/html/html_table_element.c b/src/html/html_table_element.c
index 442e1d6..7e8a508 100644
--- a/src/html/html_table_element.c
+++ b/src/html/html_table_element.c
@@ -113,10 +113,39 @@ void _dom_virtual_html_table_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_table_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_table_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_table_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_table_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_table_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_table_element_copy_internal(
+ dom_html_table_element *old,
+ dom_html_table_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
@@ -351,7 +380,7 @@ dom_exception dom_html_table_element_set_t_foot(
* \param ctx The dom_html_document object (void *)
* \return DOM_NO_ERR on success, appropriate dom_exception on failure.
*/
-bool table_rows_callback(struct dom_node_internal *node, void *ctx)
+static bool table_rows_callback(struct dom_node_internal *node, void *ctx)
{
dom_html_document *doc = ctx;
if(node->type == DOM_ELEMENT_NODE &&
@@ -385,7 +414,7 @@ dom_exception dom_html_table_element_get_rows(
* \param ctx The dom_html_document object (void *)
* \return DOM_NO_ERR on success, appropriate dom_exception on failure.
*/
-bool table_t_bodies_callback(struct dom_node_internal *node, void *ctx)
+static bool table_t_bodies_callback(struct dom_node_internal *node, void *ctx)
{
dom_html_document *doc = ctx;
if(node->type == DOM_ELEMENT_NODE &&
@@ -403,6 +432,7 @@ bool table_t_bodies_callback(struct dom_node_internal *node, void *ctx)
* \param t_bodies The Status
* \return DOM_NO_ERR on success, appropriate dom_exception on failure.
*/
+
dom_exception dom_html_table_element_get_t_bodies(
dom_html_table_element *element,
dom_html_collection **t_bodies)
@@ -645,7 +675,7 @@ dom_exception dom_html_table_element_delete_t_head(
* \param t_head The Status
* \return DOM_NO_ERR on success, appropriate dom_exception on failure.
*/
-dom_exception dom_html_table_element_create_t_body(
+static dom_exception dom_html_table_element_create_t_body(
dom_html_table_element *element,
dom_html_table_section_element **t_body)
{
diff --git a/src/html/html_table_element.h b/src/html/html_table_element.h
index 4e4747c..eed6a4a 100644
--- a/src/html/html_table_element.h
+++ b/src/html/html_table_element.h
@@ -48,10 +48,13 @@ dom_exception _dom_html_table_element_copy(dom_node_internal *old,
_dom_virtual_html_table_element_destroy, \
_dom_html_table_element_copy
-#endif
+/* Helper functions*/
+dom_exception _dom_html_table_element_copy_internal(
+ dom_html_table_element *old,
+ dom_html_table_element *new);
+#define dom_html_table_element_copy_internal(o, n) \
+ _dom_html_table_element_copy_internal( \
+ (dom_html_table_element *) (o), \
+ (dom_html_table_element *) (n))
-bool table_rows_callback(struct dom_node_internal *node, void *ctx);
-bool table_t_bodies_callback(struct dom_node_internal *node, void *ctx);
-dom_exception dom_html_table_element_create_t_body(
- dom_html_table_element *element,
- dom_html_table_section_element **t_body);
+#endif
diff --git a/src/html/html_tablecaption_element.c b/src/html/html_tablecaption_element.c
index 5a4b1b1..cae229c 100644
--- a/src/html/html_tablecaption_element.c
+++ b/src/html/html_tablecaption_element.c
@@ -109,10 +109,39 @@ void _dom_virtual_html_table_caption_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_table_caption_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_table_caption_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_table_caption_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_table_caption_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_table_caption_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_table_caption_element_copy_internal(
+ dom_html_table_caption_element *old,
+ dom_html_table_caption_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_tablecaption_element.h b/src/html/html_tablecaption_element.h
index 971c55c..3d65806 100644
--- a/src/html/html_tablecaption_element.h
+++ b/src/html/html_tablecaption_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_table_caption_element_copy(dom_node_internal *old,
_dom_virtual_html_table_caption_element_destroy, \
_dom_html_table_caption_element_copy
+/* Helper functions*/
+dom_exception _dom_html_table_caption_element_copy_internal(
+ dom_html_table_caption_element *old,
+ dom_html_table_caption_element *new);
+#define dom_html_table_caption_element_copy_internal(o, n) \
+ _dom_html_table_caption_element_copy_internal( \
+ (dom_html_table_caption_element *) (o), \
+ (dom_html_table_caption_element *) (n))
+
#endif
diff --git a/src/html/html_tablecell_element.c b/src/html/html_tablecell_element.c
index c106b4f..7a1f968 100644
--- a/src/html/html_tablecell_element.c
+++ b/src/html/html_tablecell_element.c
@@ -110,10 +110,39 @@ void _dom_virtual_html_table_cell_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_table_cell_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_table_cell_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_table_cell_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_table_cell_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_table_cell_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_table_cell_element_copy_internal(
+ dom_html_table_cell_element *old,
+ dom_html_table_cell_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_tablecell_element.h b/src/html/html_tablecell_element.h
index 5f40373..2874a82 100644
--- a/src/html/html_tablecell_element.h
+++ b/src/html/html_tablecell_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_table_cell_element_copy(dom_node_internal *old,
_dom_virtual_html_table_cell_element_destroy, \
_dom_html_table_cell_element_copy
+/* Helper functions*/
+dom_exception _dom_html_table_cell_element_copy_internal(
+ dom_html_table_cell_element *old,
+ dom_html_table_cell_element *new);
+#define dom_html_table_cell_element_copy_internal(o, n) \
+ _dom_html_table_cell_element_copy_internal( \
+ (dom_html_table_cell_element *) (o), \
+ (dom_html_table_cell_element *) (n))
+
#endif
diff --git a/src/html/html_tablecol_element.c b/src/html/html_tablecol_element.c
index 5df6d5b..74169be 100644
--- a/src/html/html_tablecol_element.c
+++ b/src/html/html_tablecol_element.c
@@ -133,10 +133,39 @@ void _dom_virtual_html_table_col_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_table_col_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_table_col_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_table_col_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_table_col_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_table_col_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_table_col_element_copy_internal(
+ dom_html_table_col_element *old,
+ dom_html_table_col_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_tablecol_element.h b/src/html/html_tablecol_element.h
index adfca2f..5aa0462 100644
--- a/src/html/html_tablecol_element.h
+++ b/src/html/html_tablecol_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_table_col_element_copy(dom_node_internal *old,
_dom_virtual_html_table_col_element_destroy, \
_dom_html_table_col_element_copy
+/* Helper functions*/
+dom_exception _dom_html_table_col_element_copy_internal(
+ dom_html_table_col_element *old,
+ dom_html_table_col_element *new);
+#define dom_html_table_col_element_copy_internal(o, n) \
+ _dom_html_table_col_element_copy_internal( \
+ (dom_html_table_col_element *) (o), \
+ (dom_html_table_col_element *) (n))
+
#endif
diff --git a/src/html/html_tablerow_element.c b/src/html/html_tablerow_element.c
index 0d4f3eb..b722d0d 100644
--- a/src/html/html_tablerow_element.c
+++ b/src/html/html_tablerow_element.c
@@ -112,10 +112,39 @@ void _dom_virtual_html_table_row_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_table_row_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_table_row_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_table_row_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_table_row_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_table_row_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_table_row_element_copy_internal(
+ dom_html_table_row_element *old,
+ dom_html_table_row_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
@@ -288,7 +317,7 @@ dom_exception dom_html_table_row_element_get_section_row_index(
* \param ctx The dom_html_document object (void *)
* \return DOM_NO_ERR on success, appropriate dom_exception on failure.
*/
-bool table_cells_callback(struct dom_node_internal *node, void *ctx)
+static bool table_cells_callback(struct dom_node_internal *node, void *ctx)
{
dom_html_document *doc = ctx;
if (node->type == DOM_ELEMENT_NODE &&
diff --git a/src/html/html_tablerow_element.h b/src/html/html_tablerow_element.h
index ee081ba..5c8a4e4 100644
--- a/src/html/html_tablerow_element.h
+++ b/src/html/html_tablerow_element.h
@@ -48,6 +48,14 @@ dom_exception _dom_html_table_row_element_copy(dom_node_internal *old,
_dom_virtual_html_table_row_element_destroy, \
_dom_html_table_row_element_copy
+/* Helper functions*/
+dom_exception _dom_html_table_row_element_copy_internal(
+ dom_html_table_row_element *old,
+ dom_html_table_row_element *new);
+#define dom_html_table_row_element_copy_internal(o, n) \
+ _dom_html_table_row_element_copy_internal( \
+ (dom_html_table_row_element *) (o), \
+ (dom_html_table_row_element *) (n))
+
#endif
-bool table_cells_callback(struct dom_node_internal *node, void *ctx);
diff --git a/src/html/html_tablesection_element.c b/src/html/html_tablesection_element.c
index d570e1c..1ffe102 100644
--- a/src/html/html_tablesection_element.c
+++ b/src/html/html_tablesection_element.c
@@ -113,10 +113,39 @@ void _dom_virtual_html_table_section_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_table_section_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_table_section_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_table_section_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_table_section_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_table_section_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_table_section_element_copy_internal(
+ dom_html_table_section_element *old,
+ dom_html_table_section_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
@@ -164,7 +193,7 @@ SIMPLE_GET_SET(ch_off);
SIMPLE_GET_SET(v_align);
/* The callback function for _dom_html_collection_create*/
-bool table_section_callback(struct dom_node_internal *node, void *ctx)
+static bool table_section_callback(struct dom_node_internal *node, void *ctx)
{
dom_html_document *doc = ctx;
if(node->type == DOM_ELEMENT_NODE &&
diff --git a/src/html/html_tablesection_element.h b/src/html/html_tablesection_element.h
index 6985abd..b25eea3 100644
--- a/src/html/html_tablesection_element.h
+++ b/src/html/html_tablesection_element.h
@@ -49,6 +49,14 @@ dom_exception _dom_html_table_section_element_copy(dom_node_internal *old,
_dom_virtual_html_table_section_element_destroy, \
_dom_html_table_section_element_copy
+/* Helper functions*/
+dom_exception _dom_html_table_section_element_copy_internal(
+ dom_html_table_section_element *old,
+ dom_html_table_section_element *new);
+#define dom_html_table_section_element_copy_internal(o, n) \
+ _dom_html_table_section_element_copy_internal( \
+ (dom_html_table_section_element *) (o), \
+ (dom_html_table_section_element *) (n))
+
#endif
-bool table_section_callback(struct dom_node_internal *node, void *ctx);
diff --git a/src/html/html_text_area_element.c b/src/html/html_text_area_element.c
index bbc9789..6117e83 100644
--- a/src/html/html_text_area_element.c
+++ b/src/html/html_text_area_element.c
@@ -301,10 +301,48 @@ void _dom_virtual_html_text_area_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_text_area_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_text_area_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_text_area_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_text_area_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_text_area_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_text_area_element_copy_internal(
+ dom_html_text_area_element *old,
+ dom_html_text_area_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ /* TODO: We don't seem to keep a ref to form element, so just
+ * copy the pointer for now. */
+ new->form = old->form;
+
+ new->default_value = dom_string_ref(old->default_value);
+ new->default_value_set = old->default_value_set;
+ new->value = dom_string_ref(old->value);
+ new->value_set = old->value_set;
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_text_area_element.h b/src/html/html_text_area_element.h
index 5c7b420..bfbd77e 100644
--- a/src/html/html_text_area_element.h
+++ b/src/html/html_text_area_element.h
@@ -54,6 +54,15 @@ dom_exception _dom_html_text_area_element_copy(dom_node_internal *old,
_dom_virtual_html_text_area_element_destroy, \
_dom_html_text_area_element_copy
+/* Helper functions*/
+dom_exception _dom_html_text_area_element_copy_internal(
+ dom_html_text_area_element *old,
+ dom_html_text_area_element *new);
+#define dom_html_text_area_element_copy_internal(o, n) \
+ _dom_html_text_area_element_copy_internal( \
+ (dom_html_text_area_element *) (o), \
+ (dom_html_text_area_element *) (n))
+
/* Internal function for bindings */
dom_exception _dom_html_text_area_element_set_form(
diff --git a/src/html/html_title_element.c b/src/html/html_title_element.c
index 02c7820..39e898a 100644
--- a/src/html/html_title_element.c
+++ b/src/html/html_title_element.c
@@ -109,10 +109,39 @@ void _dom_virtual_html_title_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_title_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_title_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_title_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_title_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_title_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_title_element_copy_internal(
+ dom_html_title_element *old,
+ dom_html_title_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_title_element.h b/src/html/html_title_element.h
index 1a7653a..620171e 100644
--- a/src/html/html_title_element.h
+++ b/src/html/html_title_element.h
@@ -48,5 +48,14 @@ dom_exception _dom_html_title_element_copy(dom_node_internal *old,
_dom_virtual_html_title_element_destroy, \
_dom_html_title_element_copy
+/* Helper functions*/
+dom_exception _dom_html_title_element_copy_internal(
+ dom_html_title_element *old,
+ dom_html_title_element *new);
+#define dom_html_title_element_copy_internal(o, n) \
+ _dom_html_title_element_copy_internal( \
+ (dom_html_title_element *) (o), \
+ (dom_html_title_element *) (n))
+
#endif
diff --git a/src/html/html_ulist_element.c b/src/html/html_ulist_element.c
index 624c85f..f2b87fb 100644
--- a/src/html/html_ulist_element.c
+++ b/src/html/html_ulist_element.c
@@ -133,10 +133,39 @@ void _dom_virtual_html_u_list_element_destroy(dom_node_internal *node)
}
/* The virtual copy function, see src/core/node.c for detail */
-dom_exception _dom_html_u_list_element_copy(dom_node_internal *old,
- dom_node_internal **copy)
+dom_exception _dom_html_u_list_element_copy(
+ dom_node_internal *old, dom_node_internal **copy)
{
- return _dom_html_element_copy(old, copy);
+ dom_html_u_list_element *new_node;
+ dom_exception err;
+
+ new_node = malloc(sizeof(dom_html_u_list_element));
+ if (new_node == NULL)
+ return DOM_NO_MEM_ERR;
+
+ err = dom_html_u_list_element_copy_internal(old, new_node);
+ if (err != DOM_NO_ERR) {
+ free(new_node);
+ return err;
+ }
+
+ *copy = (dom_node_internal *) new_node;
+
+ return DOM_NO_ERR;
+}
+
+dom_exception _dom_html_u_list_element_copy_internal(
+ dom_html_u_list_element *old,
+ dom_html_u_list_element *new)
+{
+ dom_exception err;
+
+ err = dom_html_element_copy_internal(old, new);
+ if (err != DOM_NO_ERR) {
+ return err;
+ }
+
+ return DOM_NO_ERR;
}
/*-----------------------------------------------------------------------*/
diff --git a/src/html/html_ulist_element.h b/src/html/html_ulist_element.h
index 6e7e6f9..5541952 100644
--- a/src/html/html_ulist_element.h
+++ b/src/html/html_ulist_element.h
@@ -49,4 +49,13 @@ dom_exception _dom_html_u_list_element_copy(dom_node_internal *old,
_dom_virtual_html_u_list_element_destroy, \
_dom_html_u_list_element_copy
+/* Helper functions*/
+dom_exception _dom_html_u_list_element_copy_internal(
+ dom_html_u_list_element *old,
+ dom_html_u_list_element *new);
+#define dom_html_u_list_element_copy_internal(o, n) \
+ _dom_html_u_list_element_copy_internal( \
+ (dom_html_u_list_element *) (o), \
+ (dom_html_u_list_element *) (n))
+
#endif