Gitweb links:
...log
http://git.netsurf-browser.org/libdom.git/shortlog/584be5d50fa206e2d8772db4b3b5c231efc41c66
...commit
http://git.netsurf-browser.org/libdom.git/commit/584be5d50fa206e2d8772db4b3b5c231efc41c66
...tree
http://git.netsurf-browser.org/libdom.git/tree/584be5d50fa206e2d8772db4b3b5c231efc41c66
The branch, master has been updated
via 584be5d50fa206e2d8772db4b3b5c231efc41c66 (commit)
via 4e06242c80836b8c4f2ed442d58dc7f249a36183 (commit)
via 4d1731bba2d6091e25c7d1d57b0e547c8ac30db9 (commit)
via 4e75ebae52fc71336141f95dc83971b51002a104 (commit)
via f09983f45ee5f22e0df44a7c1d7ea85f7336efe2 (commit)
from 14e6724ec71b08a88dca138c4de10ad695430dfd (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/libdom.git/commit/?id=584be5d50fa206e2d8772db4b3b5c231efc41c66
commit 584be5d50fa206e2d8772db4b3b5c231efc41c66
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
HTMLDocument.body: Squash leak of node list.
diff --git a/src/html/html_document.c b/src/html/html_document.c
index 2f219d0..9b749ae 100644
--- a/src/html/html_document.c
+++ b/src/html/html_document.c
@@ -1119,6 +1119,7 @@ dom_exception
_dom_html_document_get_body(dom_html_document *doc,
}
if (len == 0) {
+ dom_nodelist_unref(nodes);
exc = dom_document_get_elements_by_tag_name(doc,
doc->elements[DOM_HTML_ELEMENT_TYPE_FRAMESET],
&nodes);
commitdiff
http://git.netsurf-browser.org/libdom.git/commit/?id=4e06242c80836b8c4f2ed442d58dc7f249a36183
commit 4e06242c80836b8c4f2ed442d58dc7f249a36183
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
HTMLCollection.namedItem: Squash leak of id_name.
diff --git a/src/html/html_collection.c b/src/html/html_collection.c
index cba2b2d..7bb55b6 100644
--- a/src/html/html_collection.c
+++ b/src/html/html_collection.c
@@ -215,7 +215,8 @@ dom_exception
dom_html_collection_named_item(dom_html_collection *col,
struct dom_node_internal *n = col->root;
dom_html_document *doc = (dom_html_document *)dom_node_get_owner(n);
dom_exception err;
- while (n != NULL) {
+
+ while (n != NULL) {
if (n->type == DOM_ELEMENT_NODE &&
col->ic(n, col->ctx) == true) {
dom_string *id = NULL;
@@ -227,16 +228,15 @@ dom_exception
dom_html_collection_named_item(dom_html_collection *col,
return err;
}
- if (id != NULL && dom_string_isequal(name, id)) {
- *node = (struct dom_node *) n;
- dom_node_ref(n);
- dom_string_unref(id);
-
- return DOM_NO_ERR;
- }
+ if (id != NULL) {
+ if (dom_string_isequal(name, id)) {
+ *node = dom_node_ref(n);
+ dom_string_unref(id);
- if (id != NULL)
+ return DOM_NO_ERR;
+ }
dom_string_unref(id);
+ }
/* Check for Name attr if id not matched/found */
err = _dom_element_get_attribute((dom_element *)n,
@@ -244,14 +244,16 @@ dom_exception
dom_html_collection_named_item(dom_html_collection *col,
if(err != DOM_NO_ERR) {
return err;
}
- if (id_name != NULL && dom_string_isequal(name,
id_name)) {
- *node = (struct dom_node *) n;
- dom_node_ref(n);
- dom_string_unref(id_name);
- return DOM_NO_ERR;
- }
+ if (id_name != NULL) {
+ if (dom_string_isequal(name, id_name)) {
+ *node = dom_node_ref(n);
+ dom_string_unref(id_name);
+ return DOM_NO_ERR;
+ }
+ dom_string_unref(id_name);
+ }
}
/* Depth first iterating */
commitdiff
http://git.netsurf-browser.org/libdom.git/commit/?id=4d1731bba2d6091e25c7d1d57b0e547c8ac30db9
commit 4d1731bba2d6091e25c7d1d57b0e547c8ac30db9
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
dom_html_table_row_element_get_row_index: Squash t_head node leak.
diff --git a/src/html/html_tablerow_element.c b/src/html/html_tablerow_element.c
index b722d0d..587edd4 100644
--- a/src/html/html_tablerow_element.c
+++ b/src/html/html_tablerow_element.c
@@ -244,15 +244,13 @@ dom_exception dom_html_table_row_element_get_row_index(
return exp;
}
- exp = dom_html_table_section_element_get_rows(t_head,
- &rows);
+ exp = dom_html_table_section_element_get_rows(t_head, &rows);
+ dom_node_unref(t_head);
if (exp != DOM_NO_ERR) {
- dom_node_unref(t_head);
return exp;
}
- dom_html_collection_get_length(rows,
- &len);
+ dom_html_collection_get_length(rows, &len);
dom_html_collection_unref(rows);
count += len;
commitdiff
http://git.netsurf-browser.org/libdom.git/commit/?id=4e75ebae52fc71336141f95dc83971b51002a104
commit 4e75ebae52fc71336141f95dc83971b51002a104
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
HTMLTableElement.insertRow: Fix lifetimes and error handling.
diff --git a/include/dom/html/html_table_element.h
b/include/dom/html/html_table_element.h
index 6fcd7ed..205d719 100644
--- a/include/dom/html/html_table_element.h
+++ b/include/dom/html/html_table_element.h
@@ -120,7 +120,7 @@ dom_exception dom_html_table_element_delete_t_foot(
dom_exception dom_html_table_element_insert_row(
dom_html_table_element *element,
- int32_t index, dom_html_element **row);
+ int32_t index, dom_html_element **row_out);
dom_exception dom_html_table_element_delete_row(
dom_html_table_element *element,
diff --git a/src/html/html_table_element.c b/src/html/html_table_element.c
index 7e8a508..82dbca0 100644
--- a/src/html/html_table_element.c
+++ b/src/html/html_table_element.c
@@ -726,6 +726,7 @@ static dom_exception dom_html_table_element_create_t_body(
dom_html_collection_unref(t_bodies);
return exp;
}
+
/**
* Insert a new Row into the table
*
@@ -736,39 +737,22 @@ static dom_exception dom_html_table_element_create_t_body(
dom_exception dom_html_table_element_insert_row(
dom_html_table_element *element,
int32_t index,
- dom_html_element **row)
+ dom_html_element **row_out)
{
dom_exception exp;
+ dom_html_table_row_element *row;
dom_html_collection* rows;
uint32_t len;
dom_html_document *doc = (dom_html_document *)
((dom_node_internal *) element)->owner;
- struct dom_html_element_create_params params = {
- .type = DOM_HTML_ELEMENT_TYPE_TR,
- .doc = doc,
- .name = doc->elements[DOM_HTML_ELEMENT_TYPE_TR],
- .namespace = ((dom_node_internal *)element)->namespace,
- .prefix = ((dom_node_internal *)element)->prefix
- };
-
- exp = dom_html_table_element_get_rows(element,
- &rows);
+ exp = dom_html_table_element_get_rows(element, &rows);
if(exp != DOM_NO_ERR) {
- dom_html_collection_unref(rows);
return exp;
}
- exp = dom_html_collection_get_length(rows,
- &len);
- if(exp != DOM_NO_ERR) {
- dom_html_collection_unref(rows);
- return exp;
- }
- exp = _dom_html_table_row_element_create(¶ms,
- (dom_html_table_row_element **)row);
+ exp = dom_html_collection_get_length(rows, &len);
+ dom_html_collection_unref(rows);
if(exp != DOM_NO_ERR) {
- dom_node_unref(*row);
- dom_html_collection_unref(rows);
return exp;
}
@@ -777,19 +761,31 @@ dom_exception dom_html_table_element_insert_row(
} else if(len == 0) {
dom_html_table_section_element *new_body;
dom_node *new_row;
- exp = dom_html_table_element_create_t_body(element,
- &new_body);
+
+ struct dom_html_element_create_params params = {
+ .type = DOM_HTML_ELEMENT_TYPE_TR,
+ .doc = doc,
+ .name = doc->elements[DOM_HTML_ELEMENT_TYPE_TR],
+ .namespace = ((dom_node_internal *)element)->namespace,
+ .prefix = ((dom_node_internal *)element)->prefix
+ };
+
+ exp = _dom_html_table_row_element_create(¶ms, &row);
if(exp != DOM_NO_ERR) {
- dom_html_collection_unref(rows);
- dom_node_unref(new_body);
return exp;
}
- exp = dom_node_append_child(new_body, *row,
- &new_row);
+ exp = dom_html_table_element_create_t_body(element, &new_body);
+ if(exp != DOM_NO_ERR) {
+ dom_node_unref(row);
+ return exp;
+ }
+
+ exp = dom_node_append_child(new_body, row, &new_row);
+ dom_node_unref(new_body);
+ dom_node_unref(row);
if(exp == DOM_NO_ERR) {
- dom_node_unref(*row);
- *row = (dom_html_element *)new_row;
+ *row_out = (dom_html_element *)new_row;
}
} else {
uint32_t window_len = 0, section_len;
@@ -802,83 +798,109 @@ dom_exception dom_html_table_element_insert_row(
}
exp = dom_html_table_element_get_t_head(element, &t_head);
- if (exp != DOM_NO_ERR)
+ if (exp != DOM_NO_ERR) {
return exp;
-
- dom_html_collection_unref(rows);
+ }
exp = dom_html_table_section_element_get_rows(t_head, &rows);
if(exp != DOM_NO_ERR) {
- dom_html_collection_unref(rows);
+ dom_node_unref(t_head);
return exp;
}
- dom_html_collection_get_length(rows, §ion_len);
+ exp = dom_html_collection_get_length(rows, §ion_len);
+ dom_html_collection_unref(rows);
if(exp != DOM_NO_ERR) {
- dom_html_collection_unref(rows);
+ dom_node_unref(t_head);
return exp;
}
if(window_len + section_len > (uint32_t)index ||
window_len + section_len == len) {
- dom_html_collection_unref(rows);
- return dom_html_table_section_element_insert_row(t_head,
- index-window_len, row);
+ exp = dom_html_table_section_element_insert_row(t_head,
+ index-window_len,
+ (struct dom_html_element **)&row);
+ dom_node_unref(t_head);
+ if (exp == DOM_NO_ERR) {
+ *row_out = (dom_html_element *)row;
+ }
+ return exp;
}
+ dom_node_unref(t_head);
window_len += section_len;
n = (dom_node_internal *)element;
- dom_html_collection_unref(rows);
-
for (n = n->first_child; n != NULL; n = n->next) {
if((n->type == DOM_ELEMENT_NODE) &&
dom_string_caseless_isequal(
doc->elements[DOM_HTML_ELEMENT_TYPE_TBODY],
n->name)) {
- exp =
dom_html_table_section_element_get_rows((dom_html_table_section_element *)n,
&rows);
+ exp = dom_html_table_section_element_get_rows(
+ (dom_html_table_section_element
*)n,
+ &rows);
+ if (exp != DOM_NO_ERR) {
+ return exp;
+ }
exp = dom_html_collection_get_length(rows,
§ion_len);
dom_html_collection_unref(rows);
+ if (exp != DOM_NO_ERR) {
+ return exp;
+ }
if(window_len + section_len > (uint32_t)index ||
window_len + section_len ==
len) {
- return
dom_html_table_section_element_insert_row(
+ exp =
dom_html_table_section_element_insert_row(
(dom_html_table_section_element *)n,
- index-window_len, row);
+ index-window_len,
+ (struct
dom_html_element **)&row);
+ if (exp == DOM_NO_ERR) {
+ *row_out = (dom_html_element
*)row;
+ }
+ return exp;
}
window_len += section_len;
}
}
exp = dom_html_table_element_get_t_foot(element, &t_foot);
- if(exp != DOM_NO_ERR)
+ if(exp != DOM_NO_ERR) {
return exp;
+ }
exp = dom_html_table_section_element_get_rows(t_foot, &rows);
if(exp != DOM_NO_ERR) {
- dom_html_collection_unref(rows);
+ dom_node_unref(t_foot);
return exp;
}
exp = dom_html_collection_get_length(rows, §ion_len);
-
dom_html_collection_unref(rows);
-
- if(exp != DOM_NO_ERR)
+ if(exp != DOM_NO_ERR) {
+ dom_node_unref(t_foot);
return exp;
+ }
if(window_len + section_len > (uint32_t)index ||
window_len +section_len == len) {
- return dom_html_table_section_element_insert_row(t_foot,
- index-window_len, row);
+ exp = dom_html_table_section_element_insert_row(t_foot,
+ index-window_len,
+ (struct dom_html_element **)&row);
+ dom_node_unref(t_foot);
+ if (exp == DOM_NO_ERR) {
+ *row_out = (dom_html_element *)row;
+ }
+ return exp;
}
+ dom_node_unref(t_foot);
exp = DOM_INDEX_SIZE_ERR;
}
- dom_html_collection_unref(rows);
+
return exp;
}
+
/**
* Delete the table Head, if one exists
*
commitdiff
http://git.netsurf-browser.org/libdom.git/commit/?id=f09983f45ee5f22e0df44a7c1d7ea85f7336efe2
commit f09983f45ee5f22e0df44a7c1d7ea85f7336efe2
Author: Michael Drake <[email protected]>
Commit: Michael Drake <[email protected]>
HTMLTableSectionElement.insertRow: Fix lifetimes and error handling.
diff --git a/src/html/html_tablesection_element.c
b/src/html/html_tablesection_element.c
index 1ffe102..6499b72 100644
--- a/src/html/html_tablesection_element.c
+++ b/src/html/html_tablesection_element.c
@@ -229,14 +229,13 @@ dom_exception dom_html_table_section_element_get_rows(
*/
dom_exception dom_html_table_section_element_insert_row(
dom_html_table_section_element *element,
- int32_t index, dom_html_element **new_row) {
+ int32_t index, dom_html_element **new_row)
+{
dom_html_document *doc = (dom_html_document *) ((dom_node_internal *)
element)->owner;
-
- dom_node *node; /*< The node at the (index)th position*/
-
dom_html_collection *rows; /*< The collection of rows in input
table_section_element*/
uint32_t len; /*< The size of the row collection */
dom_exception exp; /*< Variable for getting the
exceptions*/
+ dom_node *new_node;
struct dom_html_element_create_params params = {
.type = DOM_HTML_ELEMENT_TYPE_TR,
@@ -247,48 +246,49 @@ dom_exception dom_html_table_section_element_insert_row(
};
exp = _dom_html_table_row_element_create(¶ms,
- (dom_html_table_row_element **)new_row);
+ (dom_html_table_row_element **)&new_node);
if(exp != DOM_NO_ERR)
return exp;
exp = dom_html_table_section_element_get_rows(element, &rows);
if(exp != DOM_NO_ERR) {
- dom_node_unref(new_row);
- new_row = NULL;
+ dom_node_unref(new_node);
+ new_node = NULL;
return exp;
}
exp = dom_html_collection_get_length(rows, &len);
-
-
- if(exp != DOM_NO_ERR) {
- dom_node_unref(new_row);
- new_row = NULL;
+ if (exp != DOM_NO_ERR) {
+ dom_node_unref(new_node);
+ new_node = NULL;
dom_html_collection_unref(rows);
return exp;
}
- if(index < -1 || index > (int32_t)len) {
+ if (index < -1 || index > (int32_t)len) {
/* Check for index validity */
dom_html_collection_unref(rows);
+ dom_node_unref(new_node);
+ new_node = NULL;
return DOM_INDEX_SIZE_ERR;
- } else if(index == -1 || index == (int32_t)len) {
- dom_node *new_node;
+
+ } else if (index == -1 || index == (int32_t)len) {
dom_html_collection_unref(rows);
- return dom_node_append_child(element,
- *new_row,
- &new_node);
+ exp = dom_node_append_child(element, new_node, new_row);
} else {
- dom_node *new_node;
-
- dom_html_collection_item(rows,
- index, &node);
+ dom_node *node;
+ dom_html_collection_item(rows, index, &node);
dom_html_collection_unref(rows);
- return dom_node_insert_before(element,
- *new_row, node,
- &new_node);
+ exp = dom_node_insert_before(element,
+ new_node, node, new_row);
+ dom_node_unref(node);
}
+
+ dom_node_unref(new_node);
+ new_node = NULL;
+
+ return exp;
}
/**
-----------------------------------------------------------------------
Summary of changes:
include/dom/html/html_table_element.h | 2 +-
src/html/html_collection.c | 32 +++++----
src/html/html_document.c | 1 +
src/html/html_table_element.c | 126 +++++++++++++++++++--------------
src/html/html_tablerow_element.c | 8 +--
src/html/html_tablesection_element.c | 50 ++++++-------
6 files changed, 121 insertions(+), 98 deletions(-)
diff --git a/include/dom/html/html_table_element.h
b/include/dom/html/html_table_element.h
index 6fcd7ed..205d719 100644
--- a/include/dom/html/html_table_element.h
+++ b/include/dom/html/html_table_element.h
@@ -120,7 +120,7 @@ dom_exception dom_html_table_element_delete_t_foot(
dom_exception dom_html_table_element_insert_row(
dom_html_table_element *element,
- int32_t index, dom_html_element **row);
+ int32_t index, dom_html_element **row_out);
dom_exception dom_html_table_element_delete_row(
dom_html_table_element *element,
diff --git a/src/html/html_collection.c b/src/html/html_collection.c
index cba2b2d..7bb55b6 100644
--- a/src/html/html_collection.c
+++ b/src/html/html_collection.c
@@ -215,7 +215,8 @@ dom_exception
dom_html_collection_named_item(dom_html_collection *col,
struct dom_node_internal *n = col->root;
dom_html_document *doc = (dom_html_document *)dom_node_get_owner(n);
dom_exception err;
- while (n != NULL) {
+
+ while (n != NULL) {
if (n->type == DOM_ELEMENT_NODE &&
col->ic(n, col->ctx) == true) {
dom_string *id = NULL;
@@ -227,16 +228,15 @@ dom_exception
dom_html_collection_named_item(dom_html_collection *col,
return err;
}
- if (id != NULL && dom_string_isequal(name, id)) {
- *node = (struct dom_node *) n;
- dom_node_ref(n);
- dom_string_unref(id);
-
- return DOM_NO_ERR;
- }
+ if (id != NULL) {
+ if (dom_string_isequal(name, id)) {
+ *node = dom_node_ref(n);
+ dom_string_unref(id);
- if (id != NULL)
+ return DOM_NO_ERR;
+ }
dom_string_unref(id);
+ }
/* Check for Name attr if id not matched/found */
err = _dom_element_get_attribute((dom_element *)n,
@@ -244,14 +244,16 @@ dom_exception
dom_html_collection_named_item(dom_html_collection *col,
if(err != DOM_NO_ERR) {
return err;
}
- if (id_name != NULL && dom_string_isequal(name,
id_name)) {
- *node = (struct dom_node *) n;
- dom_node_ref(n);
- dom_string_unref(id_name);
- return DOM_NO_ERR;
- }
+ if (id_name != NULL) {
+ if (dom_string_isequal(name, id_name)) {
+ *node = dom_node_ref(n);
+ dom_string_unref(id_name);
+ return DOM_NO_ERR;
+ }
+ dom_string_unref(id_name);
+ }
}
/* Depth first iterating */
diff --git a/src/html/html_document.c b/src/html/html_document.c
index 2f219d0..9b749ae 100644
--- a/src/html/html_document.c
+++ b/src/html/html_document.c
@@ -1119,6 +1119,7 @@ dom_exception
_dom_html_document_get_body(dom_html_document *doc,
}
if (len == 0) {
+ dom_nodelist_unref(nodes);
exc = dom_document_get_elements_by_tag_name(doc,
doc->elements[DOM_HTML_ELEMENT_TYPE_FRAMESET],
&nodes);
diff --git a/src/html/html_table_element.c b/src/html/html_table_element.c
index 7e8a508..82dbca0 100644
--- a/src/html/html_table_element.c
+++ b/src/html/html_table_element.c
@@ -726,6 +726,7 @@ static dom_exception dom_html_table_element_create_t_body(
dom_html_collection_unref(t_bodies);
return exp;
}
+
/**
* Insert a new Row into the table
*
@@ -736,39 +737,22 @@ static dom_exception dom_html_table_element_create_t_body(
dom_exception dom_html_table_element_insert_row(
dom_html_table_element *element,
int32_t index,
- dom_html_element **row)
+ dom_html_element **row_out)
{
dom_exception exp;
+ dom_html_table_row_element *row;
dom_html_collection* rows;
uint32_t len;
dom_html_document *doc = (dom_html_document *)
((dom_node_internal *) element)->owner;
- struct dom_html_element_create_params params = {
- .type = DOM_HTML_ELEMENT_TYPE_TR,
- .doc = doc,
- .name = doc->elements[DOM_HTML_ELEMENT_TYPE_TR],
- .namespace = ((dom_node_internal *)element)->namespace,
- .prefix = ((dom_node_internal *)element)->prefix
- };
-
- exp = dom_html_table_element_get_rows(element,
- &rows);
+ exp = dom_html_table_element_get_rows(element, &rows);
if(exp != DOM_NO_ERR) {
- dom_html_collection_unref(rows);
return exp;
}
- exp = dom_html_collection_get_length(rows,
- &len);
- if(exp != DOM_NO_ERR) {
- dom_html_collection_unref(rows);
- return exp;
- }
- exp = _dom_html_table_row_element_create(¶ms,
- (dom_html_table_row_element **)row);
+ exp = dom_html_collection_get_length(rows, &len);
+ dom_html_collection_unref(rows);
if(exp != DOM_NO_ERR) {
- dom_node_unref(*row);
- dom_html_collection_unref(rows);
return exp;
}
@@ -777,19 +761,31 @@ dom_exception dom_html_table_element_insert_row(
} else if(len == 0) {
dom_html_table_section_element *new_body;
dom_node *new_row;
- exp = dom_html_table_element_create_t_body(element,
- &new_body);
+
+ struct dom_html_element_create_params params = {
+ .type = DOM_HTML_ELEMENT_TYPE_TR,
+ .doc = doc,
+ .name = doc->elements[DOM_HTML_ELEMENT_TYPE_TR],
+ .namespace = ((dom_node_internal *)element)->namespace,
+ .prefix = ((dom_node_internal *)element)->prefix
+ };
+
+ exp = _dom_html_table_row_element_create(¶ms, &row);
if(exp != DOM_NO_ERR) {
- dom_html_collection_unref(rows);
- dom_node_unref(new_body);
return exp;
}
- exp = dom_node_append_child(new_body, *row,
- &new_row);
+ exp = dom_html_table_element_create_t_body(element, &new_body);
+ if(exp != DOM_NO_ERR) {
+ dom_node_unref(row);
+ return exp;
+ }
+
+ exp = dom_node_append_child(new_body, row, &new_row);
+ dom_node_unref(new_body);
+ dom_node_unref(row);
if(exp == DOM_NO_ERR) {
- dom_node_unref(*row);
- *row = (dom_html_element *)new_row;
+ *row_out = (dom_html_element *)new_row;
}
} else {
uint32_t window_len = 0, section_len;
@@ -802,83 +798,109 @@ dom_exception dom_html_table_element_insert_row(
}
exp = dom_html_table_element_get_t_head(element, &t_head);
- if (exp != DOM_NO_ERR)
+ if (exp != DOM_NO_ERR) {
return exp;
-
- dom_html_collection_unref(rows);
+ }
exp = dom_html_table_section_element_get_rows(t_head, &rows);
if(exp != DOM_NO_ERR) {
- dom_html_collection_unref(rows);
+ dom_node_unref(t_head);
return exp;
}
- dom_html_collection_get_length(rows, §ion_len);
+ exp = dom_html_collection_get_length(rows, §ion_len);
+ dom_html_collection_unref(rows);
if(exp != DOM_NO_ERR) {
- dom_html_collection_unref(rows);
+ dom_node_unref(t_head);
return exp;
}
if(window_len + section_len > (uint32_t)index ||
window_len + section_len == len) {
- dom_html_collection_unref(rows);
- return dom_html_table_section_element_insert_row(t_head,
- index-window_len, row);
+ exp = dom_html_table_section_element_insert_row(t_head,
+ index-window_len,
+ (struct dom_html_element **)&row);
+ dom_node_unref(t_head);
+ if (exp == DOM_NO_ERR) {
+ *row_out = (dom_html_element *)row;
+ }
+ return exp;
}
+ dom_node_unref(t_head);
window_len += section_len;
n = (dom_node_internal *)element;
- dom_html_collection_unref(rows);
-
for (n = n->first_child; n != NULL; n = n->next) {
if((n->type == DOM_ELEMENT_NODE) &&
dom_string_caseless_isequal(
doc->elements[DOM_HTML_ELEMENT_TYPE_TBODY],
n->name)) {
- exp =
dom_html_table_section_element_get_rows((dom_html_table_section_element *)n,
&rows);
+ exp = dom_html_table_section_element_get_rows(
+ (dom_html_table_section_element
*)n,
+ &rows);
+ if (exp != DOM_NO_ERR) {
+ return exp;
+ }
exp = dom_html_collection_get_length(rows,
§ion_len);
dom_html_collection_unref(rows);
+ if (exp != DOM_NO_ERR) {
+ return exp;
+ }
if(window_len + section_len > (uint32_t)index ||
window_len + section_len ==
len) {
- return
dom_html_table_section_element_insert_row(
+ exp =
dom_html_table_section_element_insert_row(
(dom_html_table_section_element *)n,
- index-window_len, row);
+ index-window_len,
+ (struct
dom_html_element **)&row);
+ if (exp == DOM_NO_ERR) {
+ *row_out = (dom_html_element
*)row;
+ }
+ return exp;
}
window_len += section_len;
}
}
exp = dom_html_table_element_get_t_foot(element, &t_foot);
- if(exp != DOM_NO_ERR)
+ if(exp != DOM_NO_ERR) {
return exp;
+ }
exp = dom_html_table_section_element_get_rows(t_foot, &rows);
if(exp != DOM_NO_ERR) {
- dom_html_collection_unref(rows);
+ dom_node_unref(t_foot);
return exp;
}
exp = dom_html_collection_get_length(rows, §ion_len);
-
dom_html_collection_unref(rows);
-
- if(exp != DOM_NO_ERR)
+ if(exp != DOM_NO_ERR) {
+ dom_node_unref(t_foot);
return exp;
+ }
if(window_len + section_len > (uint32_t)index ||
window_len +section_len == len) {
- return dom_html_table_section_element_insert_row(t_foot,
- index-window_len, row);
+ exp = dom_html_table_section_element_insert_row(t_foot,
+ index-window_len,
+ (struct dom_html_element **)&row);
+ dom_node_unref(t_foot);
+ if (exp == DOM_NO_ERR) {
+ *row_out = (dom_html_element *)row;
+ }
+ return exp;
}
+ dom_node_unref(t_foot);
exp = DOM_INDEX_SIZE_ERR;
}
- dom_html_collection_unref(rows);
+
return exp;
}
+
/**
* Delete the table Head, if one exists
*
diff --git a/src/html/html_tablerow_element.c b/src/html/html_tablerow_element.c
index b722d0d..587edd4 100644
--- a/src/html/html_tablerow_element.c
+++ b/src/html/html_tablerow_element.c
@@ -244,15 +244,13 @@ dom_exception dom_html_table_row_element_get_row_index(
return exp;
}
- exp = dom_html_table_section_element_get_rows(t_head,
- &rows);
+ exp = dom_html_table_section_element_get_rows(t_head, &rows);
+ dom_node_unref(t_head);
if (exp != DOM_NO_ERR) {
- dom_node_unref(t_head);
return exp;
}
- dom_html_collection_get_length(rows,
- &len);
+ dom_html_collection_get_length(rows, &len);
dom_html_collection_unref(rows);
count += len;
diff --git a/src/html/html_tablesection_element.c
b/src/html/html_tablesection_element.c
index 1ffe102..6499b72 100644
--- a/src/html/html_tablesection_element.c
+++ b/src/html/html_tablesection_element.c
@@ -229,14 +229,13 @@ dom_exception dom_html_table_section_element_get_rows(
*/
dom_exception dom_html_table_section_element_insert_row(
dom_html_table_section_element *element,
- int32_t index, dom_html_element **new_row) {
+ int32_t index, dom_html_element **new_row)
+{
dom_html_document *doc = (dom_html_document *) ((dom_node_internal *)
element)->owner;
-
- dom_node *node; /*< The node at the (index)th position*/
-
dom_html_collection *rows; /*< The collection of rows in input
table_section_element*/
uint32_t len; /*< The size of the row collection */
dom_exception exp; /*< Variable for getting the
exceptions*/
+ dom_node *new_node;
struct dom_html_element_create_params params = {
.type = DOM_HTML_ELEMENT_TYPE_TR,
@@ -247,48 +246,49 @@ dom_exception dom_html_table_section_element_insert_row(
};
exp = _dom_html_table_row_element_create(¶ms,
- (dom_html_table_row_element **)new_row);
+ (dom_html_table_row_element **)&new_node);
if(exp != DOM_NO_ERR)
return exp;
exp = dom_html_table_section_element_get_rows(element, &rows);
if(exp != DOM_NO_ERR) {
- dom_node_unref(new_row);
- new_row = NULL;
+ dom_node_unref(new_node);
+ new_node = NULL;
return exp;
}
exp = dom_html_collection_get_length(rows, &len);
-
-
- if(exp != DOM_NO_ERR) {
- dom_node_unref(new_row);
- new_row = NULL;
+ if (exp != DOM_NO_ERR) {
+ dom_node_unref(new_node);
+ new_node = NULL;
dom_html_collection_unref(rows);
return exp;
}
- if(index < -1 || index > (int32_t)len) {
+ if (index < -1 || index > (int32_t)len) {
/* Check for index validity */
dom_html_collection_unref(rows);
+ dom_node_unref(new_node);
+ new_node = NULL;
return DOM_INDEX_SIZE_ERR;
- } else if(index == -1 || index == (int32_t)len) {
- dom_node *new_node;
+
+ } else if (index == -1 || index == (int32_t)len) {
dom_html_collection_unref(rows);
- return dom_node_append_child(element,
- *new_row,
- &new_node);
+ exp = dom_node_append_child(element, new_node, new_row);
} else {
- dom_node *new_node;
-
- dom_html_collection_item(rows,
- index, &node);
+ dom_node *node;
+ dom_html_collection_item(rows, index, &node);
dom_html_collection_unref(rows);
- return dom_node_insert_before(element,
- *new_row, node,
- &new_node);
+ exp = dom_node_insert_before(element,
+ new_node, node, new_row);
+ dom_node_unref(node);
}
+
+ dom_node_unref(new_node);
+ new_node = NULL;
+
+ return exp;
}
/**
--
Document Object Model library
_______________________________________________
netsurf-commits mailing list
[email protected]
http://listmaster.pepperfish.net/cgi-bin/mailman/listinfo/netsurf-commits-netsurf-browser.org