Gitweb links:
...log
http://git.netsurf-browser.org/libdom.git/shortlog/2f79b302848cc25c05c3dfb80fd425f3c1d97bd8
...commit
http://git.netsurf-browser.org/libdom.git/commit/2f79b302848cc25c05c3dfb80fd425f3c1d97bd8
...tree
http://git.netsurf-browser.org/libdom.git/tree/2f79b302848cc25c05c3dfb80fd425f3c1d97bd8
The branch, dsilvers/forms1 has been created
at 2f79b302848cc25c05c3dfb80fd425f3c1d97bd8 (commit)
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/libdom.git/commit/?id=2f79b302848cc25c05c3dfb80fd425f3c1d97bd8
commit 2f79b302848cc25c05c3dfb80fd425f3c1d97bd8
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
Ensure we install the extra headers
diff --git a/Makefile b/Makefile
index 984a020..6db4201 100644
--- a/Makefile
+++ b/Makefile
@@ -89,6 +89,8 @@ Is := include/dom/html
I := /$(INCLUDEDIR)/dom/html
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_document.h
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_collection.h
+INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_radio_nodelist.h
+INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_form_controls_collection.h
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_element.h
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_elements.h
INSTALL_ITEMS := $(INSTALL_ITEMS) $(I):$(Is)/html_html_element.h
commitdiff
http://git.netsurf-browser.org/libdom.git/commit/?id=e60642b7cd8a8e23e7963c44dbbc8cd879d88372
commit e60642b7cd8a8e23e7963c44dbbc8cd879d88372
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
stuff; form controls collection initial impl
diff --git a/include/dom/html/html_form_element.h
b/include/dom/html/html_form_element.h
index 6a64dff..fe4bf3f 100644
--- a/include/dom/html/html_form_element.h
+++ b/include/dom/html/html_form_element.h
@@ -11,12 +11,12 @@
#include <dom/core/exceptions.h>
#include <dom/core/string.h>
-struct dom_html_form_controls_collection;
+#include <dom/html/html_form_controls_collection.h>
typedef struct dom_html_form_element dom_html_form_element;
dom_exception dom_html_form_element_get_elements(dom_html_form_element *ele,
- struct dom_html_form_controls_collection **col);
+ dom_html_form_controls_collection **col);
dom_exception dom_html_form_element_get_length(dom_html_form_element *ele,
uint32_t *len);
diff --git a/src/html/Makefile b/src/html/Makefile
index c98ce9a..cf864bb 100644
--- a/src/html/Makefile
+++ b/src/html/Makefile
@@ -3,7 +3,7 @@ DIR_SOURCES := \
html_document.c html_collection.c html_options_collection.c \
html_element.c html_html_element.c html_head_element.c \
html_link_element.c html_title_element.c html_meta_element.c \
- html_base_element.c html_style_element.c \
+ html_base_element.c html_style_element.c
html_form_controls_collection.c \
html_body_element.c html_form_element.c html_select_element.c \
html_button_element.c html_input_element.c html_text_area_element.c \
html_opt_group_element.c html_option_element.c html_hr_element.c \
diff --git a/src/html/html_form_controls_collection.c
b/src/html/html_form_controls_collection.c
new file mode 100644
index 0000000..34a3bb4
--- /dev/null
+++ b/src/html/html_form_controls_collection.c
@@ -0,0 +1,71 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2018 Daniel Silverstone <[email protected]>
+ */
+
+#include <assert.h>
+#include <stdlib.h>
+
+#include <libwapcaplet/libwapcaplet.h>
+
+#include "html/html_form_controls_collection.h"
+#include "html/html_document.h"
+#include "html/html_form_element.h"
+
+#include "html/html_input_element.h"
+#include "html/html_select_element.h"
+#include "html/html_text_area_element.h"
+#include "html/html_button_element.h"
+
+#include "core/node.h"
+#include "core/element.h"
+#include "core/string.h"
+
+static bool _dom_is_form_control(struct dom_node_internal *node, void *ctx);
+
+/*-----------------------------------------------------------------------*/
+/* Internal functions */
+
+/* Callback function to test whether certain node is a form control, see
+ * src/html/html_collection.h for detail. */
+static bool _dom_is_form_control(struct dom_node_internal *node, void *ctx)
+{
+ struct dom_html_document *doc =
+ (struct dom_html_document *)(node->owner);
+ struct dom_html_form_element *form = ctx;
+
+
+ assert(node->type == DOM_ELEMENT_NODE);
+
+ /* Form controls are INPUT TEXTAREA SELECT and BUTTON*/
+ if (dom_string_caseless_isequal(node->name,
+
doc->elements[DOM_HTML_ELEMENT_TYPE_INPUT]))
+ return ((dom_html_input_element *)node)->form == form;
+ if (dom_string_caseless_isequal(node->name,
+
doc->elements[DOM_HTML_ELEMENT_TYPE_TEXTAREA]))
+ return ((dom_html_text_area_element *)node)->form == form;
+ if (dom_string_caseless_isequal(node->name,
+
doc->elements[DOM_HTML_ELEMENT_TYPE_SELECT]))
+ return ((dom_html_select_element *)node)->form == form;
+ if (dom_string_caseless_isequal(node->name,
+
doc->elements[DOM_HTML_ELEMENT_TYPE_BUTTON])) {
+ return ((dom_html_button_element *)node)->form == form;
+ }
+
+ return false;
+}
+
+
+dom_exception _dom_html_form_controls_collection_create(struct
dom_html_form_element *form,
+ dom_html_form_controls_collection **col)
+{
+ dom_html_document *doc = (dom_html_document *) dom_node_get_owner(form);
+
+ assert(doc != NULL);
+
+ return _dom_html_collection_create(doc,
+ (dom_node_internal *) doc,
+ _dom_is_form_control, form, col);
+}
diff --git a/src/html/html_form_controls_collection.h
b/src/html/html_form_controls_collection.h
new file mode 100644
index 0000000..36cdce0
--- /dev/null
+++ b/src/html/html_form_controls_collection.h
@@ -0,0 +1,20 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2018 Daniel Silverstone <[email protected]>
+ */
+
+#ifndef dom_internal_html_form_controls_collection_h_
+#define dom_internal_html_form_controls_collection_h_
+
+#include <dom/html/html_form_controls_collection.h>
+
+#include "html/html_collection.h"
+
+struct dom_html_form_element;
+
+dom_exception _dom_html_form_controls_collection_create(struct
dom_html_form_element *form,
+ dom_html_form_controls_collection **col);
+
+#endif
diff --git a/src/html/html_form_element.c b/src/html/html_form_element.c
index bc71440..ca11706 100644
--- a/src/html/html_form_element.c
+++ b/src/html/html_form_element.c
@@ -11,12 +11,8 @@
#include <dom/html/html_form_element.h>
#include "html/html_form_element.h"
-#include "html/html_input_element.h"
-#include "html/html_select_element.h"
-#include "html/html_text_area_element.h"
-#include "html/html_button_element.h"
-#include "html/html_collection.h"
+#include "html/html_form_controls_collection.h"
#include "html/html_document.h"
#include "core/node.h"
@@ -29,8 +25,6 @@ static struct dom_element_protected_vtable _protect_vtable = {
DOM_HTML_FORM_ELEMENT_PROTECT_VTABLE
};
-static bool _dom_is_form_control(struct dom_node_internal *node, void *ctx);
-
/**
* Create a dom_html_form_element object
*
@@ -173,22 +167,17 @@ dom_exception _dom_html_form_element_copy_internal(
* \return DOM_NO_ERR on success, appropriate dom_exception on failure.
*/
dom_exception dom_html_form_element_get_elements(dom_html_form_element *ele,
- struct dom_html_collection **col)
+ dom_html_form_controls_collection **col)
{
dom_exception err;
- dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele);
-
- assert(doc != NULL);
if (ele->elements != NULL) {
dom_html_form_controls_collection_ref(ele->elements);
*col = ele->elements;
return DOM_NO_ERR;
}
-
- err = _dom_html_collection_create(doc,
- (dom_node_internal *) doc,
- _dom_is_form_control, ele, col);
+
+ err = _dom_html_form_controls_collection_create(ele, col);
if (err == DOM_NO_ERR) {
dom_html_form_controls_collection_ref(*col);
@@ -209,10 +198,8 @@ dom_exception
dom_html_form_element_get_length(dom_html_form_element *ele,
uint32_t *len)
{
dom_exception err;
- dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele);
dom_html_form_controls_collection *col;
- assert(doc != NULL);
err = dom_html_form_element_get_elements(ele, &col);
if (err != DOM_NO_ERR)
return err;
@@ -310,36 +297,3 @@ dom_exception
dom_html_form_element_reset(dom_html_form_element *ele)
doc->memoised[hds_reset], true,
true, &success);
}
-
-/*-----------------------------------------------------------------------*/
-/* Internal functions */
-
-/* Callback function to test whether certain node is a form control, see
- * src/html/html_collection.h for detail. */
-static bool _dom_is_form_control(struct dom_node_internal *node, void *ctx)
-{
- struct dom_html_document *doc =
- (struct dom_html_document *)(node->owner);
- struct dom_html_form_element *form = ctx;
-
-
- assert(node->type == DOM_ELEMENT_NODE);
-
- /* Form controls are INPUT TEXTAREA SELECT and BUTTON*/
- if (dom_string_caseless_isequal(node->name,
-
doc->elements[DOM_HTML_ELEMENT_TYPE_INPUT]))
- return ((dom_html_input_element *)node)->form == form;
- if (dom_string_caseless_isequal(node->name,
-
doc->elements[DOM_HTML_ELEMENT_TYPE_TEXTAREA]))
- return ((dom_html_text_area_element *)node)->form == form;
- if (dom_string_caseless_isequal(node->name,
-
doc->elements[DOM_HTML_ELEMENT_TYPE_SELECT]))
- return ((dom_html_select_element *)node)->form == form;
- if (dom_string_caseless_isequal(node->name,
-
doc->elements[DOM_HTML_ELEMENT_TYPE_BUTTON])) {
- return ((dom_html_button_element *)node)->form == form;
- }
-
- return false;
-}
-
diff --git a/src/html/html_form_element.h b/src/html/html_form_element.h
index 43ed49f..4a75379 100644
--- a/src/html/html_form_element.h
+++ b/src/html/html_form_element.h
@@ -12,12 +12,10 @@
#include "html/html_element.h"
-struct dom_html_form_controls_collection;
-
struct dom_html_form_element {
struct dom_html_element base;
/**< The base class */
- struct dom_html_form_controls_collection *elements;
+ dom_html_form_controls_collection *elements;
/**< The elements collection (memoised) */
};
commitdiff
http://git.netsurf-browser.org/libdom.git/commit/?id=25eb4f93dd6b130bc262a824326f98ba337f32e4
commit 25eb4f93dd6b130bc262a824326f98ba337f32e4
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
foldme; form controls collection underscores (headers)
diff --git a/include/dom/html/html_form_controls_collection.h
b/include/dom/html/html_form_controls_collection.h
index 45c30d6..23a1725 100644
--- a/include/dom/html/html_form_controls_collection.h
+++ b/include/dom/html/html_form_controls_collection.h
@@ -5,8 +5,8 @@
* Copyright 2018 Daniel Silverstone <[email protected]>
*/
-#ifndef dom_html_formcontrolscollection_h_
-#define dom_html_formcontrolscollection_h_
+#ifndef dom_html_form_controls_collection_h_
+#define dom_html_form_controls_collection_h_
#include <dom/core/exceptions.h>
#include <dom/core/string.h>
@@ -14,24 +14,24 @@
struct dom_node;
struct dom_html_radionodelist;
-typedef struct dom_html_collection dom_html_formcontrolscollection;
+typedef struct dom_html_collection dom_html_form_controls_collection;
-#define dom_html_formcontrolscollection_get_length(col, len) \
+#define dom_html_form_controls_collection_get_length(col, len) \
dom_html_collection_get_length((dom_html_collection *)(col), (len))
-#define dom_html_formcontrolscollection_item(col, index, node) \
+#define dom_html_form_controls_collection_item(col, index, node)
\
dom_html_collection((dom_html_collection *)(col), (index), (node))
-#define dom_html_formcontrolscollection_named_item(col, name, node) \
+#define dom_html_form_controls_collection_named_item(col, name, node) \
dom_html_collection((dom_html_collection *)(col), (name), (node))
-dom_exception
dom_html_formcontrolscollection_named_items(dom_html_formcontrolscollection
*col,
+dom_exception
dom_html_form_controls_collection_named_items(dom_html_form_controls_collection
*col,
dom_string *name, struct dom_html_radionodelist **nodes);
-#define dom_html_formcontrolscollection_ref(col) \
+#define dom_html_form_controls_collection_ref(col) \
dom_html_collection_ref((dom_html_collection *)(col))
-#define dom_html_formcontrolscollection_unref(col) \
+#define dom_html_form_controls_collection_unref(col) \
dom_html_collection_unref((dom_html_collection *)(col))
#endif
commitdiff
http://git.netsurf-browser.org/libdom.git/commit/?id=617864f69943446e72b6ba0bbe56d87b76aa0d5c
commit 617864f69943446e72b6ba0bbe56d87b76aa0d5c
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
foldme; form controls collection is a newtype (headers)
diff --git a/include/dom/html/html_form_controls_collection.h
b/include/dom/html/html_form_controls_collection.h
index db3039b..45c30d6 100644
--- a/include/dom/html/html_form_controls_collection.h
+++ b/include/dom/html/html_form_controls_collection.h
@@ -14,19 +14,25 @@
struct dom_node;
struct dom_html_radionodelist;
-typedef struct dom_html_formcontrolscollection dom_html_formcontrolscollection;
-
-dom_exception
dom_html_formcontrolscollection_get_length(dom_html_formcontrolscollection *col,
- uint32_t *len);
-dom_exception
dom_html_formcontrolscollection_item(dom_html_formcontrolscollection *col,
- uint32_t index, struct dom_node **node);
-dom_exception
dom_html_formcontrolscollection_named_item(dom_html_formcontrolscollection *col,
- dom_string *name, struct dom_node **node);
+typedef struct dom_html_collection dom_html_formcontrolscollection;
+
+#define dom_html_formcontrolscollection_get_length(col, len) \
+ dom_html_collection_get_length((dom_html_collection *)(col), (len))
+
+#define dom_html_formcontrolscollection_item(col, index, node) \
+ dom_html_collection((dom_html_collection *)(col), (index), (node))
+
+#define dom_html_formcontrolscollection_named_item(col, name, node) \
+ dom_html_collection((dom_html_collection *)(col), (name), (node))
+
dom_exception
dom_html_formcontrolscollection_named_items(dom_html_formcontrolscollection
*col,
dom_string *name, struct dom_html_radionodelist **nodes);
-void dom_html_formcontrolscollection_ref(dom_html_formcontrolscollection *col);
-void dom_html_formcontrolscollection_unref(dom_html_formcontrolscollection
*col);
+#define dom_html_formcontrolscollection_ref(col) \
+ dom_html_collection_ref((dom_html_collection *)(col))
+
+#define dom_html_formcontrolscollection_unref(col) \
+ dom_html_collection_unref((dom_html_collection *)(col))
#endif
commitdiff
http://git.netsurf-browser.org/libdom.git/commit/?id=fcf43a06d1ccf27c5051177b187430456547e80f
commit fcf43a06d1ccf27c5051177b187430456547e80f
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
HTMLFormElement.elements is [sameobject]
diff --git a/src/html/html_form_element.c b/src/html/html_form_element.c
index 1dd1992..bc71440 100644
--- a/src/html/html_form_element.c
+++ b/src/html/html_form_element.c
@@ -71,6 +71,8 @@ dom_exception _dom_html_form_element_initialise(
err = _dom_html_element_initialise(params, &ele->base);
+ ele->elements = NULL;
+
return err;
}
@@ -81,6 +83,10 @@ dom_exception _dom_html_form_element_initialise(
*/
void _dom_html_form_element_finalise(struct dom_html_form_element *ele)
{
+ if (ele->elements != NULL) {
+ dom_html_form_controls_collection_unref(ele->elements);
+ ele->elements = NULL;
+ }
_dom_html_element_finalise(&ele->base);
}
@@ -173,9 +179,22 @@ dom_exception
dom_html_form_element_get_elements(dom_html_form_element *ele,
dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele);
assert(doc != NULL);
+
+ if (ele->elements != NULL) {
+ dom_html_form_controls_collection_ref(ele->elements);
+ *col = ele->elements;
+ return DOM_NO_ERR;
+ }
+
err = _dom_html_collection_create(doc,
(dom_node_internal *) doc,
_dom_is_form_control, ele, col);
+
+ if (err == DOM_NO_ERR) {
+ dom_html_form_controls_collection_ref(*col);
+ ele->elements = *col;
+ }
+
return err;
}
@@ -191,19 +210,17 @@ dom_exception
dom_html_form_element_get_length(dom_html_form_element *ele,
{
dom_exception err;
dom_html_document *doc = (dom_html_document *) dom_node_get_owner(ele);
- dom_html_collection *col;
+ dom_html_form_controls_collection *col;
assert(doc != NULL);
- err = _dom_html_collection_create(doc,
- (dom_node_internal *) doc,
- _dom_is_form_control, ele, &col);
+ err = dom_html_form_element_get_elements(ele, &col);
if (err != DOM_NO_ERR)
return err;
- err = dom_html_collection_get_length(col, len);
+ err = dom_html_form_controls_collection_get_length(col, len);
- dom_html_collection_unref(col);
+ dom_html_form_controls_collection_unref(col);
return err;
}
diff --git a/src/html/html_form_element.h b/src/html/html_form_element.h
index 4987820..43ed49f 100644
--- a/src/html/html_form_element.h
+++ b/src/html/html_form_element.h
@@ -12,11 +12,13 @@
#include "html/html_element.h"
-struct dom_html_collection;
+struct dom_html_form_controls_collection;
struct dom_html_form_element {
struct dom_html_element base;
/**< The base class */
+ struct dom_html_form_controls_collection *elements;
+ /**< The elements collection (memoised) */
};
/* Create a dom_html_form_element object */
commitdiff
http://git.netsurf-browser.org/libdom.git/commit/?id=0152054b42e2a277aba4fdd6523f7455206c5c97
commit 0152054b42e2a277aba4fdd6523f7455206c5c97
Author: Daniel Silverstone <[email protected]>
Commit: Daniel Silverstone <[email protected]>
reword; public api changes for new collections
diff --git a/include/dom/dom.h b/include/dom/dom.h
index 0740fe9..26f139c 100644
--- a/include/dom/dom.h
+++ b/include/dom/dom.h
@@ -40,6 +40,8 @@
/* DOM HTML headers */
#include <dom/html/html_collection.h>
+#include <dom/html/html_radio_nodelist.h>
+#include <dom/html/html_form_controls_collection.h>
#include <dom/html/html_document.h>
#include <dom/html/html_element.h>
#include <dom/html/html_html_element.h>
diff --git a/include/dom/html/html_form_controls_collection.h
b/include/dom/html/html_form_controls_collection.h
new file mode 100644
index 0000000..db3039b
--- /dev/null
+++ b/include/dom/html/html_form_controls_collection.h
@@ -0,0 +1,32 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2018 Daniel Silverstone <[email protected]>
+ */
+
+#ifndef dom_html_formcontrolscollection_h_
+#define dom_html_formcontrolscollection_h_
+
+#include <dom/core/exceptions.h>
+#include <dom/core/string.h>
+
+struct dom_node;
+struct dom_html_radionodelist;
+
+typedef struct dom_html_formcontrolscollection dom_html_formcontrolscollection;
+
+dom_exception
dom_html_formcontrolscollection_get_length(dom_html_formcontrolscollection *col,
+ uint32_t *len);
+dom_exception
dom_html_formcontrolscollection_item(dom_html_formcontrolscollection *col,
+ uint32_t index, struct dom_node **node);
+dom_exception
dom_html_formcontrolscollection_named_item(dom_html_formcontrolscollection *col,
+ dom_string *name, struct dom_node **node);
+dom_exception
dom_html_formcontrolscollection_named_items(dom_html_formcontrolscollection
*col,
+ dom_string *name, struct dom_html_radionodelist **nodes);
+
+void dom_html_formcontrolscollection_ref(dom_html_formcontrolscollection *col);
+void dom_html_formcontrolscollection_unref(dom_html_formcontrolscollection
*col);
+
+#endif
+
diff --git a/include/dom/html/html_form_element.h
b/include/dom/html/html_form_element.h
index 81637a3..6a64dff 100644
--- a/include/dom/html/html_form_element.h
+++ b/include/dom/html/html_form_element.h
@@ -11,12 +11,12 @@
#include <dom/core/exceptions.h>
#include <dom/core/string.h>
-struct dom_html_collection;
+struct dom_html_form_controls_collection;
typedef struct dom_html_form_element dom_html_form_element;
dom_exception dom_html_form_element_get_elements(dom_html_form_element *ele,
- struct dom_html_collection **col);
+ struct dom_html_form_controls_collection **col);
dom_exception dom_html_form_element_get_length(dom_html_form_element *ele,
uint32_t *len);
diff --git a/include/dom/html/html_radio_nodelist.h
b/include/dom/html/html_radio_nodelist.h
new file mode 100644
index 0000000..502df38
--- /dev/null
+++ b/include/dom/html/html_radio_nodelist.h
@@ -0,0 +1,33 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2018 Daniel Silverstone <[email protected]>
+ */
+
+#ifndef dom_html_radionodelist_h_
+#define dom_html_radionodelist_h_
+
+#include <dom/core/exceptions.h>
+#include <dom/core/string.h>
+
+struct dom_node;
+
+typedef struct dom_html_radionodelist dom_html_radionodelist;
+
+dom_exception dom_html_radionodelist_get_length(dom_html_radionodelist *col,
+ uint32_t *len);
+dom_exception dom_html_radionodelist_item(dom_html_radionodelist *col,
+ uint32_t index, struct dom_node **node);
+
+dom_exception dom_html_radionodelist_get_value(dom_html_radionodelist *col,
+ dom_string **value);
+
+dom_exception dom_html_radionodelist_set_value(dom_html_radionodelist *col,
+ dom_string **value);
+
+void dom_html_radionodelist_ref(dom_html_radionodelist *col);
+void dom_html_radionodelist_unref(dom_html_radionodelist *col);
+
+#endif
+
-----------------------------------------------------------------------
--
Document Object Model library
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org