summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRupinder Singh Khokhar <rsk1coder99@gmail.com>2014-06-10 14:47:18 (GMT)
committer Rupinder Singh Khokhar <rsk1coder99@gmail.com>2014-07-17 22:35:05 (GMT)
commitd293e6e7ffdc9224ffba9593f4cc8f73701f2cd5 (patch)
treea620d0d2f56db44778157ac7925b2b8fa9899e5b
parent8045b5015b9f8680cee1489c64b80ad55485eb68 (diff)
downloadlibdom-d293e6e7ffdc9224ffba9593f4cc8f73701f2cd5.tar.gz
libdom-d293e6e7ffdc9224ffba9593f4cc8f73701f2cd5.tar.bz2
This tag gave me a headache for a day or two :P. The problem is that the parser isnt handling the isindex element properly. I have left this tag incomplete right now. Will look at it later on.
-rw-r--r--Makefile1
-rw-r--r--include/dom/dom.h1
-rw-r--r--include/dom/html/html_isindex_element.h1
-rw-r--r--src/html/Makefile3
-rw-r--r--src/html/html_document.c4
-rw-r--r--src/html/html_isindex_element.c81
-rw-r--r--src/html/html_isindex_element.h4
7 files changed, 65 insertions, 30 deletions
diff --git a/Makefile b/Makefile
index 569e554..bcbc27b 100644
--- a/Makefile
+++ b/Makefile
@@ -134,6 +134,7 @@ INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_style_element.h
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_frameset_element.h
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_frame_element.h
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_iframe_element.h
+INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_isindex_element.h
INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR)/pkgconfig:lib$(COMPONENT).pc.in
INSTALL_ITEMS := $(INSTALL_ITEMS) /$(LIBDIR):$(OUTPUT)
diff --git a/include/dom/dom.h b/include/dom/dom.h
index 1392ee0..0dba25d 100644
--- a/include/dom/dom.h
+++ b/include/dom/dom.h
@@ -93,6 +93,7 @@
#include <dom/html/html_frameset_element.h>
#include <dom/html/html_frame_element.h>
#include <dom/html/html_iframe_element.h>
+#include <dom/html/html_isindex_element.h>
/* DOM Events header */
#include <dom/events/events.h>
diff --git a/include/dom/html/html_isindex_element.h b/include/dom/html/html_isindex_element.h
index 966b2d2..d41a149 100644
--- a/include/dom/html/html_isindex_element.h
+++ b/include/dom/html/html_isindex_element.h
@@ -9,6 +9,7 @@
#define dom_html_isindex_element_h_
#include <dom/core/exceptions.h>
+#include <dom/core/string.h>
struct dom_html_form_element;
diff --git a/src/html/Makefile b/src/html/Makefile
index 95550ab..c98ce9a 100644
--- a/src/html/Makefile
+++ b/src/html/Makefile
@@ -18,9 +18,8 @@ DIR_SOURCES := \
html_map_element.c html_script_element.c html_tablecaption_element.c \
html_tablecell_element.c html_tablecol_element.c html_tablesection_element.c \
html_table_element.c html_tablerow_element.c html_frameset_element.c \
- html_frame_element.c html_iframe_element.c
+ html_frame_element.c html_iframe_element.c html_isindex_element.c \
UNINMPLEMENTED_SOURCES := \
- html_isindex_element.c \
include $(NSBUILD)/Makefile.subdir
diff --git a/src/html/html_document.c b/src/html/html_document.c
index cd062a2..6adfedd 100644
--- a/src/html/html_document.c
+++ b/src/html/html_document.c
@@ -60,6 +60,7 @@
#include "html/html_frameset_element.h"
#include "html/html_frame_element.h"
#include "html/html_iframe_element.h"
+#include "html/html_isindex_element.h"
#include "core/attr.h"
#include "core/string.h"
@@ -378,6 +379,9 @@ _dom_html_document_create_element_internal(dom_html_document *html,
} else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_IFRAME])) {
exc = _dom_html_iframe_element_create(html, namespace, prefix,
(dom_html_iframe_element **) result);
+ } else if (dom_string_caseless_isequal(tag_name, html->memoised[hds_ISINDEX])) {
+ exc = _dom_html_isindex_element_create(html, namespace, prefix,
+ (dom_html_isindex_element **) result);
} else {
exc = _dom_html_element_create(html, tag_name, namespace,
prefix, result);
diff --git a/src/html/html_isindex_element.c b/src/html/html_isindex_element.c
index 6dc96b9..e79e011 100644
--- a/src/html/html_isindex_element.c
+++ b/src/html/html_isindex_element.c
@@ -7,9 +7,13 @@
#include <stdlib.h>
+#include <dom/html/html_isindex_element.h>
+
+#include "html/html_document.h"
#include "html/html_isindex_element.h"
#include "core/node.h"
+#include "core/attr.h"
#include "utils/utils.h"
static struct dom_element_protected_vtable _protect_vtable = {
@@ -22,55 +26,41 @@ static struct dom_element_protected_vtable _protect_vtable = {
/**
* Create a dom_html_isindex_element object
*
- * \param doc The document object
- * \param form The form element which contains this element
- * \param ele The returned element object
+ * \param doc The document object
+ * \param ele The returned element object
* \return DOM_NO_ERR on success, appropriate dom_exception on failure.
*/
dom_exception _dom_html_isindex_element_create(struct dom_html_document *doc,
- struct dom_html_form_element *form,
+ dom_string *namespace, dom_string *prefix,
struct dom_html_isindex_element **ele)
{
struct dom_node_internal *node;
-
*ele = malloc(sizeof(dom_html_isindex_element));
if (*ele == NULL)
return DOM_NO_MEM_ERR;
-
+
/* Set up vtables */
node = (struct dom_node_internal *) *ele;
node->base.vtable = &_dom_html_element_vtable;
node->vtable = &_protect_vtable;
- return _dom_html_isindex_element_initialise(doc, form, *ele);
+ return _dom_html_isindex_element_initialise(doc, namespace, prefix, *ele);
}
/**
* Initialise a dom_html_isindex_element object
*
- * \param doc The document object
- * \param form The form element which contains this element
- * \param ele The dom_html_isindex_element object
+ * \param doc The document object
+ * \param ele The dom_html_isindex_element object
* \return DOM_NO_ERR on success, appropriate dom_exception on failure.
*/
dom_exception _dom_html_isindex_element_initialise(struct dom_html_document *doc,
- struct dom_html_form_element *form,
+ dom_string *namespace, dom_string *prefix,
struct dom_html_isindex_element *ele)
{
- dom_string *name = NULL;
- dom_exception err;
-
- UNUSED(form);
-
- err = dom_string_create((const uint8_t *) "ISINDEX", SLEN("ISINDEX"),
- &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_ISINDEX],
+ namespace, prefix);
}
/**
@@ -125,7 +115,46 @@ dom_exception _dom_html_isindex_element_copy(dom_node_internal *old,
return _dom_html_element_copy(old, copy);
}
-
+/*-----------------------------------------------------------------------*/
+/* API functions */
+
+#define SIMPLE_GET(attr) \
+ dom_exception dom_html_isindex_element_get_##attr( \
+ dom_html_isindex_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_isindex_element_set_##attr( \
+ dom_html_isindex_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(prompt);
/*-----------------------------------------------------------------------*/
/* Public APIs */
diff --git a/src/html/html_isindex_element.h b/src/html/html_isindex_element.h
index 12ad26e..a39170b 100644
--- a/src/html/html_isindex_element.h
+++ b/src/html/html_isindex_element.h
@@ -19,12 +19,12 @@ struct dom_html_isindex_element {
/* Create a dom_html_isindex_element object */
dom_exception _dom_html_isindex_element_create(struct dom_html_document *doc,
- struct dom_html_form_element *form,
+ dom_string *namespace, dom_string *prefix,
struct dom_html_isindex_element **ele);
/* Initialise a dom_html_isindex_element object */
dom_exception _dom_html_isindex_element_initialise(struct dom_html_document *doc,
- struct dom_html_form_element *form,
+ dom_string *namespace, dom_string *prefix,
struct dom_html_isindex_element *ele);
/* Finalise a dom_html_isindex_element object */