From 890da96b1b601f622a12a7832c3cb654b146e693 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Sat, 7 Jul 2012 18:12:12 +0100 Subject: HTMLMetaElement: Implement, install, enable tests --- Makefile | 1 + include/dom/dom.h | 1 + include/dom/html/html_meta_element.h | 26 ++++++++++ src/html/html_document.c | 1 + src/html/html_document_strings.h | 5 ++ src/html/html_meta_element.c | 57 +++++++++++++++++----- src/html/html_meta_element.h | 2 + .../tests/level1/html/HTMLMetaElement01.xml | 42 ++++++++++++++++ .../tests/level1/html/HTMLMetaElement01.xml.kfail | 42 ---------------- .../tests/level1/html/HTMLMetaElement02.xml | 42 ++++++++++++++++ .../tests/level1/html/HTMLMetaElement02.xml.kfail | 42 ---------------- .../tests/level1/html/HTMLMetaElement03.xml | 42 ++++++++++++++++ .../tests/level1/html/HTMLMetaElement03.xml.kfail | 42 ---------------- .../tests/level1/html/HTMLMetaElement04.xml | 42 ++++++++++++++++ .../tests/level1/html/HTMLMetaElement04.xml.kfail | 42 ---------------- 15 files changed, 249 insertions(+), 180 deletions(-) create mode 100644 test/testcases/tests/level1/html/HTMLMetaElement01.xml delete mode 100644 test/testcases/tests/level1/html/HTMLMetaElement01.xml.kfail create mode 100644 test/testcases/tests/level1/html/HTMLMetaElement02.xml delete mode 100644 test/testcases/tests/level1/html/HTMLMetaElement02.xml.kfail create mode 100644 test/testcases/tests/level1/html/HTMLMetaElement03.xml delete mode 100644 test/testcases/tests/level1/html/HTMLMetaElement03.xml.kfail create mode 100644 test/testcases/tests/level1/html/HTMLMetaElement04.xml delete mode 100644 test/testcases/tests/level1/html/HTMLMetaElement04.xml.kfail diff --git a/Makefile b/Makefile index ff328e6..a66bee0 100644 --- a/Makefile +++ b/Makefile @@ -86,6 +86,7 @@ INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_html_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_head_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_link_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_title_element.h +INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_meta_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_form_element.h INSTALL_ITEMS := $(INSTALL_ITEMS) /lib/pkgconfig:lib$(COMPONENT).pc.in diff --git a/include/dom/dom.h b/include/dom/dom.h index 1c0e908..05ce3e6 100644 --- a/include/dom/dom.h +++ b/include/dom/dom.h @@ -45,6 +45,7 @@ #include #include #include +#include #include /* DOM Events header */ diff --git a/include/dom/html/html_meta_element.h b/include/dom/html/html_meta_element.h index 8ceb459..b9898f1 100644 --- a/include/dom/html/html_meta_element.h +++ b/include/dom/html/html_meta_element.h @@ -8,7 +8,33 @@ #ifndef dom_html_meta_element_h_ #define dom_html_meta_element_h_ +#include + typedef struct dom_html_meta_element dom_html_meta_element; +dom_exception dom_html_meta_element_get_content(dom_html_meta_element *ele, + dom_string **content); + +dom_exception dom_html_meta_element_set_content(dom_html_meta_element *ele, + dom_string *content); + +dom_exception dom_html_meta_element_get_http_equiv(dom_html_meta_element *ele, + dom_string **http_equiv); + +dom_exception dom_html_meta_element_set_http_equiv(dom_html_meta_element *ele, + dom_string *http_equiv); + +dom_exception dom_html_meta_element_get_name(dom_html_meta_element *ele, + dom_string **name); + +dom_exception dom_html_meta_element_set_name(dom_html_meta_element *ele, + dom_string *name); + +dom_exception dom_html_meta_element_get_scheme(dom_html_meta_element *ele, + dom_string **scheme); + +dom_exception dom_html_meta_element_set_scheme(dom_html_meta_element *ele, + dom_string *scheme); + #endif diff --git a/src/html/html_document.c b/src/html/html_document.c index ae36454..b266844 100644 --- a/src/html/html_document.c +++ b/src/html/html_document.c @@ -15,6 +15,7 @@ #include "html/html_head_element.h" #include "html/html_link_element.h" #include "html/html_title_element.h" +#include "html/html_meta_element.h" #include "html/html_form_element.h" #include "core/string.h" diff --git a/src/html/html_document_strings.h b/src/html/html_document_strings.h index b092c9e..632b686 100644 --- a/src/html/html_document_strings.h +++ b/src/html/html_document_strings.h @@ -45,6 +45,11 @@ HTML_DOCUMENT_STRINGS_ACTION1(rel) HTML_DOCUMENT_STRINGS_ACTION1(rev) HTML_DOCUMENT_STRINGS_ACTION1(target) HTML_DOCUMENT_STRINGS_ACTION1(type) +/* Useful attributes used by HTMLMetaElement */ +HTML_DOCUMENT_STRINGS_ACTION1(content) +HTML_DOCUMENT_STRINGS_ACTION(http_equiv,http-equiv) +HTML_DOCUMENT_STRINGS_ACTION1(name) +HTML_DOCUMENT_STRINGS_ACTION1(scheme) /* Useful attributes used by HTMLFormElement */ HTML_DOCUMENT_STRINGS_ACTION(accept_charset,accept-charset) HTML_DOCUMENT_STRINGS_ACTION1(action) diff --git a/src/html/html_meta_element.c b/src/html/html_meta_element.c index f1b6c3f..9cc8067 100644 --- a/src/html/html_meta_element.c +++ b/src/html/html_meta_element.c @@ -7,6 +7,7 @@ #include +#include "html/html_document.h" #include "html/html_meta_element.h" #include "core/node.h" @@ -27,6 +28,7 @@ static struct dom_element_protected_vtable _protect_vtable = { * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_meta_element_create(struct dom_html_document *doc, + dom_string *namespace, dom_string *prefix, struct dom_html_meta_element **ele) { struct dom_node_internal *node; @@ -40,7 +42,7 @@ dom_exception _dom_html_meta_element_create(struct dom_html_document *doc, node->base.vtable = &_dom_element_vtable; node->vtable = &_protect_vtable; - return _dom_html_meta_element_initialise(doc, *ele); + return _dom_html_meta_element_initialise(doc, namespace, prefix, *ele); } /** @@ -51,19 +53,12 @@ dom_exception _dom_html_meta_element_create(struct dom_html_document *doc, * \return DOM_NO_ERR on success, appropriate dom_exception on failure. */ dom_exception _dom_html_meta_element_initialise(struct dom_html_document *doc, + dom_string *namespace, dom_string *prefix, struct dom_html_meta_element *ele) { - dom_string *name = NULL; - dom_exception err; - - err = dom_string_create((const uint8_t *) "META", SLEN("META"), &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_META], + namespace, prefix); } /** @@ -118,3 +113,41 @@ dom_exception _dom_html_meta_element_copy(dom_node_internal *old, return _dom_html_element_copy(old, copy); } +/*-----------------------------------------------------------------------*/ +/* API functions */ + +#define SIMPLE_GET_SET(fattr,attr) \ +dom_exception dom_html_meta_element_get_##fattr(dom_html_meta_element *element, \ + dom_string **fattr) \ +{ \ + 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, fattr); \ + \ + return ret; \ +} \ + \ +dom_exception dom_html_meta_element_set_##fattr(dom_html_meta_element *element, \ + dom_string *fattr) \ +{ \ + 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, fattr); \ + \ + return ret; \ +} + +SIMPLE_GET_SET(content,content) +SIMPLE_GET_SET(http_equiv,http_equiv) +SIMPLE_GET_SET(name,name) +SIMPLE_GET_SET(scheme,scheme) diff --git a/src/html/html_meta_element.h b/src/html/html_meta_element.h index d302d24..d4a1076 100644 --- a/src/html/html_meta_element.h +++ b/src/html/html_meta_element.h @@ -19,10 +19,12 @@ struct dom_html_meta_element { /* Create a dom_html_meta_element object */ dom_exception _dom_html_meta_element_create(struct dom_html_document *doc, + dom_string *namespace, dom_string *prefix, struct dom_html_meta_element **ele); /* Initialise a dom_html_meta_element object */ dom_exception _dom_html_meta_element_initialise(struct dom_html_document *doc, + dom_string *namespace, dom_string *prefix, struct dom_html_meta_element *ele); /* Finalise a dom_html_meta_element object */ diff --git a/test/testcases/tests/level1/html/HTMLMetaElement01.xml b/test/testcases/tests/level1/html/HTMLMetaElement01.xml new file mode 100644 index 0000000..5ee3bcc --- /dev/null +++ b/test/testcases/tests/level1/html/HTMLMetaElement01.xml @@ -0,0 +1,42 @@ + + + + + + + +HTMLMetaElement01 +NIST + + The content attribute specifies associated information. + + Retrieve the content attribute and examine its value. + +Mary Brady +2002-02-22 + + + + + + + + + + + + + diff --git a/test/testcases/tests/level1/html/HTMLMetaElement01.xml.kfail b/test/testcases/tests/level1/html/HTMLMetaElement01.xml.kfail deleted file mode 100644 index 5ee3bcc..0000000 --- a/test/testcases/tests/level1/html/HTMLMetaElement01.xml.kfail +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - -HTMLMetaElement01 -NIST - - The content attribute specifies associated information. - - Retrieve the content attribute and examine its value. - -Mary Brady -2002-02-22 - - - - - - - - - - - - - diff --git a/test/testcases/tests/level1/html/HTMLMetaElement02.xml b/test/testcases/tests/level1/html/HTMLMetaElement02.xml new file mode 100644 index 0000000..11e7a09 --- /dev/null +++ b/test/testcases/tests/level1/html/HTMLMetaElement02.xml @@ -0,0 +1,42 @@ + + + + + + + +HTMLMetaElement02 +NIST + + The httpEquiv attribute specifies an HTTP respnse header name. + + Retrieve the httpEquiv attribute and examine its value. + +Mary Brady +2002-02-22 + + + + + + + + + + + + + diff --git a/test/testcases/tests/level1/html/HTMLMetaElement02.xml.kfail b/test/testcases/tests/level1/html/HTMLMetaElement02.xml.kfail deleted file mode 100644 index 11e7a09..0000000 --- a/test/testcases/tests/level1/html/HTMLMetaElement02.xml.kfail +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - -HTMLMetaElement02 -NIST - - The httpEquiv attribute specifies an HTTP respnse header name. - - Retrieve the httpEquiv attribute and examine its value. - -Mary Brady -2002-02-22 - - - - - - - - - - - - - diff --git a/test/testcases/tests/level1/html/HTMLMetaElement03.xml b/test/testcases/tests/level1/html/HTMLMetaElement03.xml new file mode 100644 index 0000000..ab3afc7 --- /dev/null +++ b/test/testcases/tests/level1/html/HTMLMetaElement03.xml @@ -0,0 +1,42 @@ + + + + + + + +HTMLMetaElement03 +NIST + + The name attribute specifies the meta information name. + + Retrieve the name attribute and examine its value. + +Mary Brady +2002-02-22 + + + + + + + + + + + + + diff --git a/test/testcases/tests/level1/html/HTMLMetaElement03.xml.kfail b/test/testcases/tests/level1/html/HTMLMetaElement03.xml.kfail deleted file mode 100644 index ab3afc7..0000000 --- a/test/testcases/tests/level1/html/HTMLMetaElement03.xml.kfail +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - -HTMLMetaElement03 -NIST - - The name attribute specifies the meta information name. - - Retrieve the name attribute and examine its value. - -Mary Brady -2002-02-22 - - - - - - - - - - - - - diff --git a/test/testcases/tests/level1/html/HTMLMetaElement04.xml b/test/testcases/tests/level1/html/HTMLMetaElement04.xml new file mode 100644 index 0000000..14ce0eb --- /dev/null +++ b/test/testcases/tests/level1/html/HTMLMetaElement04.xml @@ -0,0 +1,42 @@ + + + + + + + +HTMLMetaElement04 +NIST + + The scheme attribute specifies a select form of content. + + Retrieve the scheme attribute and examine its value. + +Mary Brady +2002-02-22 + + + + + + + + + + + + + diff --git a/test/testcases/tests/level1/html/HTMLMetaElement04.xml.kfail b/test/testcases/tests/level1/html/HTMLMetaElement04.xml.kfail deleted file mode 100644 index 14ce0eb..0000000 --- a/test/testcases/tests/level1/html/HTMLMetaElement04.xml.kfail +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - -HTMLMetaElement04 -NIST - - The scheme attribute specifies a select form of content. - - Retrieve the scheme attribute and examine its value. - -Mary Brady -2002-02-22 - - - - - - - - - - - - - -- cgit v1.2.3