summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <michael.drake@codethink.co.uk>2016-02-05 18:12:59 (GMT)
committer Michael Drake <michael.drake@codethink.co.uk>2016-02-05 18:12:59 (GMT)
commitb26b3cfb60f130a06ce31ede6620ae37425422b2 (patch)
treeb990c831ecf3e451546e26721cf23a36607064fd
parent848c41de94e3205f8b7458be1c4786ad5fb9b9fb (diff)
downloadlibdom-b26b3cfb60f130a06ce31ede6620ae37425422b2.tar.gz
libdom-b26b3cfb60f130a06ce31ede6620ae37425422b2.tar.bz2
Provide generic copy constructor for HTMLTextAreaElement.
-rw-r--r--src/html/html_text_area_element.c35
-rw-r--r--src/html/html_text_area_element.h9
2 files changed, 41 insertions, 3 deletions
diff --git a/src/html/html_text_area_element.c b/src/html/html_text_area_element.c
index bbc9789..5677cf7 100644
--- a/src/html/html_text_area_element.c
+++ b/src/html/html_text_area_element.c
@@ -301,10 +301,39 @@ 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;
+ }
+
+ 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(