summaryrefslogtreecommitdiff
path: root/render/box.c
diff options
context:
space:
mode:
authorJames Bursa <james@netsurf-browser.org>2005-04-13 21:58:28 +0000
committerJames Bursa <james@netsurf-browser.org>2005-04-13 21:58:28 +0000
commit11bc5345c5faf42a5b99623ee24b1a91ca181fd6 (patch)
treeb3dc1c7e1691ddf335a87643c35b8ad9f4ba1a84 /render/box.c
parent4ebe390f8d02013035fd884836dcb8a75ac5efbd (diff)
downloadnetsurf-11bc5345c5faf42a5b99623ee24b1a91ca181fd6.tar.gz
netsurf-11bc5345c5faf42a5b99623ee24b1a91ca181fd6.tar.bz2
[project @ 2005-04-13 21:58:28 by bursa]
Add fallback field to struct box for object fallback content. Add some checks for tree consistency to box_dump(). Rename struct plugin_params to object_param. Clean up box_object(), box_embed(), box_iframe(), and box_image(). Implement object fallback to contents if the fetch or conversion fails. svn path=/import/netsurf/; revision=1627
Diffstat (limited to 'render/box.c')
-rw-r--r--render/box.c61
1 files changed, 24 insertions, 37 deletions
diff --git a/render/box.c b/render/box.c
index e1959bd8d..369fe90b9 100644
--- a/render/box.c
+++ b/render/box.c
@@ -75,6 +75,7 @@ struct box * box_create(struct css_style *style,
box->children = NULL;
box->last = NULL;
box->parent = NULL;
+ box->fallback = NULL;
box->float_children = NULL;
box->next_float = NULL;
box->col = NULL;
@@ -167,46 +168,11 @@ void box_free_box(struct box *box)
form_free_control(box->gadget);
}
- box_free_object_params(box->object_params);
-
talloc_free(box);
}
/**
- * Free an object parameter structure.
- *
- * \param op object parameter structure to free
- */
-
-void box_free_object_params(struct object_params *op)
-{
- struct plugin_params *a, *b;
-
- if (!op)
- return;
-
- free(op->data);
- free(op->type);
- free(op->codetype);
- free(op->codebase);
- free(op->classid);
- free(op->basehref);
-
- for (a = op->params; a; a = b) {
- b = a->next;
- free(a->name);
- free(a->value);
- free(a->type);
- free(a->valuetype);
- free(a);
- }
-
- free(op);
-}
-
-
-/**
* Find the absolute coordinates of a box.
*
* \param box the box to calculate coordinates of
@@ -434,7 +400,7 @@ struct box *box_find_by_id(struct box *box, const char *id)
void box_dump(struct box *box, unsigned int depth)
{
unsigned int i;
- struct box * c;
+ struct box *c, *prev;
for (i = 0; i != depth; i++)
fprintf(stderr, " ");
@@ -486,6 +452,27 @@ void box_dump(struct box *box, unsigned int depth)
fprintf(stderr, " next_float %p", box->next_float);
fprintf(stderr, "\n");
- for (c = box->children; c; c = c->next)
+ for (c = box->children; c->next; c = c->next)
+ ;
+ if (box->last != c)
+ fprintf(stderr, "warning: box->last %p (should be %p) "
+ "(box %p)\n", box->last, c, box);
+ for (prev = 0, c = box->children; c; prev = c, c = c->next) {
+ if (c->parent != box)
+ fprintf(stderr, "warning: box->parent %p (should be "
+ "%p) (box on next line)\n",
+ c->parent, box);
+ if (c->prev != prev)
+ fprintf(stderr, "warning: box->prev %p (should be "
+ "%p) (box on next line)\n",
+ c->prev, prev);
box_dump(c, depth + 1);
+ }
+ if (box->fallback) {
+ for (i = 0; i != depth; i++)
+ fprintf(stderr, " ");
+ fprintf(stderr, "fallback:\n");
+ for (c = box->fallback; c; c = c->next)
+ box_dump(c, depth + 1);
+ }
}