r3400 jmb - in /trunk/dom: include/dom/core/attr.h include/dom/core/element.h src/core/Makefile src/core/attr.c src/core/element.c
by netsurf@semichrome.net
Author: jmb
Date: Wed Jul 11 03:23:16 2007
New Revision: 3400
URL: http://source.netsurf-browser.org?rev=3400&view=rev
Log:
Add Element.
Fix Attr's get_schema_type_info to have the right name.
Added:
trunk/dom/include/dom/core/element.h
trunk/dom/src/core/element.c
Modified:
trunk/dom/include/dom/core/attr.h
trunk/dom/src/core/Makefile
trunk/dom/src/core/attr.c
Modified: trunk/dom/include/dom/core/attr.h
URL: http://source.netsurf-browser.org/trunk/dom/include/dom/core/attr.h?rev=3...
==============================================================================
--- trunk/dom/include/dom/core/attr.h (original)
+++ trunk/dom/include/dom/core/attr.h Wed Jul 11 03:23:16 2007
@@ -27,7 +27,7 @@
struct dom_string *value);
dom_exception dom_attr_get_owner(struct dom_attr *attr,
struct dom_element **result);
-dom_exception dom_attr_get_type_info(struct dom_attr *attr,
+dom_exception dom_attr_get_schema_type_info(struct dom_attr *attr,
struct dom_type_info **result);
dom_exception dom_attr_is_id(struct dom_attr *attr, bool *result);
Added: trunk/dom/include/dom/core/element.h
URL: http://source.netsurf-browser.org/trunk/dom/include/dom/core/element.h?re...
==============================================================================
--- trunk/dom/include/dom/core/element.h (added)
+++ trunk/dom/include/dom/core/element.h Wed Jul 11 03:23:16 2007
@@ -1,0 +1,78 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#ifndef dom_core_element_h_
+#define dom_core_element_h_
+
+#include <stdbool.h>
+
+#include <dom/core/exceptions.h>
+
+struct dom_attr;
+struct dom_element;
+struct dom_nodelist;
+struct dom_string;
+struct dom_type_info;
+
+dom_exception dom_element_get_tag_name(struct dom_element *element,
+ struct dom_string **name);
+
+dom_exception dom_element_get_attribute(struct dom_element *element,
+ struct dom_string *name, struct dom_string **value);
+dom_exception dom_element_set_attribute(struct dom_element *element,
+ struct dom_string *name, struct dom_string *value);
+dom_exception dom_element_remove_attribute(struct dom_element *element,
+ struct dom_string *name);
+
+dom_exception dom_element_get_attribute_node(struct dom_element *element,
+ struct dom_string *name, struct dom_attr **result);
+dom_exception dom_element_set_attribute_node(struct dom_element *element,
+ struct dom_attr *attr, struct dom_attr **result);
+dom_exception dom_element_remove_attribute_node(struct dom_element *element,
+ struct dom_attr *attr, struct dom_attr **result);
+
+dom_exception dom_element_get_elements_by_tag_name(
+ struct dom_element *element, struct dom_string *name,
+ struct dom_nodelist **result);
+
+dom_exception dom_element_get_attribute_ns(struct dom_element *element,
+ struct dom_string *namespace, struct dom_string *localname,
+ struct dom_string **value);
+dom_exception dom_element_set_attribute_ns(struct dom_element *element,
+ struct dom_string *namespace, struct dom_string *qname,
+ struct dom_string *value);
+dom_exception dom_element_remove_attribute_ns(struct dom_element *element,
+ struct dom_string *namespace, struct dom_string *localname);
+
+dom_exception dom_element_get_attribute_node_ns(struct dom_element *element,
+ struct dom_string *namespace, struct dom_string *localname,
+ struct dom_attr **result);
+dom_exception dom_element_set_attribute_node_ns(struct dom_element *element,
+ struct dom_attr *attr, struct dom_attr **result);
+
+dom_exception dom_element_get_elements_by_tag_name_ns(
+ struct dom_element *element, struct dom_string *namespace,
+ struct dom_string *localname, struct dom_nodelist **result);
+
+dom_exception dom_element_has_attribute(struct dom_element *element,
+ struct dom_string *name, bool *result);
+dom_exception dom_element_has_attribute_ns(struct dom_element *element,
+ struct dom_string *namespace, struct dom_string *localname,
+ bool *result);
+
+dom_exception dom_element_get_schema_type_info(struct dom_element *element,
+ struct dom_type_info **result);
+
+dom_exception dom_element_set_id_attribute(struct dom_element *element,
+ struct dom_string *name, bool is_id);
+dom_exception dom_element_set_id_attribute_ns(struct dom_element *element,
+ struct dom_string *namespace, struct dom_string *localname,
+ bool is_id);
+dom_exception dom_element_set_id_attribute_node(struct dom_element *element,
+ struct dom_attr *id_attr, bool is_id);
+
+#endif
Modified: trunk/dom/src/core/Makefile
URL: http://source.netsurf-browser.org/trunk/dom/src/core/Makefile?rev=3400&r1...
==============================================================================
--- trunk/dom/src/core/Makefile (original)
+++ trunk/dom/src/core/Makefile Wed Jul 11 03:23:16 2007
@@ -22,7 +22,8 @@
CFLAGS += -I$(CURDIR)
# Objects
-OBJS = attr characterdata document namednodemap node nodelist string text
+OBJS = attr characterdata document element namednodemap node nodelist \
+ string text
.PHONY: clean debug distclean export release setup test
Modified: trunk/dom/src/core/attr.c
URL: http://source.netsurf-browser.org/trunk/dom/src/core/attr.c?rev=3400&r1=3...
==============================================================================
--- trunk/dom/src/core/attr.c (original)
+++ trunk/dom/src/core/attr.c Wed Jul 11 03:23:16 2007
@@ -135,7 +135,7 @@
* The returned type info will have its reference count increased. The caller
* should unref it once it has finished with it.
*/
-dom_exception dom_attr_get_type_info(struct dom_attr *attr,
+dom_exception dom_attr_get_schema_type_info(struct dom_attr *attr,
struct dom_type_info **result)
{
UNUSED(attr);
Added: trunk/dom/src/core/element.c
URL: http://source.netsurf-browser.org/trunk/dom/src/core/element.c?rev=3400&v...
==============================================================================
--- trunk/dom/src/core/element.c (added)
+++ trunk/dom/src/core/element.c Wed Jul 11 03:23:16 2007
@@ -1,0 +1,513 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#include <dom/core/element.h>
+
+#include "core/node.h"
+#include "utils/utils.h"
+
+/**
+ * DOM element node
+ */
+struct dom_element {
+ struct dom_node base; /**< Base node */
+
+ struct dom_type_info *schema_type_info; /**< Type information */
+};
+
+/**
+ * Retrieve an element's tag name
+ *
+ * \param element The element to retrieve the name from
+ * \param name Pointer to location to receive name
+ * \return DOM_NO_ERR.
+ *
+ * The returned string will have its reference count increased. It is
+ * the responsibility of the caller to unref the string once it has
+ * finished with it.
+ */
+dom_exception dom_element_get_tag_name(struct dom_element *element,
+ struct dom_string **name)
+{
+ UNUSED(element);
+ UNUSED(name);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Retrieve an attribute from an element by name
+ *
+ * \param element The element to retrieve attribute from
+ * \param name The attribute's name
+ * \param value Pointer to location to receive attribute's value
+ * \return DOM_NO_ERR.
+ *
+ * The returned string will have its reference count increased. It is
+ * the responsibility of the caller to unref the string once it has
+ * finished with it.
+ */
+dom_exception dom_element_get_attribute(struct dom_element *element,
+ struct dom_string *name, struct dom_string **value)
+{
+ UNUSED(element);
+ UNUSED(name);
+ UNUSED(value);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Set an attribute on an element by name
+ *
+ * \param element The element to set attribute on
+ * \param name The attribute's name
+ * \param value The attribute's value
+ * \return DOM_NO_ERR on success,
+ * DOM_INVALID_CHARACTER_ERR if ::name is invalid,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly.
+ */
+dom_exception dom_element_set_attribute(struct dom_element *element,
+ struct dom_string *name, struct dom_string *value)
+{
+ UNUSED(element);
+ UNUSED(name);
+ UNUSED(value);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Remove an attribute from an element by name
+ *
+ * \param element The element to remove attribute from
+ * \param name The name of the attribute to remove
+ * \return DOM_NO_ERR on success,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly.
+ */
+dom_exception dom_element_remove_attribute(struct dom_element *element,
+ struct dom_string *name)
+{
+ UNUSED(element);
+ UNUSED(name);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Retrieve an attribute node from an element by name
+ *
+ * \param element The element to retrieve attribute node from
+ * \param name The attribute's name
+ * \param result Pointer to location to receive attribute node
+ * \return DOM_NO_ERR.
+ *
+ * The returned node will have its reference count increased. It is
+ * the responsibility of the caller to unref the node once it has
+ * finished with it.
+ */
+dom_exception dom_element_get_attribute_node(struct dom_element *element,
+ struct dom_string *name, struct dom_attr **result)
+{
+ UNUSED(element);
+ UNUSED(name);
+ UNUSED(result);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Set an attribute node on an element, replacing existing node, if present
+ *
+ * \param element The element to add a node to
+ * \param attr The attribute node to add
+ * \param result Pointer to location to recieve previous node
+ * \return DOM_NO_ERR on success,
+ * DOM_WRONG_DOCUMENT_ERR if ::attr does not belong to the
+ * same document as ::element,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly,
+ * DOM_INUSE_ATTRIBUTE_ERR if ::attr is already an attribute
+ * of another Element node.
+ *
+ * The returned node will have its reference count increased. It is
+ * the responsibility of the caller to unref the node once it has
+ * finished with it.
+ */
+dom_exception dom_element_set_attribute_node(struct dom_element *element,
+ struct dom_attr *attr, struct dom_attr **result)
+{
+ UNUSED(element);
+ UNUSED(attr);
+ UNUSED(result);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Remove an attribute node from an element by name
+ *
+ * \param element The element to remove attribute node from
+ * \param attr The attribute node to remove
+ * \param result Pointer to location to receive attribute node
+ * \return DOM_NO_ERR on success,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly,
+ * DOM_NOT_FOUND_ERR if ::attr is not an attribute of
+ * ::element.
+ *
+ * The returned node will have its reference count increased. It is
+ * the responsibility of the caller to unref the node once it has
+ * finished with it.
+ */
+dom_exception dom_element_remove_attribute_node(struct dom_element *element,
+ struct dom_attr *attr, struct dom_attr **result)
+{
+ UNUSED(element);
+ UNUSED(attr);
+ UNUSED(result);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Retrieve a list of descendant elements of an element which match a given
+ * tag name
+ *
+ * \param element The root of the subtree to search
+ * \param name The tag name to match (or "*" for all tags)
+ * \param result Pointer to location to receive result
+ * \return DOM_NO_ERR.
+ *
+ * The returned nodelist will have its reference count increased. It is
+ * the responsibility of the caller to unref the nodelist once it has
+ * finished with it.
+ */
+dom_exception dom_element_get_elements_by_tag_name(
+ struct dom_element *element, struct dom_string *name,
+ struct dom_nodelist **result)
+{
+ UNUSED(element);
+ UNUSED(name);
+ UNUSED(result);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Retrieve an attribute from an element by namespace/localname
+ *
+ * \param element The element to retrieve attribute from
+ * \param namespace The attribute's namespace URI
+ * \param localname The attribute's local name
+ * \param value Pointer to location to receive attribute's value
+ * \return DOM_NO_ERR on success,
+ * DOM_NOT_SUPPORTED_ERR if the implementation does not support
+ * the feature "XML" and the language exposed
+ * through the Document does not support
+ * Namespaces.
+ *
+ * The returned string will have its reference count increased. It is
+ * the responsibility of the caller to unref the string once it has
+ * finished with it.
+ */
+dom_exception dom_element_get_attribute_ns(struct dom_element *element,
+ struct dom_string *namespace, struct dom_string *localname,
+ struct dom_string **value)
+{
+ UNUSED(element);
+ UNUSED(namespace);
+ UNUSED(localname);
+ UNUSED(value);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Set an attribute on an element by namespace/qualified name
+ *
+ * \param element The element to set attribute on
+ * \param namespace The attribute's namespace URI
+ * \param qname The attribute's qualified name
+ * \param value The attribute's value
+ * \return DOM_NO_ERR on success,
+ * DOM_INVALID_CHARACTER_ERR if ::qname is invalid,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly,
+ * DOM_NAMESPACE_ERR if ::qname is malformed, or
+ * ::qname has a prefix and
+ * ::namespace is null, or ::qname
+ * has a prefix "xml" and
+ * ::namespace is not
+ * "http://www.w3.org/XML/1998/namespace",
+ * or ::qname has a prefix "xmlns"
+ * and ::namespace is not
+ * "http://www.w3.org/2000/xmlns",
+ * or ::namespace is
+ * "http://www.w3.org/2000/xmlns"
+ * and ::qname is not prefixed
+ * "xmlns",
+ * DOM_NOT_SUPPORTED_ERR if the implementation does not
+ * support the feature "XML" and the
+ * language exposed through the
+ * Document does not support
+ * Namespaces.
+ */
+dom_exception dom_element_set_attribute_ns(struct dom_element *element,
+ struct dom_string *namespace, struct dom_string *qname,
+ struct dom_string *value)
+{
+ UNUSED(element);
+ UNUSED(namespace);
+ UNUSED(qname);
+ UNUSED(value);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Remove an attribute from an element by namespace/localname
+ *
+ * \param element The element to remove attribute from
+ * \param namespace The attribute's namespace URI
+ * \param localname The attribute's local name
+ * \return DOM_NO_ERR on success,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly,
+ * DOM_NOT_SUPPORTED_ERR if the implementation does not
+ * support the feature "XML" and the
+ * language exposed through the
+ * Document does not support
+ * Namespaces.
+ */
+dom_exception dom_element_remove_attribute_ns(struct dom_element *element,
+ struct dom_string *namespace, struct dom_string *localname)
+{
+ UNUSED(element);
+ UNUSED(namespace);
+ UNUSED(localname);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Retrieve an attribute node from an element by namespace/localname
+ *
+ * \param element The element to retrieve attribute from
+ * \param namespace The attribute's namespace URI
+ * \param localname The attribute's local name
+ * \param result Pointer to location to receive attribute node
+ * \return DOM_NO_ERR on success,
+ * DOM_NOT_SUPPORTED_ERR if the implementation does not support
+ * the feature "XML" and the language exposed
+ * through the Document does not support
+ * Namespaces.
+ *
+ * The returned node will have its reference count increased. It is
+ * the responsibility of the caller to unref the node once it has
+ * finished with it.
+ */
+dom_exception dom_element_get_attribute_node_ns(struct dom_element *element,
+ struct dom_string *namespace, struct dom_string *localname,
+ struct dom_attr **result)
+{
+ UNUSED(element);
+ UNUSED(namespace);
+ UNUSED(localname);
+ UNUSED(result);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Set an attribute node on an element, replacing existing node, if present
+ *
+ * \param element The element to add a node to
+ * \param attr The attribute node to add
+ * \param result Pointer to location to recieve previous node
+ * \return DOM_NO_ERR on success,
+ * DOM_WRONG_DOCUMENT_ERR if ::attr does not belong to the
+ * same document as ::element,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly,
+ * DOM_INUSE_ATTRIBUTE_ERR if ::attr is already an attribute
+ * of another Element node.
+ * DOM_NOT_SUPPORTED_ERR if the implementation does not
+ * support the feature "XML" and the
+ * language exposed through the
+ * Document does not support
+ * Namespaces.
+ *
+ * The returned node will have its reference count increased. It is
+ * the responsibility of the caller to unref the node once it has
+ * finished with it.
+ */
+dom_exception dom_element_set_attribute_node_ns(struct dom_element *element,
+ struct dom_attr *attr, struct dom_attr **result)
+{
+ UNUSED(element);
+ UNUSED(attr);
+ UNUSED(result);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Retrieve a list of descendant elements of an element which match a given
+ * namespace/localname pair.
+ *
+ * \param element The root of the subtree to search
+ * \param namespace The namespace URI to match (or "*" for all)
+ * \param localname The local name to match (or "*" for all)
+ * \param result Pointer to location to receive result
+ * \return DOM_NO_ERR on success,
+ * DOM_NOT_SUPPORTED_ERR if the implementation does not support
+ * the feature "XML" and the language exposed
+ * through the Document does not support
+ * Namespaces.
+ *
+ * The returned nodelist will have its reference count increased. It is
+ * the responsibility of the caller to unref the nodelist once it has
+ * finished with it.
+ */
+dom_exception dom_element_get_elements_by_tag_name_ns(
+ struct dom_element *element, struct dom_string *namespace,
+ struct dom_string *localname, struct dom_nodelist **result)
+{
+ UNUSED(element);
+ UNUSED(namespace);
+ UNUSED(localname);
+ UNUSED(result);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Determine if an element possesses and attribute with the given name
+ *
+ * \param element The element to query
+ * \param name The attribute name to look for
+ * \param result Pointer to location to receive result
+ * \return DOM_NO_ERR.
+ */
+dom_exception dom_element_has_attribute(struct dom_element *element,
+ struct dom_string *name, bool *result)
+{
+ UNUSED(element);
+ UNUSED(name);
+ UNUSED(result);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Determine if an element possesses and attribute with the given
+ * namespace/localname pair.
+ *
+ * \param element The element to query
+ * \param namespace The attribute namespace URI to look for
+ * \param localname The attribute local name to look for
+ * \param result Pointer to location to receive result
+ * \return DOM_NO_ERR on success,
+ * DOM_NOT_SUPPORTED_ERR if the implementation does not support
+ * the feature "XML" and the language exposed
+ * through the Document does not support
+ * Namespaces.
+ */
+dom_exception dom_element_has_attribute_ns(struct dom_element *element,
+ struct dom_string *namespace, struct dom_string *localname,
+ bool *result)
+{
+ UNUSED(element);
+ UNUSED(namespace);
+ UNUSED(localname);
+ UNUSED(result);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Retrieve the type information associated with an element
+ *
+ * \param element The element to retrieve type information from
+ * \param result Pointer to location to receive type information
+ * \return DOM_NO_ERR.
+ *
+ * The returned typeinfo will have its reference count increased. It is
+ * the responsibility of the caller to unref the typeinfo once it has
+ * finished with it.
+ */
+dom_exception dom_element_get_schema_type_info(struct dom_element *element,
+ struct dom_type_info **result)
+{
+ UNUSED(element);
+ UNUSED(result);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * (Un)declare an attribute as being an element's ID by name
+ *
+ * \param element The element containing the attribute
+ * \param name The attribute's name
+ * \param is_id Whether the attribute is an ID
+ * \return DOM_NO_ERR on success,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly,
+ * DOM_NOT_FOUND_ERR if the specified node is not an
+ * attribute of ::element.
+ */
+dom_exception dom_element_set_id_attribute(struct dom_element *element,
+ struct dom_string *name, bool is_id)
+{
+ UNUSED(element);
+ UNUSED(name);
+ UNUSED(is_id);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * (Un)declare an attribute as being an element's ID by namespace/localname
+ *
+ * \param element The element containing the attribute
+ * \param namespace The attribute's namespace URI
+ * \param localname The attribute's local name
+ * \param is_id Whether the attribute is an ID
+ * \return DOM_NO_ERR on success,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly,
+ * DOM_NOT_FOUND_ERR if the specified node is not an
+ * attribute of ::element.
+ */
+dom_exception dom_element_set_id_attribute_ns(struct dom_element *element,
+ struct dom_string *namespace, struct dom_string *localname,
+ bool is_id)
+{
+ UNUSED(element);
+ UNUSED(namespace);
+ UNUSED(localname);
+ UNUSED(is_id);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * (Un)declare an attribute node as being an element's ID
+ *
+ * \param element The element containing the attribute
+ * \param id_attr The attribute node
+ * \param is_id Whether the attribute is an ID
+ * \return DOM_NO_ERR on success,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::element is readonly,
+ * DOM_NOT_FOUND_ERR if the specified node is not an
+ * attribute of ::element.
+ */
+dom_exception dom_element_set_id_attribute_node(struct dom_element *element,
+ struct dom_attr *id_attr, bool is_id)
+{
+ UNUSED(element);
+ UNUSED(id_attr);
+ UNUSED(is_id);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
16 years, 2 months
r3399 jmb - in /trunk/dom: include/dom/core/attr.h src/core/attr.c
by netsurf@semichrome.net
Author: jmb
Date: Wed Jul 11 02:25:16 2007
New Revision: 3399
URL: http://source.netsurf-browser.org?rev=3399&view=rev
Log:
Fix TypeInfo -> type_info conversion
Modified:
trunk/dom/include/dom/core/attr.h
trunk/dom/src/core/attr.c
Modified: trunk/dom/include/dom/core/attr.h
URL: http://source.netsurf-browser.org/trunk/dom/include/dom/core/attr.h?rev=3...
==============================================================================
--- trunk/dom/include/dom/core/attr.h (original)
+++ trunk/dom/include/dom/core/attr.h Wed Jul 11 02:25:16 2007
@@ -13,7 +13,7 @@
#include <dom/core/exceptions.h>
struct dom_element;
-struct dom_typeinfo;
+struct dom_type_info;
struct dom_node;
struct dom_attr;
struct dom_string;
@@ -27,8 +27,8 @@
struct dom_string *value);
dom_exception dom_attr_get_owner(struct dom_attr *attr,
struct dom_element **result);
-dom_exception dom_attr_get_typeinfo(struct dom_attr *attr,
- struct dom_typeinfo **result);
+dom_exception dom_attr_get_type_info(struct dom_attr *attr,
+ struct dom_type_info **result);
dom_exception dom_attr_is_id(struct dom_attr *attr, bool *result);
#endif
Modified: trunk/dom/src/core/attr.c
URL: http://source.netsurf-browser.org/trunk/dom/src/core/attr.c?rev=3399&r1=3...
==============================================================================
--- trunk/dom/src/core/attr.c (original)
+++ trunk/dom/src/core/attr.c Wed Jul 11 02:25:16 2007
@@ -13,7 +13,7 @@
#include "utils/utils.h"
struct dom_element;
-struct dom_typeinfo;
+struct dom_type_info;
/**
* DOM node attribute
@@ -26,7 +26,7 @@
struct dom_element *owner; /**< Owning element */
- struct dom_typeinfo *schema_type_info; /**< Type information */
+ struct dom_type_info *schema_type_info; /**< Type information */
bool is_id; /**< Attribute is of type ID */
};
@@ -132,11 +132,11 @@
* \param result Pointer to location to receive result
* \return DOM_NO_ERR.
*
- * The returned typeinfo will have its reference count increased. The caller
+ * The returned type info will have its reference count increased. The caller
* should unref it once it has finished with it.
*/
-dom_exception dom_attr_get_typeinfo(struct dom_attr *attr,
- struct dom_typeinfo **result)
+dom_exception dom_attr_get_type_info(struct dom_attr *attr,
+ struct dom_type_info **result)
{
UNUSED(attr);
UNUSED(result);
16 years, 2 months
r3398 jmb - in /trunk/dom: include/dom/core/text.h src/core/Makefile src/core/characterdata.c src/core/characterdata.h src/core/text.c
by netsurf@semichrome.net
Author: jmb
Date: Wed Jul 11 02:04:21 2007
New Revision: 3398
URL: http://source.netsurf-browser.org?rev=3398&view=rev
Log:
Make CharacterData struct public (within library)
Add Text.
Added:
trunk/dom/include/dom/core/text.h
trunk/dom/src/core/characterdata.h
trunk/dom/src/core/text.c
Modified:
trunk/dom/src/core/Makefile
trunk/dom/src/core/characterdata.c
Added: trunk/dom/include/dom/core/text.h
URL: http://source.netsurf-browser.org/trunk/dom/include/dom/core/text.h?rev=3...
==============================================================================
--- trunk/dom/include/dom/core/text.h (added)
+++ trunk/dom/include/dom/core/text.h Wed Jul 11 02:04:21 2007
@@ -1,0 +1,28 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#ifndef dom_core_text_h_
+#define dom_core_text_h_
+
+#include <stdbool.h>
+
+#include <dom/core/exceptions.h>
+
+struct dom_characterdata;
+struct dom_string;
+struct dom_text;
+
+dom_exception dom_text_split_text(struct dom_text *text,
+ unsigned long offset, struct dom_text **result);
+dom_exception dom_text_get_is_element_content_whitespace(
+ struct dom_text *text, bool *result);
+dom_exception dom_text_get_whole_text(struct dom_text *text,
+ struct dom_string **result);
+dom_exception dom_text_replace_whole_text(struct dom_text *text,
+ struct dom_string *content, struct dom_text **result);
+
+#endif
Modified: trunk/dom/src/core/Makefile
URL: http://source.netsurf-browser.org/trunk/dom/src/core/Makefile?rev=3398&r1...
==============================================================================
--- trunk/dom/src/core/Makefile (original)
+++ trunk/dom/src/core/Makefile Wed Jul 11 02:04:21 2007
@@ -22,7 +22,7 @@
CFLAGS += -I$(CURDIR)
# Objects
-OBJS = attr characterdata document namednodemap node nodelist string
+OBJS = attr characterdata document namednodemap node nodelist string text
.PHONY: clean debug distclean export release setup test
Modified: trunk/dom/src/core/characterdata.c
URL: http://source.netsurf-browser.org/trunk/dom/src/core/characterdata.c?rev=...
==============================================================================
--- trunk/dom/src/core/characterdata.c (original)
+++ trunk/dom/src/core/characterdata.c Wed Jul 11 02:04:21 2007
@@ -8,15 +8,8 @@
#include <dom/core/characterdata.h>
#include <dom/core/string.h>
-#include "core/node.h"
+#include "core/characterdata.h"
#include "utils/utils.h"
-
-/**
- * DOM character data node
- */
-struct dom_characterdata {
- struct dom_node base; /**< Base node */
-};
/**
* Retrieve data from a character data node
Added: trunk/dom/src/core/characterdata.h
URL: http://source.netsurf-browser.org/trunk/dom/src/core/characterdata.h?rev=...
==============================================================================
--- trunk/dom/src/core/characterdata.h (added)
+++ trunk/dom/src/core/characterdata.h Wed Jul 11 02:04:21 2007
@@ -1,0 +1,20 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#ifndef dom_internal_core_characterdata_h_
+#define dom_internal_core_characterdata_h_
+
+#include "core/node.h"
+
+/**
+ * DOM character data node
+ */
+struct dom_characterdata {
+ struct dom_node base; /**< Base node */
+};
+
+#endif
Added: trunk/dom/src/core/text.c
URL: http://source.netsurf-browser.org/trunk/dom/src/core/text.c?rev=3398&view...
==============================================================================
--- trunk/dom/src/core/text.c (added)
+++ trunk/dom/src/core/text.c Wed Jul 11 02:04:21 2007
@@ -1,0 +1,98 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#include <dom/core/string.h>
+#include <dom/core/text.h>
+
+#include "core/characterdata.h"
+#include "utils/utils.h"
+
+struct dom_text {
+ struct dom_characterdata base; /**< Base node */
+
+ bool element_content_whitespace; /**< This node is element
+ * content whitespace */
+};
+
+/**
+ * Split a text node at a given character offset
+ *
+ * \param text The node to split
+ * \param offset Character offset to split at
+ * \param result Pointer to location to receive new node
+ * \return DOM_NO_ERR on success,
+ * DOM_INDEX_SIZE_ERR if ::offset is greater than the
+ * number of characters in ::text,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::text is readonly.
+ *
+ * The returned node will be referenced. The client should unref the node
+ * once it has finished with it.
+ */
+dom_exception dom_text_split_text(struct dom_text *text,
+ unsigned long offset, struct dom_text **result)
+{
+ UNUSED(text);
+ UNUSED(offset);
+ UNUSED(result);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Determine if a text node contains element content whitespace
+ *
+ * \param text The node to consider
+ * \param result Pointer to location to receive result
+ * \return DOM_NO_ERR.
+ */
+dom_exception dom_text_get_is_element_content_whitespace(
+ struct dom_text *text, bool *result)
+{
+ *result = text->element_content_whitespace;
+
+ return DOM_NO_ERR;
+}
+
+/**
+ * Retrieve all text in Text nodes logically adjacent to a Text node
+ *
+ * \param text Text node to consider
+ * \param result Pointer to location to receive result
+ * \return DOM_NO_ERR.
+ */
+dom_exception dom_text_get_whole_text(struct dom_text *text,
+ struct dom_string **result)
+{
+ UNUSED(text);
+ UNUSED(result);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Replace the text of a Text node and all logically adjacent Text nodes
+ *
+ * \param text Text node to consider
+ * \param content Replacement content
+ * \param result Pointer to location to receive Text node
+ * \return DOM_NO_ERR on success,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if one of the Text nodes being
+ * replaced is readonly.
+ *
+ * The returned node will be referenced. The client should unref the node
+ * once it has finished with it.
+ */
+dom_exception dom_text_replace_whole_text(struct dom_text *text,
+ struct dom_string *content, struct dom_text **result)
+{
+ UNUSED(text);
+ UNUSED(content);
+ UNUSED(result);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
16 years, 2 months
r3397 jmb - in /trunk/dom: include/dom/core/characterdata.h src/core/Makefile src/core/characterdata.c
by netsurf@semichrome.net
Author: jmb
Date: Wed Jul 11 01:28:33 2007
New Revision: 3397
URL: http://source.netsurf-browser.org?rev=3397&view=rev
Log:
Add CharacterData
Added:
trunk/dom/include/dom/core/characterdata.h
trunk/dom/src/core/characterdata.c
Modified:
trunk/dom/src/core/Makefile
Added: trunk/dom/include/dom/core/characterdata.h
URL: http://source.netsurf-browser.org/trunk/dom/include/dom/core/characterdat...
==============================================================================
--- trunk/dom/include/dom/core/characterdata.h (added)
+++ trunk/dom/include/dom/core/characterdata.h Wed Jul 11 01:28:33 2007
@@ -1,0 +1,35 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#ifndef dom_core_characterdata_h_
+#define dom_core_characterdata_h_
+
+#include <dom/core/exceptions.h>
+
+struct dom_characterdata;
+struct dom_string;
+
+dom_exception dom_characterdata_get_data(struct dom_characterdata *cdata,
+ struct dom_string **data);
+dom_exception dom_characterdata_set_data(struct dom_characterdata *cdata,
+ struct dom_string *data);
+dom_exception dom_characterdata_get_length(struct dom_characterdata *cdata,
+ unsigned long *length);
+dom_exception dom_characterdata_substring_data(
+ struct dom_characterdata *cdata, unsigned long offset,
+ unsigned long count, struct dom_string **data);
+dom_exception dom_characterdata_append_data(struct dom_characterdata *cdata,
+ struct dom_string *data);
+dom_exception dom_characterdata_insert_data(struct dom_characterdata *cdata,
+ unsigned long offset, struct dom_string *data);
+dom_exception dom_characterdata_delete_data(struct dom_characterdata *cdata,
+ unsigned long offset, unsigned long count);
+dom_exception dom_characterdata_replace_data(struct dom_characterdata *cdata,
+ unsigned long offset, unsigned long count,
+ struct dom_string *data);
+
+#endif
Modified: trunk/dom/src/core/Makefile
URL: http://source.netsurf-browser.org/trunk/dom/src/core/Makefile?rev=3397&r1...
==============================================================================
--- trunk/dom/src/core/Makefile (original)
+++ trunk/dom/src/core/Makefile Wed Jul 11 01:28:33 2007
@@ -22,7 +22,7 @@
CFLAGS += -I$(CURDIR)
# Objects
-OBJS = attr document namednodemap node nodelist string
+OBJS = attr characterdata document namednodemap node nodelist string
.PHONY: clean debug distclean export release setup test
Added: trunk/dom/src/core/characterdata.c
URL: http://source.netsurf-browser.org/trunk/dom/src/core/characterdata.c?rev=...
==============================================================================
--- trunk/dom/src/core/characterdata.c (added)
+++ trunk/dom/src/core/characterdata.c Wed Jul 11 01:28:33 2007
@@ -1,0 +1,193 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#include <dom/core/characterdata.h>
+#include <dom/core/string.h>
+
+#include "core/node.h"
+#include "utils/utils.h"
+
+/**
+ * DOM character data node
+ */
+struct dom_characterdata {
+ struct dom_node base; /**< Base node */
+};
+
+/**
+ * Retrieve data from a character data node
+ *
+ * \param cdata Character data node to retrieve data from
+ * \param data Pointer to location to receive data
+ * \return DOM_NO_ERR.
+ *
+ * The returned string will have its reference count increased. It is
+ * the responsibility of the caller to unref the string once it has
+ * finished with it.
+ *
+ * DOM3Core states that this can raise DOMSTRING_SIZE_ERR. It will not in
+ * this implementation; dom_strings are unbounded.
+ */
+dom_exception dom_characterdata_get_data(struct dom_characterdata *cdata,
+ struct dom_string **data)
+{
+ UNUSED(cdata);
+ UNUSED(data);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Set the content of a character data node
+ *
+ * \param cdata Node to set the content of
+ * \param data New value for node
+ * \return DOM_NO_ERR on success,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::cdata is readonly.
+ *
+ * The new content will have its reference count increased, so the caller
+ * should unref it after the call (as the caller should have already claimed
+ * a reference on the string). The node's existing content will be unrefed.
+ */
+dom_exception dom_characterdata_set_data(struct dom_characterdata *cdata,
+ struct dom_string *data)
+{
+ UNUSED(cdata);
+ UNUSED(data);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Get the length (in characters) of a character data node's content
+ *
+ * \param cdata Node to read content length of
+ * \param length Pointer to location to receive character length of content
+ * \return DOM_NO_ERR.
+ */
+dom_exception dom_characterdata_get_length(struct dom_characterdata *cdata,
+ unsigned long *length)
+{
+ UNUSED(cdata);
+ UNUSED(length);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Extract a range of data from a character data node
+ *
+ * \param cdata The node to extract data from
+ * \param offset The character offset of substring to extract
+ * \param count The number of characters to extract
+ * \param data Pointer to location to receive substring
+ * \return DOM_NO_ERR on success,
+ * DOM_INDEX_SIZE_ERR if ::offset is greater than the number of
+ * characters in ::cdata.
+ *
+ * The returned string will have its reference count increased. It is
+ * the responsibility of the caller to unref the string once it has
+ * finished with it.
+ *
+ * DOM3Core states that this can raise DOMSTRING_SIZE_ERR. It will not in
+ * this implementation; dom_strings are unbounded.
+ */
+dom_exception dom_characterdata_substring_data(
+ struct dom_characterdata *cdata, unsigned long offset,
+ unsigned long count, struct dom_string **data)
+{
+ UNUSED(cdata);
+ UNUSED(offset);
+ UNUSED(count);
+ UNUSED(data);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Append data to the end of a character data node's content
+ *
+ * \param cdata The node to append data to
+ * \param data The data to append
+ * \return DOM_NO_ERR on success,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::cdata is readonly.
+ */
+dom_exception dom_characterdata_append_data(struct dom_characterdata *cdata,
+ struct dom_string *data)
+{
+ UNUSED(cdata);
+ UNUSED(data);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Insert data into a character data node's content
+ *
+ * \param cdata The node to insert into
+ * \param offset The character offset to insert at
+ * \param data The data to insert
+ * \return DOM_NO_ERR on success,
+ * DOM_INDEX_SIZE_ERR if ::offset is greater than the
+ * number of characters in ::cdata,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::cdata is readonly.
+ */
+dom_exception dom_characterdata_insert_data(struct dom_characterdata *cdata,
+ unsigned long offset, struct dom_string *data)
+{
+ UNUSED(cdata);
+ UNUSED(offset);
+ UNUSED(data);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Delete data from a character data node's content
+ *
+ * \param cdata The node to delete from
+ * \param offset The character offset to start deletion from
+ * \param count The number of characters to delete
+ * \return DOM_NO_ERR on success,
+ * DOM_INDEX_SIZE_ERR if ::offset is greater than the
+ * number of characters in ::cdata,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::cdata is readonly.
+ */
+dom_exception dom_characterdata_delete_data(struct dom_characterdata *cdata,
+ unsigned long offset, unsigned long count)
+{
+ UNUSED(cdata);
+ UNUSED(offset);
+ UNUSED(count);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Replace a section of a character data node's content
+ *
+ * \param cdata The node to modify
+ * \param offset The character offset of the sequence to replace
+ * \param count The number of characters to replace
+ * \param data The replacement data
+ * \return DOM_NO_ERR on success,
+ * DOM_INDEX_SIZE_ERR if ::offset is greater than the
+ * number of characters in ::cdata,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::cdata is readonly.
+ */
+dom_exception dom_characterdata_replace_data(struct dom_characterdata *cdata,
+ unsigned long offset, unsigned long count,
+ struct dom_string *data)
+{
+ UNUSED(cdata);
+ UNUSED(offset);
+ UNUSED(count);
+ UNUSED(data);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
16 years, 2 months
r3396 jmb - /trunk/dom/src/core/string.c
by netsurf@semichrome.net
Author: jmb
Date: Wed Jul 11 00:27:22 2007
New Revision: 3396
URL: http://source.netsurf-browser.org?rev=3396&view=rev
Log:
Warning fixes
Modified:
trunk/dom/src/core/string.c
Modified: trunk/dom/src/core/string.c
URL: http://source.netsurf-browser.org/trunk/dom/src/core/string.c?rev=3396&r1...
==============================================================================
--- trunk/dom/src/core/string.c (original)
+++ trunk/dom/src/core/string.c Wed Jul 11 00:27:22 2007
@@ -227,7 +227,8 @@
*/
int dom_string_cmp(struct dom_string *s1, struct dom_string *s2)
{
- const uint8_t *d1, *d2;
+ const uint8_t *d1 = NULL;
+ const uint8_t *d2 = NULL;
size_t l1, l2;
dom_exception err;
@@ -254,7 +255,8 @@
*/
int dom_string_icmp(struct dom_string *s1, struct dom_string *s2)
{
- const uint8_t *d1, *d2;
+ const uint8_t *d1 = NULL;
+ const uint8_t *d2 = NULL;
size_t l1, l2;
dom_exception err;
16 years, 2 months
r3395 jmb - in /trunk/dom: include/dom/core/namednodemap.h src/core/Makefile src/core/document.c src/core/document.h src/core/namednodemap.c src/core/namednodemap.h src/core/nodelist.c
by netsurf@semichrome.net
Author: jmb
Date: Wed Jul 11 00:25:18 2007
New Revision: 3395
URL: http://source.netsurf-browser.org?rev=3395&view=rev
Log:
Add NamedNodeMap.
Minor fix for NodeList unref function; ensure it unrefs the owner document after it has finished using it.
Added:
trunk/dom/include/dom/core/namednodemap.h
trunk/dom/src/core/namednodemap.c
trunk/dom/src/core/namednodemap.h
Modified:
trunk/dom/src/core/Makefile
trunk/dom/src/core/document.c
trunk/dom/src/core/document.h
trunk/dom/src/core/nodelist.c
Added: trunk/dom/include/dom/core/namednodemap.h
URL: http://source.netsurf-browser.org/trunk/dom/include/dom/core/namednodemap...
==============================================================================
--- trunk/dom/include/dom/core/namednodemap.h (added)
+++ trunk/dom/include/dom/core/namednodemap.h Wed Jul 11 00:25:18 2007
@@ -1,0 +1,43 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#ifndef dom_core_namednodemap_h_
+#define dom_core_namednodemap_h_
+
+#include <dom/core/exceptions.h>
+
+struct dom_node;
+struct dom_namednodemap;
+struct dom_string;
+
+void dom_namednodemap_ref(struct dom_namednodemap *map);
+void dom_namednodemap_unref(struct dom_namednodemap *map);
+
+dom_exception dom_namednodemap_get_length(struct dom_namednodemap *map,
+ unsigned long *length);
+
+dom_exception dom_namednodemap_get_named_item(struct dom_namednodemap *map,
+ struct dom_string *name, struct dom_node **node);
+dom_exception dom_namednodemap_set_named_item(struct dom_namednodemap *map,
+ struct dom_node *arg, struct dom_node **node);
+dom_exception dom_namednodemap_remove_named_item(
+ struct dom_namednodemap *map, struct dom_string *name,
+ struct dom_node **node);
+dom_exception dom_namednodemap_item(struct dom_namednodemap *map,
+ unsigned long index, struct dom_node **node);
+
+dom_exception dom_namednodemap_get_named_item_ns(
+ struct dom_namednodemap *map, struct dom_string *namespace,
+ struct dom_string *localname, struct dom_node **node);
+dom_exception dom_namednodemap_set_named_item_ns(
+ struct dom_namednodemap *map, struct dom_node *arg,
+ struct dom_node **node);
+dom_exception dom_namednodemap_remove_named_item_ns(
+ struct dom_namednodemap *map, struct dom_string *namespace,
+ struct dom_string *localname, struct dom_node **node);
+
+#endif
Modified: trunk/dom/src/core/Makefile
URL: http://source.netsurf-browser.org/trunk/dom/src/core/Makefile?rev=3395&r1...
==============================================================================
--- trunk/dom/src/core/Makefile (original)
+++ trunk/dom/src/core/Makefile Wed Jul 11 00:25:18 2007
@@ -22,7 +22,7 @@
CFLAGS += -I$(CURDIR)
# Objects
-OBJS = attr document node nodelist string
+OBJS = attr document namednodemap node nodelist string
.PHONY: clean debug distclean export release setup test
Modified: trunk/dom/src/core/document.c
URL: http://source.netsurf-browser.org/trunk/dom/src/core/document.c?rev=3395&...
==============================================================================
--- trunk/dom/src/core/document.c (original)
+++ trunk/dom/src/core/document.c Wed Jul 11 00:25:18 2007
@@ -24,12 +24,24 @@
};
/**
+ * Iten in list of active namednodemaps
+ */
+struct dom_doc_nnm {
+ struct dom_namednodemap *map; /**< Named node map */
+
+ struct dom_doc_nnm *next; /**< Next map */
+ struct dom_doc_nnm *prev; /**< Previous map */
+};
+
+/**
* DOM document
*/
struct dom_document {
struct dom_node base; /**< Base node */
struct dom_doc_nl *nodelists; /**< List of active nodelists */
+
+ struct dom_doc_nnm *maps; /**< List of active namednodemaps */
dom_alloc alloc; /**< Memory (de)allocation function */
void *pw; /**< Pointer to client data */
@@ -809,7 +821,7 @@
* If it did, the nodelist's reference count would never reach zero,
* and the list would remain indefinitely. This is not a problem as
* the list notifies the document of its destruction via
- * dom_document_remove_nodelist.*/
+ * dom_document_remove_nodelist. */
*list = l->list;
@@ -849,3 +861,99 @@
/* And free item */
doc->alloc(l, 0, doc->pw);
}
+
+/**
+ * Get a namednodemap, creating one if necessary
+ *
+ * \param doc The document to get a namednodemap for
+ * \param root Node containing items in map
+ * \param type The type of map
+ * \param map Pointer to location to receive map
+ * \return DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion.
+ *
+ * The returned map will have its reference count increased. It is
+ * the responsibility of the caller to unref the map once it has
+ * finished with it.
+ */
+dom_exception dom_document_get_namednodemap(struct dom_document *doc,
+ struct dom_node *root, dom_namednodemap_type type,
+ struct dom_namednodemap **map)
+{
+ struct dom_doc_nnm *m;
+ dom_exception err;
+
+ for (m = doc->maps; m; m = m->next) {
+ if (dom_namednodemap_match(m->map, root, type))
+ break;
+ }
+
+ if (m != NULL) {
+ /* Found an existing map, so use it */
+ dom_namednodemap_ref(m->map);
+ } else {
+ /* No existing map */
+
+ /* Create active map entry */
+ m = doc->alloc(NULL, sizeof(struct dom_doc_nnm), doc->pw);
+ if (m == NULL)
+ return DOM_NO_MEM_ERR;
+
+ /* Create namednodemap */
+ err = dom_namednodemap_create(doc, root, type, &m->map);
+ if (err != DOM_NO_ERR) {
+ doc->alloc(m, 0, doc->pw);
+ return err;
+ }
+
+ /* Add to document's list of active namednodemaps */
+ m->prev = NULL;
+ m->next = doc->maps;
+ if (doc->maps)
+ doc->maps->prev = m;
+ doc->maps = m;
+ }
+
+ /* Note: the document does not claim a reference on the namednodemap
+ * If it did, the map's reference count would never reach zero,
+ * and the list would remain indefinitely. This is not a problem as
+ * the map notifies the document of its destruction via
+ * dom_document_remove_namednodempa. */
+
+ *map = m->map;
+
+ return DOM_NO_ERR;
+}
+
+/**
+ * Remove a namednodemap
+ *
+ * \param doc The document to remove the map from
+ * \param map The map to remove
+ */
+void dom_document_remove_namednodemap(struct dom_document *doc,
+ struct dom_namednodemap *map)
+{
+ struct dom_doc_nnm *m;
+
+ for (m = doc->maps; m; m = m->next) {
+ if (m->map == map)
+ break;
+ }
+
+ if (m == NULL) {
+ /* This should never happen; we should probably abort here */
+ return;
+ }
+
+ /* Remove from list */
+ if (m->prev != NULL)
+ m->prev->next = m->next;
+ else
+ doc->maps = m->next;
+
+ if (m->next != NULL)
+ m->next->prev = m->prev;
+
+ /* And free item */
+ doc->alloc(m, 0, doc->pw);
+}
Modified: trunk/dom/src/core/document.h
URL: http://source.netsurf-browser.org/trunk/dom/src/core/document.h?rev=3395&...
==============================================================================
--- trunk/dom/src/core/document.h (original)
+++ trunk/dom/src/core/document.h Wed Jul 11 00:25:18 2007
@@ -11,7 +11,10 @@
#include <inttypes.h>
#include <stddef.h>
+#include "core/namednodemap.h"
+
struct dom_document;
+struct dom_namednodemap;
struct dom_node;
struct dom_nodelist;
struct dom_string;
@@ -27,9 +30,16 @@
struct dom_node *root, struct dom_string *tagname,
struct dom_string *namespace, struct dom_string *localname,
struct dom_nodelist **list);
-
/* Remove a nodelist */
void dom_document_remove_nodelist(struct dom_document *doc,
struct dom_nodelist *list);
+/* Get a namednodemap, creating one if necessary */
+dom_exception dom_document_get_namednodemap(struct dom_document *doc,
+ struct dom_node *root, dom_namednodemap_type type,
+ struct dom_namednodemap **map);
+/* Remove a namednodemap */
+void dom_document_remove_namednodemap(struct dom_document *doc,
+ struct dom_namednodemap *map);
+
#endif
Added: trunk/dom/src/core/namednodemap.c
URL: http://source.netsurf-browser.org/trunk/dom/src/core/namednodemap.c?rev=3...
==============================================================================
--- trunk/dom/src/core/namednodemap.c (added)
+++ trunk/dom/src/core/namednodemap.c Wed Jul 11 00:25:18 2007
@@ -1,0 +1,345 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#include <dom/core/node.h>
+
+#include "core/document.h"
+#include "core/namednodemap.h"
+
+#include "utils/utils.h"
+
+/**
+ * DOM named node map
+ */
+struct dom_namednodemap {
+ struct dom_document *owner; /**< Owning document */
+
+ struct dom_node *root; /**< Node containing items in map */
+
+ dom_namednodemap_type type; /**< Type of map */
+
+ uint32_t refcnt; /**< Reference count */
+};
+
+/**
+ * Create a namednodemap
+ *
+ * \param doc The owning document
+ * \param root Node containing items in map
+ * \param type The type of map
+ * \param map Pointer to location to receive created map
+ * \return DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion
+ *
+ * ::root must be a node owned by ::doc and must be either an Element or
+ * DocumentType node.
+ *
+ * If ::root is of type Element, ::type must be DOM_NAMEDNODEMAP_ATTRIBUTES
+ * If ::root is of type DocumentType, ::type may be either
+ * DOM_NAMEDNODEMAP_ENTITIES or DOM_NAMEDNODEMAP_NOTATIONS.
+ *
+ * The returned map will already be referenced, so the client need not
+ * explicitly reference it. The client must unref the map once it is
+ * finished with it.
+ */
+dom_exception dom_namednodemap_create(struct dom_document *doc,
+ struct dom_node *root, dom_namednodemap_type type,
+ struct dom_namednodemap **map)
+{
+ struct dom_namednodemap *m;
+
+ m = dom_document_alloc(doc, NULL, sizeof(struct dom_namednodemap));
+ if (m == NULL)
+ return DOM_NO_MEM_ERR;
+
+ dom_node_ref((struct dom_node *) doc);
+ m->owner = doc;
+
+ dom_node_ref(root);
+ m->root = root;
+
+ m->type = type;
+
+ m->refcnt = 1;
+
+ *map = m;
+
+ return DOM_NO_ERR;
+}
+
+/**
+ * Claim a reference on a DOM named node map
+ *
+ * \param map The map to claim a reference on
+ */
+void dom_namednodemap_ref(struct dom_namednodemap *map)
+{
+ map->refcnt++;
+}
+
+/**
+ * Release a reference on a DOM named node map
+ *
+ * \param map The map to release the reference from
+ *
+ * If the reference count reaches zero, any memory claimed by the
+ * map will be released
+ */
+void dom_namednodemap_unref(struct dom_namednodemap *map)
+{
+ if (--map->refcnt == 0) {
+ struct dom_node *owner = (struct dom_node *) map->owner;
+
+ dom_node_unref(map->root);
+
+ /* Remove map from document */
+ dom_document_remove_namednodemap(map->owner, map);
+
+ /* Destroy the map object */
+ dom_document_alloc(map->owner, map, 0);
+
+ /* And release our reference on the owning document
+ * This must be last as, otherwise, it's possible that
+ * the document is destroyed before we are */
+ dom_node_unref(owner);
+ }
+}
+
+/**
+ * Retrieve the length of a named node map
+ *
+ * \param map Map to retrieve length of
+ * \param length Pointer to location to receive length
+ * \return DOM_NO_ERR.
+ */
+dom_exception dom_namednodemap_get_length(struct dom_namednodemap *map,
+ unsigned long *length)
+{
+ UNUSED(map);
+ UNUSED(length);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Retrieve an item by name from a named node map
+ *
+ * \param map The map to retrieve the item from
+ * \param name The name of the item to retrieve
+ * \param node Pointer to location to receive item
+ * \return DOM_NO_ERR.
+ *
+ * The returned node will have had its reference count increased. The client
+ * should unref the node once it has finished with it.
+ */
+dom_exception dom_namednodemap_get_named_item(struct dom_namednodemap *map,
+ struct dom_string *name, struct dom_node **node)
+{
+ UNUSED(map);
+ UNUSED(name);
+ UNUSED(node);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Add a node to a named node map, replacing any matching existing node
+ *
+ * \param map The map to add to
+ * \param arg The node to add
+ * \param node Pointer to location to receive replaced node
+ * \return DOM_NO_ERR on success,
+ * DOM_WRONG_DOCUMENT_ERR if ::arg was created from a
+ * different document than ::map,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::map is readonly,
+ * DOM_INUSE_ATTRIBUTE_ERR if ::arg is an Attr that is
+ * already an attribute on another
+ * Element,
+ * DOM_HIERARCHY_REQUEST_ERR if the type of ::arg is not
+ * permitted as a member of ::map.
+ *
+ * ::arg's nodeName attribute will be used to store it in ::map. It will
+ * be accessible using the nodeName attribute as the key for lookup.
+ *
+ * Replacing a node by itself has no effect.
+ *
+ * The returned node will have had its reference count increased. The client
+ * should unref the node once it has finished with it.
+ */
+dom_exception dom_namednodemap_set_named_item(struct dom_namednodemap *map,
+ struct dom_node *arg, struct dom_node **node)
+{
+ UNUSED(map);
+ UNUSED(arg);
+ UNUSED(node);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Remove an item by name from a named node map
+ *
+ * \param map The map to remove from
+ * \param name The name of the item to remove
+ * \param node Pointer to location to receive removed item
+ * \return DOM_NO_ERR on success,
+ * DOM_NOT_FOUND_ERR if there is no node named ::name
+ * in ::map,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::map is readonly.
+ *
+ * The returned node will have had its reference count increased. The client
+ * should unref the node once it has finished with it.
+ */
+dom_exception dom_namednodemap_remove_named_item(
+ struct dom_namednodemap *map, struct dom_string *name,
+ struct dom_node **node)
+{
+ UNUSED(map);
+ UNUSED(name);
+ UNUSED(node);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Retrieve an item from a named node map
+ *
+ * \param map The map to retrieve the item from
+ * \param index The map index to retrieve
+ * \param node Pointer to location to receive item
+ * \return DOM_NO_ERR.
+ *
+ * ::index is a zero-based index into ::map.
+ * ::index lies in the range [0, length-1]
+ *
+ * The returned node will have had its reference count increased. The client
+ * should unref the node once it has finished with it.
+ */
+dom_exception dom_namednodemap_item(struct dom_namednodemap *map,
+ unsigned long index, struct dom_node **node)
+{
+ UNUSED(map);
+ UNUSED(index);
+ UNUSED(node);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Retrieve an item by namespace/localname from a named node map
+ *
+ * \param map The map to retrieve the item from
+ * \param namespace The namespace URI of the item to retrieve
+ * \param localname The local name of the node to retrieve
+ * \param node Pointer to location to receive item
+ * \return DOM_NO_ERR on success,
+ * DOM_NOT_SUPPORTED_ERR if the implementation does not support the
+ * feature "XML" and the language exposed
+ * through the Document does not support
+ * Namespaces.
+ *
+ * The returned node will have had its reference count increased. The client
+ * should unref the node once it has finished with it.
+ */
+dom_exception dom_namednodemap_get_named_item_ns(
+ struct dom_namednodemap *map, struct dom_string *namespace,
+ struct dom_string *localname, struct dom_node **node)
+{
+ UNUSED(map);
+ UNUSED(namespace);
+ UNUSED(localname);
+ UNUSED(node);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Add a node to a named node map, replacing any matching existing node
+ *
+ * \param map The map to add to
+ * \param arg The node to add
+ * \param node Pointer to location to receive replaced node
+ * \return DOM_NO_ERR on success,
+ * DOM_WRONG_DOCUMENT_ERR if ::arg was created from a
+ * different document than ::map,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::map is readonly,
+ * DOM_INUSE_ATTRIBUTE_ERR if ::arg is an Attr that is
+ * already an attribute on another
+ * Element,
+ * DOM_HIERARCHY_REQUEST_ERR if the type of ::arg is not
+ * permitted as a member of ::map.
+ * DOM_NOT_SUPPORTED_ERR if the implementation does not support the
+ * feature "XML" and the language exposed
+ * through the Document does not support
+ * Namespaces.
+ *
+ * ::arg's namespaceURI and localName attributes will be used to store it in
+ * ::map. It will be accessible using the namespaceURI and localName
+ * attributes as the keys for lookup.
+ *
+ * Replacing a node by itself has no effect.
+ *
+ * The returned node will have had its reference count increased. The client
+ * should unref the node once it has finished with it.
+ */
+dom_exception dom_namednodemap_set_named_item_ns(
+ struct dom_namednodemap *map, struct dom_node *arg,
+ struct dom_node **node)
+{
+ UNUSED(map);
+ UNUSED(arg);
+ UNUSED(node);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Remove an item by namespace/localname from a named node map
+ *
+ * \param map The map to remove from
+ * \param namespace The namespace URI of the item to remove
+ * \param localname The local name of the item to remove
+ * \param node Pointer to location to receive removed item
+ * \return DOM_NO_ERR on success,
+ * DOM_NOT_FOUND_ERR if there is no node named ::name
+ * in ::map,
+ * DOM_NO_MODIFICATION_ALLOWED_ERR if ::map is readonly.
+ * DOM_NOT_SUPPORTED_ERR if the implementation does not support the
+ * feature "XML" and the language exposed
+ * through the Document does not support
+ * Namespaces.
+ *
+ * The returned node will have had its reference count increased. The client
+ * should unref the node once it has finished with it.
+ */
+dom_exception dom_namednodemap_remove_named_item_ns(
+ struct dom_namednodemap *map, struct dom_string *namespace,
+ struct dom_string *localname, struct dom_node **node)
+{
+ UNUSED(map);
+ UNUSED(namespace);
+ UNUSED(localname);
+ UNUSED(node);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Match a namednodemap instance against a set of creation parameters
+ *
+ * \param map The map to match
+ * \param root Node containing items in map
+ * \param type The type of map
+ * \return true if list matches, false otherwise
+ */
+bool dom_namednodemap_match(struct dom_namednodemap *map,
+ struct dom_node *root, dom_namednodemap_type type)
+{
+ if (map->root == root && map->type == type)
+ return true;
+
+ return false;
+}
Added: trunk/dom/src/core/namednodemap.h
URL: http://source.netsurf-browser.org/trunk/dom/src/core/namednodemap.h?rev=3...
==============================================================================
--- trunk/dom/src/core/namednodemap.h (added)
+++ trunk/dom/src/core/namednodemap.h Wed Jul 11 00:25:18 2007
@@ -1,0 +1,39 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#ifndef dom_internal_namednodemap_h_
+#define dom_internal_namednodemap_h_
+
+#include <stdbool.h>
+
+#include <dom/core/namednodemap.h>
+
+struct dom_document;
+struct dom_node;
+struct dom_namednodemap;
+struct dom_string;
+
+/**
+ * Type of a named node map
+ */
+typedef enum {
+ DOM_NAMEDNODEMAP_ATTRIBUTES,
+ DOM_NAMEDNODEMAP_ENTITIES,
+ DOM_NAMEDNODEMAP_NOTATIONS
+} dom_namednodemap_type;
+
+/* Create a namednodemap */
+dom_exception dom_namednodemap_create(struct dom_document *doc,
+ struct dom_node *root, dom_namednodemap_type type,
+ struct dom_namednodemap **map);
+
+
+/* Match a namednodemap instance against a set of creation parameters */
+bool dom_namednodemap_match(struct dom_namednodemap *map,
+ struct dom_node *root, dom_namednodemap_type type);
+
+#endif
Modified: trunk/dom/src/core/nodelist.c
URL: http://source.netsurf-browser.org/trunk/dom/src/core/nodelist.c?rev=3395&...
==============================================================================
--- trunk/dom/src/core/nodelist.c (original)
+++ trunk/dom/src/core/nodelist.c Wed Jul 11 00:25:18 2007
@@ -62,7 +62,7 @@
* will match the children of ::root.
*
* The returned list will already be referenced, so the client need not
- * do so explicitly. The client should unref the list once finished with it.
+ * do so explicitly. The client must unref the list once finished with it.
*/
dom_exception dom_nodelist_create(struct dom_document *doc,
struct dom_node *root, struct dom_string *tagname,
@@ -124,6 +124,8 @@
void dom_nodelist_unref(struct dom_nodelist *list)
{
if (--list->refcnt == 0) {
+ struct dom_node *owner = (struct dom_node *) list->owner;
+
switch (list->type) {
case DOM_NODELIST_CHILDREN:
/* Nothing to do */
@@ -139,13 +141,16 @@
dom_node_unref(list->root);
- dom_node_unref((struct dom_node *) list->owner);
-
/* Remove list from document */
dom_document_remove_nodelist(list->owner, list);
- /* And destroy the list object */
+ /* Destroy the list object */
dom_document_alloc(list->owner, list, 0);
+
+ /* And release our reference on the owning document
+ * This must be last as, otherwise, it's possible that
+ * the document is destroyed before we are */
+ dom_node_unref(owner);
}
}
16 years, 2 months
r3394 jmb - in /trunk/dom: include/dom/core/nodelist.h include/dom/core/string.h src/core/Makefile src/core/attr.c src/core/document.c src/core/document.h src/core/node.c src/core/node.h src/core/nodelist.c src/core/nodelist.h src/core/string.c
by netsurf@semichrome.net
Author: jmb
Date: Tue Jul 10 22:36:14 2007
New Revision: 3394
URL: http://source.netsurf-browser.org?rev=3394&view=rev
Log:
Add NodeList and string comparison API
Added:
trunk/dom/include/dom/core/nodelist.h
trunk/dom/src/core/nodelist.c
trunk/dom/src/core/nodelist.h
Modified:
trunk/dom/include/dom/core/string.h
trunk/dom/src/core/Makefile
trunk/dom/src/core/attr.c
trunk/dom/src/core/document.c
trunk/dom/src/core/document.h
trunk/dom/src/core/node.c
trunk/dom/src/core/node.h
trunk/dom/src/core/string.c
Added: trunk/dom/include/dom/core/nodelist.h
URL: http://source.netsurf-browser.org/trunk/dom/include/dom/core/nodelist.h?r...
==============================================================================
--- trunk/dom/include/dom/core/nodelist.h (added)
+++ trunk/dom/include/dom/core/nodelist.h Tue Jul 10 22:36:14 2007
@@ -1,0 +1,24 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#ifndef dom_core_nodelist_h_
+#define dom_core_nodelist_h_
+
+#include <dom/core/exceptions.h>
+
+struct dom_node;
+struct dom_nodelist;
+
+void dom_nodelist_ref(struct dom_nodelist *list);
+void dom_nodelist_unref(struct dom_nodelist *list);
+
+dom_exception dom_nodelist_get_length(struct dom_nodelist *list,
+ unsigned long *length);
+dom_exception dom_nodelist_item(struct dom_nodelist *list,
+ unsigned long index, struct dom_node **node);
+
+#endif
Modified: trunk/dom/include/dom/core/string.h
URL: http://source.netsurf-browser.org/trunk/dom/include/dom/core/string.h?rev...
==============================================================================
--- trunk/dom/include/dom/core/string.h (original)
+++ trunk/dom/include/dom/core/string.h Tue Jul 10 22:36:14 2007
@@ -35,4 +35,10 @@
dom_exception dom_string_get_data(struct dom_string *str,
const uint8_t **data, size_t *len);
+/* Case sensitively compare two DOM strings */
+int dom_string_cmp(struct dom_string *s1, struct dom_string *s2);
+/* Case insensitively compare two DOM strings */
+int dom_string_icmp(struct dom_string *s1, struct dom_string *s2);
+
+
#endif
Modified: trunk/dom/src/core/Makefile
URL: http://source.netsurf-browser.org/trunk/dom/src/core/Makefile?rev=3394&r1...
==============================================================================
--- trunk/dom/src/core/Makefile (original)
+++ trunk/dom/src/core/Makefile Tue Jul 10 22:36:14 2007
@@ -22,7 +22,7 @@
CFLAGS += -I$(CURDIR)
# Objects
-OBJS = attr document node string
+OBJS = attr document node nodelist string
.PHONY: clean debug distclean export release setup test
Modified: trunk/dom/src/core/attr.c
URL: http://source.netsurf-browser.org/trunk/dom/src/core/attr.c?rev=3394&r1=3...
==============================================================================
--- trunk/dom/src/core/attr.c (original)
+++ trunk/dom/src/core/attr.c Tue Jul 10 22:36:14 2007
@@ -4,6 +4,8 @@
* http://www.opensource.org/licenses/mit-license.php
* Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
*/
+
+#include <stddef.h>
#include <dom/core/attr.h>
Modified: trunk/dom/src/core/document.c
URL: http://source.netsurf-browser.org/trunk/dom/src/core/document.c?rev=3394&...
==============================================================================
--- trunk/dom/src/core/document.c (original)
+++ trunk/dom/src/core/document.c Tue Jul 10 22:36:14 2007
@@ -10,13 +10,26 @@
#include "core/document.h"
#include "core/node.h"
+#include "core/nodelist.h"
#include "utils/utils.h"
+
+/**
+ * Item in list of active nodelists
+ */
+struct dom_doc_nl {
+ struct dom_nodelist *list; /**< Nodelist */
+
+ struct dom_doc_nl *next; /**< Next item */
+ struct dom_doc_nl *prev; /**< Previous item */
+};
/**
* DOM document
*/
struct dom_document {
struct dom_node base; /**< Base node */
+
+ struct dom_doc_nl *nodelists; /**< List of active nodelists */
dom_alloc alloc; /**< Memory (de)allocation function */
void *pw; /**< Pointer to client data */
@@ -735,3 +748,104 @@
{
return doc->alloc(ptr, size, doc->pw);
}
+
+/**
+ * Get a nodelist, creating one if necessary
+ *
+ * \param doc The document to get a nodelist for
+ * \param root Root node of subtree that list applies to
+ * \param tagname Name of nodes in list (or NULL)
+ * \param namespace Namespace part of nodes in list (or NULL)
+ * \param localname Local part of nodes in list (or NULL)
+ * \param list Pointer to location to receive list
+ * \return DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion
+ *
+ * The returned list will have its reference count increased. It is
+ * the responsibility of the caller to unref the list once it has
+ * finished with it.
+ */
+dom_exception dom_document_get_nodelist(struct dom_document *doc,
+ struct dom_node *root, struct dom_string *tagname,
+ struct dom_string *namespace, struct dom_string *localname,
+ struct dom_nodelist **list)
+{
+ struct dom_doc_nl *l;
+ dom_exception err;
+
+ for (l = doc->nodelists; l; l = l->next) {
+ if (dom_nodelist_match(l->list, root, tagname,
+ namespace, localname))
+ break;
+ }
+
+ if (l != NULL) {
+ /* Found an existing list, so use it */
+ dom_nodelist_ref(l->list);
+ } else {
+ /* No existing list */
+
+ /* Create active list entry */
+ l = doc->alloc(NULL, sizeof(struct dom_doc_nl), doc->pw);
+ if (l == NULL)
+ return DOM_NO_MEM_ERR;
+
+ /* Create nodelist */
+ err = dom_nodelist_create(doc, root, tagname, namespace,
+ localname, &l->list);
+ if (err != DOM_NO_ERR) {
+ doc->alloc(l, 0, doc->pw);
+ return err;
+ }
+
+ /* Add to document's list of active nodelists */
+ l->prev = NULL;
+ l->next = doc->nodelists;
+ if (doc->nodelists)
+ doc->nodelists->prev = l;
+ doc->nodelists = l;
+ }
+
+ /* Note: the document does not claim a reference on the nodelist
+ * If it did, the nodelist's reference count would never reach zero,
+ * and the list would remain indefinitely. This is not a problem as
+ * the list notifies the document of its destruction via
+ * dom_document_remove_nodelist.*/
+
+ *list = l->list;
+
+ return DOM_NO_ERR;
+}
+
+/**
+ * Remove a nodelist from a document
+ *
+ * \param doc The document to remove the list from
+ * \param list The list to remove
+ */
+void dom_document_remove_nodelist(struct dom_document *doc,
+ struct dom_nodelist *list)
+{
+ struct dom_doc_nl *l;
+
+ for (l = doc->nodelists; l; l = l->next) {
+ if (l->list == list)
+ break;
+ }
+
+ if (l == NULL) {
+ /* This should never happen; we should probably abort here */
+ return;
+ }
+
+ /* Remove from list */
+ if (l->prev != NULL)
+ l->prev->next = l->next;
+ else
+ doc->nodelists = l->next;
+
+ if (l->next != NULL)
+ l->next->prev = l->prev;
+
+ /* And free item */
+ doc->alloc(l, 0, doc->pw);
+}
Modified: trunk/dom/src/core/document.h
URL: http://source.netsurf-browser.org/trunk/dom/src/core/document.h?rev=3394&...
==============================================================================
--- trunk/dom/src/core/document.h (original)
+++ trunk/dom/src/core/document.h Tue Jul 10 22:36:14 2007
@@ -12,8 +12,24 @@
#include <stddef.h>
struct dom_document;
+struct dom_node;
+struct dom_nodelist;
+struct dom_string;
+/* Get base of document buffer */
const uint8_t *dom_document_get_base(struct dom_document *doc);
+
+/* (De)allocate memory */
void *dom_document_alloc(struct dom_document *doc, void *ptr, size_t size);
+/* Get a nodelist, creating one if necessary */
+dom_exception dom_document_get_nodelist(struct dom_document *doc,
+ struct dom_node *root, struct dom_string *tagname,
+ struct dom_string *namespace, struct dom_string *localname,
+ struct dom_nodelist **list);
+
+/* Remove a nodelist */
+void dom_document_remove_nodelist(struct dom_document *doc,
+ struct dom_nodelist *list);
+
#endif
Modified: trunk/dom/src/core/node.c
URL: http://source.netsurf-browser.org/trunk/dom/src/core/node.c?rev=3394&r1=3...
==============================================================================
--- trunk/dom/src/core/node.c (original)
+++ trunk/dom/src/core/node.c Tue Jul 10 22:36:14 2007
@@ -4,6 +4,8 @@
* http://www.opensource.org/licenses/mit-license.php
* Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
*/
+
+#include <dom/core/string.h>
#include "core/document.h"
#include "core/node.h"
Modified: trunk/dom/src/core/node.h
URL: http://source.netsurf-browser.org/trunk/dom/src/core/node.h?rev=3394&r1=3...
==============================================================================
--- trunk/dom/src/core/node.h (original)
+++ trunk/dom/src/core/node.h Tue Jul 10 22:36:14 2007
@@ -9,9 +9,9 @@
#define dom_internal_core_node_h_
#include <dom/core/node.h>
-#include <dom/core/string.h>
struct dom_attr;
+struct dom_string;
/**
* User data context attached to a DOM node
Added: trunk/dom/src/core/nodelist.c
URL: http://source.netsurf-browser.org/trunk/dom/src/core/nodelist.c?rev=3394&...
==============================================================================
--- trunk/dom/src/core/nodelist.c (added)
+++ trunk/dom/src/core/nodelist.c Tue Jul 10 22:36:14 2007
@@ -1,0 +1,228 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#include <dom/core/node.h>
+#include <dom/core/nodelist.h>
+#include <dom/core/string.h>
+
+#include "core/document.h"
+#include "core/nodelist.h"
+
+#include "utils/utils.h"
+
+struct dom_node;
+
+/**
+ * DOM node list
+ */
+struct dom_nodelist {
+ struct dom_document *owner; /**< Owning document */
+
+ struct dom_node *root; /**< Root of applicable subtree */
+
+ enum { DOM_NODELIST_CHILDREN,
+ DOM_NODELIST_BY_NAME,
+ DOM_NODELIST_BY_NAMESPACE
+ } type; /**< List type */
+
+ union {
+ struct dom_string *name; /**< Tag name to match */
+ struct {
+ struct dom_string *namespace; /**< Namespace */
+ struct dom_string *localname; /**< Localname */
+ } ns; /**< Data for namespace matching */
+ } data;
+
+ uint32_t refcnt; /**< Reference count */
+};
+
+/**
+ * Create a nodelist
+ *
+ * \param doc Owning document
+ * \param root Root node of subtree that list applies to
+ * \param tagname Name of nodes in list (or NULL)
+ * \param namespace Namespace part of nodes in list (or NULL)
+ * \param localname Local part of nodes in list (or NULL)
+ * \param list Pointer to location to receive list
+ * \return DOM_NO_ERR on success, DOM_NO_MEM_ERR on memory exhaustion
+ *
+ * ::root must be a node owned by ::doc
+ *
+ * If ::tagname is non-NULL, ::namespace and ::localname must be NULL and
+ * the created list will match nodes by name
+ * If ::namespace is non-NULL, ::localname must be non-NULL and
+ * ::tagname must be NULL and the created list will match nodes by namespace
+ * and localname
+ * If ::tagname, ::namespace and ::localname are NULL, the created list
+ * will match the children of ::root.
+ *
+ * The returned list will already be referenced, so the client need not
+ * do so explicitly. The client should unref the list once finished with it.
+ */
+dom_exception dom_nodelist_create(struct dom_document *doc,
+ struct dom_node *root, struct dom_string *tagname,
+ struct dom_string *namespace, struct dom_string *localname,
+ struct dom_nodelist **list)
+{
+ struct dom_nodelist *l;
+
+ l = dom_document_alloc(doc, NULL, sizeof(struct dom_nodelist));
+ if (l == NULL)
+ return DOM_NO_MEM_ERR;
+
+ dom_node_ref((struct dom_node *) doc);
+ l->owner = doc;
+
+ dom_node_ref(root);
+ l->root = root;
+
+ if (tagname != NULL && namespace == NULL && localname == NULL) {
+ dom_string_ref(tagname);
+ l->type = DOM_NODELIST_BY_NAME;
+ l->data.name = tagname;
+ } else if (namespace != NULL && localname != NULL &&
+ tagname == NULL) {
+ dom_string_ref(namespace);
+ dom_string_ref(localname);
+ l->type = DOM_NODELIST_BY_NAMESPACE;
+ l->data.ns.namespace = namespace;
+ l->data.ns.localname = localname;
+ } else {
+ l->type = DOM_NODELIST_CHILDREN;
+ }
+
+ l->refcnt = 1;
+
+ *list = l;
+
+ return DOM_NO_ERR;
+}
+
+/**
+ * Claim a reference on a DOM node list
+ *
+ * \param list The list to claim a reference on
+ */
+void dom_nodelist_ref(struct dom_nodelist *list)
+{
+ list->refcnt++;
+}
+
+/**
+ * Release a reference on a DOM node list
+ *
+ * \param list The list to release the reference from
+ *
+ * If the reference count reaches zero, any memory claimed by the
+ * list will be released
+ */
+void dom_nodelist_unref(struct dom_nodelist *list)
+{
+ if (--list->refcnt == 0) {
+ switch (list->type) {
+ case DOM_NODELIST_CHILDREN:
+ /* Nothing to do */
+ break;
+ case DOM_NODELIST_BY_NAMESPACE:
+ dom_string_unref(list->data.ns.namespace);
+ dom_string_unref(list->data.ns.localname);
+ break;
+ case DOM_NODELIST_BY_NAME:
+ dom_string_unref(list->data.name);
+ break;
+ }
+
+ dom_node_unref(list->root);
+
+ dom_node_unref((struct dom_node *) list->owner);
+
+ /* Remove list from document */
+ dom_document_remove_nodelist(list->owner, list);
+
+ /* And destroy the list object */
+ dom_document_alloc(list->owner, list, 0);
+ }
+}
+
+/**
+ * Retrieve the length of a node list
+ *
+ * \param list List to retrieve length of
+ * \param length Pointer to location to receive length
+ * \return DOM_NO_ERR.
+ */
+dom_exception dom_nodelist_get_length(struct dom_nodelist *list,
+ unsigned long *length)
+{
+ UNUSED(list);
+ UNUSED(length);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Retrieve an item from a node list
+ *
+ * \param list The list to retrieve the item from
+ * \param index The list index to retrieve
+ * \param node Pointer to location to receive item
+ * \return DOM_NO_ERR.
+ *
+ * ::index is a zero-based index into ::list.
+ * ::index lies in the range [0, length-1]
+ *
+ * The returned node will have had its reference count increased. The client
+ * should unref the node once it has finished with it.
+ */
+dom_exception dom_nodelist_item(struct dom_nodelist *list,
+ unsigned long index, struct dom_node **node)
+{
+ UNUSED(list);
+ UNUSED(index);
+ UNUSED(node);
+
+ return DOM_NOT_SUPPORTED_ERR;
+}
+
+/**
+ * Match a nodelist instance against a set of nodelist creation parameters
+ *
+ * \param list List to match
+ * \param root Root node of subtree that list applies to
+ * \param tagname Name of nodes in list (or NULL)
+ * \param namespace Namespace part of nodes in list (or NULL)
+ * \param localname Local part of nodes in list (or NULL)
+ * \return true if list matches, false otherwise
+ */
+bool dom_nodelist_match(struct dom_nodelist *list, struct dom_node *root,
+ struct dom_string *tagname, struct dom_string *namespace,
+ struct dom_string *localname)
+{
+ if (list->root != root)
+ return false;
+
+ if (list->type == DOM_NODELIST_CHILDREN && tagname == NULL &&
+ namespace == NULL && localname == NULL) {
+ return true;
+ }
+
+ if (list->type == DOM_NODELIST_BY_NAME && tagname != NULL &&
+ namespace == NULL && localname == NULL) {
+ return (dom_string_cmp(list->data.name, tagname) == 0);
+ }
+
+ if (list->type == DOM_NODELIST_BY_NAMESPACE && tagname == NULL &&
+ namespace != NULL && localname != NULL) {
+ return (dom_string_cmp(list->data.ns.namespace,
+ namespace) == 0) &&
+ (dom_string_cmp(list->data.ns.localname,
+ localname) == 0);
+ }
+
+ return false;
+}
Added: trunk/dom/src/core/nodelist.h
URL: http://source.netsurf-browser.org/trunk/dom/src/core/nodelist.h?rev=3394&...
==============================================================================
--- trunk/dom/src/core/nodelist.h (added)
+++ trunk/dom/src/core/nodelist.h Tue Jul 10 22:36:14 2007
@@ -1,0 +1,31 @@
+/*
+ * This file is part of libdom.
+ * Licensed under the MIT License,
+ * http://www.opensource.org/licenses/mit-license.php
+ * Copyright 2007 John-Mark Bell <jmb(a)netsurf-browser.org>
+ */
+
+#ifndef dom_internal_nodelist_h_
+#define dom_internal_nodelist_h_
+
+#include <stdbool.h>
+
+#include <dom/core/nodelist.h>
+
+struct dom_document;
+struct dom_node;
+struct dom_nodelist;
+struct dom_string;
+
+/* Create a nodelist */
+dom_exception dom_nodelist_create(struct dom_document *doc,
+ struct dom_node *root, struct dom_string *tagname,
+ struct dom_string *namespace, struct dom_string *localname,
+ struct dom_nodelist **list);
+
+/* Match a nodelist instance against a set of nodelist creation parameters */
+bool dom_nodelist_match(struct dom_nodelist *list, struct dom_node *root,
+ struct dom_string *tagname, struct dom_string *namespace,
+ struct dom_string *localname);
+
+#endif
Modified: trunk/dom/src/core/string.c
URL: http://source.netsurf-browser.org/trunk/dom/src/core/string.c?rev=3394&r1...
==============================================================================
--- trunk/dom/src/core/string.c (original)
+++ trunk/dom/src/core/string.c Tue Jul 10 22:36:14 2007
@@ -217,3 +217,57 @@
return DOM_NO_ERR;
}
+
+/**
+ * Case sensitively compare two DOM strings
+ *
+ * \param s1 The first string to compare
+ * \param s2 The second string to compare
+ * \return 0 if strings match, non-0 otherwise
+ */
+int dom_string_cmp(struct dom_string *s1, struct dom_string *s2)
+{
+ const uint8_t *d1, *d2;
+ size_t l1, l2;
+ dom_exception err;
+
+ err = dom_string_get_data(s1, &d1, &l1);
+ if (err != DOM_NO_ERR)
+ return 1; /* arbitrary */
+
+ err = dom_string_get_data(s2, &d2, &l2);
+ if (err != DOM_NO_ERR)
+ return 1; /* arbitrary */
+
+ if (l1 != l2)
+ return 1; /* arbitrary */
+
+ return strncmp((const char *) d1, (const char *) d2, l1);
+}
+
+/**
+ * Case insensitively compare two DOM strings
+ *
+ * \param s1 The first string to compare
+ * \param s2 The second string to compare
+ * \return 0 if strings match, non-0 otherwise
+ */
+int dom_string_icmp(struct dom_string *s1, struct dom_string *s2)
+{
+ const uint8_t *d1, *d2;
+ size_t l1, l2;
+ dom_exception err;
+
+ err = dom_string_get_data(s1, &d1, &l1);
+ if (err != DOM_NO_ERR)
+ return 1; /* arbitrary */
+
+ err = dom_string_get_data(s2, &d2, &l2);
+ if (err != DOM_NO_ERR)
+ return 1; /* arbitrary */
+
+ if (l1 != l2)
+ return 1; /* arbitrary */
+
+ return strncasecmp((const char *) d1, (const char *) d2, l1);
+}
16 years, 2 months
r3392 rjek - in /trunk/netsurf/gtk: gtk_scaffolding.c res/netsurf.glade
by netsurf@semichrome.net
Author: rjek
Date: Mon Jul 9 15:18:00 2007
New Revision: 3392
URL: http://source.netsurf-browser.org?rev=3392&view=rev
Log:
Implement removing of menu bar, tool bar and status bar from menu.
Issues that remain:
* These options are not saved along with the window position and size
* When the menu is detached, keyboard shortcuts cease to work
Modified:
trunk/netsurf/gtk/gtk_scaffolding.c
trunk/netsurf/gtk/res/netsurf.glade
Modified: trunk/netsurf/gtk/gtk_scaffolding.c
URL: http://source.netsurf-browser.org/trunk/netsurf/gtk/gtk_scaffolding.c?rev...
==============================================================================
--- trunk/netsurf/gtk/gtk_scaffolding.c (original)
+++ trunk/netsurf/gtk/gtk_scaffolding.c Mon Jul 9 15:18:00 2007
@@ -46,10 +46,12 @@
GtkEntry *url_bar;
GtkEntryCompletion *url_bar_completion;
GtkLabel *status_bar;
+ GtkToolbar *tool_bar;
GtkToolButton *back_button;
GtkToolButton *forward_button;
GtkToolButton *stop_button;
GtkToolButton *reload_button;
+ GtkMenuBar *menu_bar;
GtkMenuItem *back_menu;
GtkMenuItem *forward_menu;
GtkMenuItem *stop_menu;
@@ -127,6 +129,9 @@
MENUPROTO(normal_size);
MENUPROTO(zoom_out);
MENUPROTO(full_screen);
+MENUPROTO(menu_bar);
+MENUPROTO(tool_bar);
+MENUPROTO(status_bar);
MENUPROTO(save_window_size);
MENUPROTO(toggle_debug_rendering);
@@ -161,6 +166,9 @@
MENUEVENT(normal_size),
MENUEVENT(zoom_out),
MENUEVENT(full_screen),
+ MENUEVENT(menu_bar),
+ MENUEVENT(tool_bar),
+ MENUEVENT(status_bar),
MENUEVENT(save_window_size),
MENUEVENT(toggle_debug_rendering),
@@ -460,6 +468,45 @@
gw->fullscreen = !gw->fullscreen;
+ return TRUE;
+}
+
+MENUHANDLER(menu_bar)
+{
+ struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g;
+
+ if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
+ gtk_widget_show(GTK_WIDGET(gw->menu_bar));
+ } else {
+ gtk_widget_hide(GTK_WIDGET(gw->menu_bar));
+ }
+
+ return TRUE;
+}
+
+MENUHANDLER(tool_bar)
+{
+ struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g;
+
+ if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
+ gtk_widget_show(GTK_WIDGET(gw->tool_bar));
+ } else {
+ gtk_widget_hide(GTK_WIDGET(gw->tool_bar));
+ }
+
+ return TRUE;
+}
+
+MENUHANDLER(status_bar)
+{
+ struct gtk_scaffolding *gw = (struct gtk_scaffolding *)g;
+
+ if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))) {
+ gtk_widget_show(GTK_WIDGET(gw->status_bar));
+ } else {
+ gtk_widget_hide(GTK_WIDGET(gw->status_bar));
+ }
+
return TRUE;
}
@@ -641,7 +688,9 @@
glade_xml_signal_autoconnect(g->xml);
g->window = GTK_WINDOW(GET_WIDGET("wndBrowser"));
g->url_bar = GTK_ENTRY(GET_WIDGET("URLBar"));
+ g->menu_bar = GTK_MENU_BAR(GET_WIDGET("menubar"));
g->status_bar = GTK_LABEL(GET_WIDGET("statusBar"));
+ g->tool_bar = GTK_TOOLBAR(GET_WIDGET("toolbar"));
g->back_button = GTK_TOOL_BUTTON(GET_WIDGET("toolBack"));
g->forward_button = GTK_TOOL_BUTTON(GET_WIDGET("toolForward"));
g->stop_button = GTK_TOOL_BUTTON(GET_WIDGET("toolStop"));
Modified: trunk/netsurf/gtk/res/netsurf.glade
URL: http://source.netsurf-browser.org/trunk/netsurf/gtk/res/netsurf.glade?rev...
==============================================================================
--- trunk/netsurf/gtk/res/netsurf.glade (original)
+++ trunk/netsurf/gtk/res/netsurf.glade Mon Jul 9 15:18:00 2007
@@ -25,13 +25,13 @@
<property name="spacing">0</property>
<child>
- <widget class="GtkMenuBar" id="menubar1">
+ <widget class="GtkMenuBar" id="menubar">
<property name="visible">True</property>
<property name="pack_direction">GTK_PACK_DIRECTION_LTR</property>
<property name="child_pack_direction">GTK_PACK_DIRECTION_LTR</property>
<child>
- <widget class="GtkMenuItem" id="menuitem4">
+ <widget class="GtkMenuItem" id="menuitem_main">
<property name="visible">True</property>
<property name="label" translatable="yes">_File</property>
<property name="use_underline">True</property>
@@ -48,7 +48,7 @@
<accelerator key="N" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image520">
+ <widget class="GtkImage" id="image554">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@@ -80,7 +80,7 @@
<accelerator key="F" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image521">
+ <widget class="GtkImage" id="image555">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
@@ -102,7 +102,7 @@
<accelerator key="W" modifiers="GDK_CONTROL_MASK | GDK_SHIFT_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image522">
+ <widget class="GtkImage" id="image556">
<property name="visible">True</property>
<property name="stock">gtk-close</property>
<property name="icon_size">1</property>
@@ -131,7 +131,7 @@
<accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image523">
+ <widget class="GtkImage" id="image557">
<property name="visible">True</property>
<property name="stock">gtk-save-as</property>
<property name="icon_size">1</property>
@@ -201,7 +201,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image524">
+ <widget class="GtkImage" id="image558">
<property name="visible">True</property>
<property name="stock">gtk-print-preview</property>
<property name="icon_size">1</property>
@@ -224,7 +224,7 @@
<accelerator key="P" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image525">
+ <widget class="GtkImage" id="image559">
<property name="visible">True</property>
<property name="stock">gtk-print</property>
<property name="icon_size">1</property>
@@ -256,7 +256,7 @@
</child>
<child>
- <widget class="GtkMenuItem" id="menuitem5">
+ <widget class="GtkMenuItem" id="menuitem_edit">
<property name="visible">True</property>
<property name="label" translatable="yes">_Edit</property>
<property name="use_underline">True</property>
@@ -348,7 +348,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
- <widget class="GtkImage" id="image526">
+ <widget class="GtkImage" id="image560">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
@@ -366,7 +366,7 @@
</child>
<child>
- <widget class="GtkMenuItem" id="menuitem6">
+ <widget class="GtkMenuItem" id="menuitem_view">
<property name="visible">True</property>
<property name="label" translatable="yes">_View</property>
<property name="use_underline">True</property>
@@ -382,7 +382,7 @@
<accelerator key="Escape" modifiers="0" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image527">
+ <widget class="GtkImage" id="image561">
<property name="visible">True</property>
<property name="stock">gtk-stop</property>
<property name="icon_size">1</property>
@@ -403,7 +403,7 @@
<accelerator key="F5" modifiers="0" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image528">
+ <widget class="GtkImage" id="image562">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@@ -431,7 +431,7 @@
<accelerator key="F11" modifiers="0" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image529">
+ <widget class="GtkImage" id="image563">
<property name="visible">True</property>
<property name="stock">gtk-zoom-in</property>
<property name="icon_size">1</property>
@@ -453,7 +453,7 @@
<accelerator key="plus" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image530">
+ <widget class="GtkImage" id="image564">
<property name="visible">True</property>
<property name="stock">gtk-zoom-in</property>
<property name="icon_size">1</property>
@@ -474,7 +474,7 @@
<accelerator key="0" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image531">
+ <widget class="GtkImage" id="image565">
<property name="visible">True</property>
<property name="stock">gtk-zoom-100</property>
<property name="icon_size">1</property>
@@ -495,7 +495,7 @@
<accelerator key="minus" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image532">
+ <widget class="GtkImage" id="image566">
<property name="visible">True</property>
<property name="stock">gtk-zoom-out</property>
<property name="icon_size">1</property>
@@ -520,7 +520,7 @@
<accelerator key="F11" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image533">
+ <widget class="GtkImage" id="image567">
<property name="visible">True</property>
<property name="stock">gtk-fullscreen</property>
<property name="icon_size">1</property>
@@ -578,7 +578,6 @@
<child>
<widget class="GtkMenuItem" id="toolbars">
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="label" translatable="yes">Toolbars</property>
<property name="use_underline">True</property>
@@ -588,7 +587,6 @@
<child>
<widget class="GtkCheckMenuItem" id="menu_bar">
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="label" translatable="yes">Menu bar</property>
<property name="use_underline">True</property>
<property name="active">True</property>
@@ -596,39 +594,17 @@
</child>
<child>
- <widget class="GtkCheckMenuItem" id="buttons">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="label" translatable="yes">Buttons</property>
+ <widget class="GtkCheckMenuItem" id="tool_bar">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Button bar</property>
<property name="use_underline">True</property>
<property name="active">True</property>
</widget>
</child>
<child>
- <widget class="GtkCheckMenuItem" id="address_bar">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="label" translatable="yes">Address bar</property>
- <property name="use_underline">True</property>
- <property name="active">True</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkCheckMenuItem" id="throbber">
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="label" translatable="yes">Throbber</property>
- <property name="use_underline">True</property>
- <property name="active">True</property>
- </widget>
- </child>
-
- <child>
<widget class="GtkCheckMenuItem" id="status_bar">
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="label" translatable="yes">Status bar</property>
<property name="use_underline">True</property>
<property name="active">True</property>
@@ -667,7 +643,7 @@
</child>
<child>
- <widget class="GtkMenuItem" id="menuitem7">
+ <widget class="GtkMenuItem" id="menuitem_navigate">
<property name="visible">True</property>
<property name="label" translatable="yes">_Navigate</property>
<property name="use_underline">True</property>
@@ -683,7 +659,7 @@
<accelerator key="Left" modifiers="GDK_MOD1_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image534">
+ <widget class="GtkImage" id="image568">
<property name="visible">True</property>
<property name="stock">gtk-go-back</property>
<property name="icon_size">1</property>
@@ -704,7 +680,7 @@
<accelerator key="Right" modifiers="GDK_MOD1_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image535">
+ <widget class="GtkImage" id="image569">
<property name="visible">True</property>
<property name="stock">gtk-go-forward</property>
<property name="icon_size">1</property>
@@ -725,7 +701,7 @@
<accelerator key="Home" modifiers="GDK_MOD1_MASK" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image536">
+ <widget class="GtkImage" id="image570">
<property name="visible">True</property>
<property name="stock">gtk-home</property>
<property name="icon_size">1</property>
@@ -796,7 +772,7 @@
</child>
<child>
- <widget class="GtkMenuItem" id="menuitem8">
+ <widget class="GtkMenuItem" id="menuitem_help">
<property name="visible">True</property>
<property name="label" translatable="yes">_Help</property>
<property name="use_underline">True</property>
@@ -814,7 +790,7 @@
<accelerator key="F1" modifiers="0" signal="activate"/>
<child internal-child="image">
- <widget class="GtkImage" id="image537">
+ <widget class="GtkImage" id="image571">
<property name="visible">True</property>
<property name="stock">gtk-help</property>
<property name="icon_size">1</property>
@@ -872,7 +848,7 @@
</child>
<child>
- <widget class="GtkToolbar" id="toolbar1">
+ <widget class="GtkToolbar" id="toolbar">
<property name="visible">True</property>
<property name="orientation">GTK_ORIENTATION_HORIZONTAL</property>
<property name="toolbar_style">GTK_TOOLBAR_BOTH_HORIZ</property>
16 years, 2 months