summaryrefslogtreecommitdiff
path: root/src/html/html_body_element.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/html/html_body_element.c')
-rw-r--r--src/html/html_body_element.c66
1 files changed, 54 insertions, 12 deletions
diff --git a/src/html/html_body_element.c b/src/html/html_body_element.c
index 8c790b4..812a25c 100644
--- a/src/html/html_body_element.c
+++ b/src/html/html_body_element.c
@@ -7,7 +7,10 @@
#include <stdlib.h>
+#include <dom/html/html_body_element.h>
+
#include "html/html_body_element.h"
+#include "html/html_document.h"
#include "core/node.h"
#include "utils/utils.h"
@@ -27,6 +30,7 @@ static struct dom_element_protected_vtable _protect_vtable = {
* \return DOM_NO_ERR on success, appropriate dom_exception on failure.
*/
dom_exception _dom_html_body_element_create(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
struct dom_html_body_element **ele)
{
struct dom_node_internal *node;
@@ -40,7 +44,7 @@ dom_exception _dom_html_body_element_create(struct dom_html_document *doc,
node->base.vtable = &_dom_element_vtable;
node->vtable = &_protect_vtable;
- return _dom_html_body_element_initialise(doc, *ele);
+ return _dom_html_body_element_initialise(doc, namespace, prefix, *ele);
}
/**
@@ -51,19 +55,11 @@ dom_exception _dom_html_body_element_create(struct dom_html_document *doc,
* \return DOM_NO_ERR on success, appropriate dom_exception on failure.
*/
dom_exception _dom_html_body_element_initialise(struct dom_html_document *doc,
+ dom_string *namespace, dom_string *prefix,
struct dom_html_body_element *ele)
{
- dom_string *name = NULL;
- dom_exception err;
-
- err = dom_string_create((const uint8_t *) "BODY", SLEN("BODY"), &name);
- if (err != DOM_NO_ERR)
- return err;
-
- err = _dom_html_element_initialise(doc, &ele->base, name, NULL, NULL);
- dom_string_unref(name);
-
- return err;
+ return _dom_html_element_initialise(doc, &ele->base,
+ doc->memoised[hds_BODY], namespace, prefix);
}
/**
@@ -118,3 +114,49 @@ dom_exception _dom_html_body_element_copy(dom_node_internal *old,
return _dom_html_element_copy(old, copy);
}
+/*-----------------------------------------------------------------------*/
+/* API functions */
+
+#define SIMPLE_GET(attr) \
+ dom_exception dom_html_body_element_get_##attr( \
+ dom_html_body_element *element, \
+ dom_string **attr) \
+ { \
+ dom_exception ret; \
+ dom_string *_memo_##attr; \
+ \
+ _memo_##attr = \
+ ((struct dom_html_document *) \
+ ((struct dom_node_internal *)element)->owner)->\
+ memoised[hds_##attr]; \
+ \
+ ret = dom_element_get_attribute(element, _memo_##attr, attr); \
+ \
+ return ret; \
+ }
+#define SIMPLE_SET(attr) \
+dom_exception dom_html_body_element_set_##attr( \
+ dom_html_body_element *element, \
+ dom_string *attr) \
+ { \
+ dom_exception ret; \
+ dom_string *_memo_##attr; \
+ \
+ _memo_##attr = \
+ ((struct dom_html_document *) \
+ ((struct dom_node_internal *)element)->owner)->\
+ memoised[hds_##attr]; \
+ \
+ ret = dom_element_set_attribute(element, _memo_##attr, attr); \
+ \
+ return ret; \
+ }
+
+#define SIMPLE_GET_SET(attr) SIMPLE_GET(attr) SIMPLE_SET(attr)
+
+SIMPLE_GET_SET(a_link)
+SIMPLE_GET_SET(background)
+SIMPLE_GET_SET(bg_color)
+SIMPLE_GET_SET(link)
+SIMPLE_GET_SET(text)
+SIMPLE_GET_SET(v_link)