summaryrefslogtreecommitdiff
path: root/src/html
diff options
context:
space:
mode:
authorRupinder Singh Khokhar <rsk1coder99@gmail.com>2014-07-31 23:27:11 +0530
committerRupinder Singh Khokhar <rsk1coder99@gmail.com>2014-07-31 23:27:11 +0530
commit12fbcd3d88177c35c5435ae400c17025c1ca9181 (patch)
treefc4ededf89769fa7dca4a138383b1c0fb4c8fd54 /src/html
parent1eaa38650c5a828ff47cc145ac843bde3840ec1c (diff)
downloadlibdom-12fbcd3d88177c35c5435ae400c17025c1ca9181.tar.gz
libdom-12fbcd3d88177c35c5435ae400c17025c1ca9181.tar.bz2
remove precaching cell index
Diffstat (limited to 'src/html')
-rw-r--r--src/html/html_tablecell_element.c71
-rw-r--r--src/html/html_tablecell_element.h2
2 files changed, 33 insertions, 40 deletions
diff --git a/src/html/html_tablecell_element.c b/src/html/html_tablecell_element.c
index cc596c1..83ebb0c 100644
--- a/src/html/html_tablecell_element.c
+++ b/src/html/html_tablecell_element.c
@@ -61,7 +61,6 @@ dom_exception _dom_html_table_cell_element_initialise(struct dom_html_document *
dom_string *tag_name, dom_string *namespace, dom_string *prefix,
struct dom_html_table_cell_element *ele)
{
- ele->id = -1;
return _dom_html_element_initialise(doc, &ele->base,
tag_name,
namespace, prefix);
@@ -181,49 +180,45 @@ SIMPLE_GET_SET(width);
dom_exception dom_html_table_cell_element_get_cell_index(
dom_html_table_cell_element *table_cell, int32_t *cell_index)
{
- if(table_cell->id == -1) {
- dom_node_internal *n = ((dom_node_internal *)table_cell)->parent;
- dom_html_document *doc = (dom_html_document *)(n->owner);
- int32_t cnt = 0;
- while(n != NULL) {
- if(dom_string_caseless_isequal(doc->memoised[hds_TR],n->name)) {
- break;
- }
- n = n->parent;
+ dom_node_internal *n = ((dom_node_internal *)table_cell)->parent;
+ dom_html_document *doc = (dom_html_document *)(n->owner);
+ int32_t cnt = 0;
+ while(n != NULL) {
+ if(dom_string_caseless_isequal(doc->memoised[hds_TR],n->name)) {
+ break;
+ }
+ n = n->parent;
+ }
+ dom_node_internal *root = n;
+ while(n != NULL) {
+ if(n == (dom_node_internal *)table_cell) {
+ break;
+ } else if((n->type == DOM_ELEMENT_NODE) &&
+ (dom_string_caseless_isequal(doc->memoised[hds_TD],n->name) ||
+ dom_string_caseless_isequal(doc->memoised[hds_TH],n->name))) {
+ cnt += 1;
}
- dom_node_internal *root = n;
- while(n != NULL) {
- if(n == (dom_node_internal *)table_cell) {
- break;
- } else if((n->type == DOM_ELEMENT_NODE) &&
- (dom_string_caseless_isequal(doc->memoised[hds_TD],n->name) ||
- dom_string_caseless_isequal(doc->memoised[hds_TH],n->name))) {
- ((dom_html_table_cell_element *)n)->id = cnt;
- cnt += 1;
+ if(n->first_child != NULL) {
+ n = n->first_child;
+ } else if(n->next != NULL) {
+ n = n->next;
+ } else {
+ /* No children and siblings */
+ struct dom_node_internal *parent = n->parent;
+ while (n == parent->last_child &&
+ n != root) {
+ n = parent;
+ parent = parent->parent;
}
- if(n->first_child != NULL) {
- n = n->first_child;
- } else if(n->next != NULL) {
- n = n->next;
- } else {
- /* No children and siblings */
- struct dom_node_internal *parent = n->parent;
- while (n == parent->last_child &&
- n != root) {
- n = parent;
- parent = parent->parent;
- }
- if(n == root) {
- n = NULL;
- } else {
- n = n->next;
- }
+ if(n == root) {
+ n = NULL;
+ } else {
+ n = n->next;
}
}
- table_cell->id = cnt;
}
- *cell_index = table_cell->id;
+ *cell_index = cnt;
return DOM_NO_ERR;
}
diff --git a/src/html/html_tablecell_element.h b/src/html/html_tablecell_element.h
index 801c3c0..5a48439 100644
--- a/src/html/html_tablecell_element.h
+++ b/src/html/html_tablecell_element.h
@@ -16,8 +16,6 @@
struct dom_html_table_cell_element {
struct dom_html_element base;
/**< The base class */
- int32_t id;
- /**< The Index Associated with the cell*/
};
/* Create a dom_html_table_cell_element object */