summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2004-07-17 01:36:21 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2004-07-17 01:36:21 +0000
commitb6782d609583900d14d51272075408072f2e501c (patch)
tree0d4553ae186b1e8fc9835891cf6f5f5c93bc7448 /render
parenta0d23659b6979e6809913a7dc24db58d0b847dc5 (diff)
downloadnetsurf-b6782d609583900d14d51272075408072f2e501c.tar.gz
netsurf-b6782d609583900d14d51272075408072f2e501c.tar.bz2
[project @ 2004-07-17 01:36:21 by jmb]
Invalidate descendant_* values svn path=/import/netsurf/; revision=1091
Diffstat (limited to 'render')
-rw-r--r--render/layout.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/render/layout.c b/render/layout.c
index 26b266547..4506222d4 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -82,6 +82,12 @@ static bool calculate_table_widths(struct box *table);
parent->descendant_y1 = child->y+child->descendant_y1; \
} while (0);
+#define invalidate_descendants(box) do { \
+ LOG(("invalidating descendents of %p", box)); \
+ box->descendant_x0 = box->descendant_x1 = 0; \
+ box->descendant_y0 = box->descendant_y1 = 0; \
+} while (0);
+
/**
* Calculate positions of boxes in a document.
@@ -105,6 +111,7 @@ bool layout_document(struct box *doc, int width, pool box_pool)
width -= doc->margin[LEFT] + doc->border[LEFT] +
doc->border[RIGHT] + doc->margin[RIGHT];
doc->width = width;
+ invalidate_descendants(doc);
return layout_block_context(doc, box_pool);
}
@@ -136,6 +143,8 @@ bool layout_block_context(struct box *block, pool box_pool)
gui_multitask();
+ invalidate_descendants(block);
+
box = margin_box = block->children;
cx = block->padding[LEFT];
cy = block->padding[TOP];
@@ -155,6 +164,8 @@ bool layout_block_context(struct box *block, pool box_pool)
* correct handling of floats.
*/
+ invalidate_descendants(box);
+
if (box->type == BOX_BLOCK)
layout_block_find_dimensions(box->parent->width, box);
else if (box->type == BOX_TABLE) {
@@ -628,6 +639,8 @@ bool layout_inline_container(struct box *box, int width,
LOG(("box %p, width %i, cont %p, cx %i, cy %i",
box, width, cont, cx, cy));
+ invalidate_descendants(box);
+
for (c = box->children; c; ) {
LOG(("c %p", c));
if (!layout_line(c, width, &y, cx, cy + y, cont, first_line,
@@ -731,6 +744,8 @@ bool layout_line(struct box *first, int width, int *y,
b->type == BOX_FLOAT_RIGHT ||
b->type == BOX_BR);
+ invalidate_descendants(b);
+
if (b->type == BOX_INLINE_BLOCK) {
if (b->width == UNKNOWN_WIDTH)
if (!layout_float(b, width, box_pool))
@@ -1123,6 +1138,7 @@ int layout_text_indent(struct css_style *style, int width)
bool layout_float(struct box *b, int width, pool box_pool)
{
layout_float_find_dimensions(width, b->style, b);
+ invalidate_descendants(b);
if (b->type == BOX_TABLE) {
if (!layout_table(b, width, box_pool))
return false;
@@ -1379,11 +1395,15 @@ bool layout_table(struct box *table, int available_width,
row_span_cell[i] = 0;
}
+ invalidate_descendants(table);
+
/* position cells */
for (row_group = table->children; row_group != 0; row_group = row_group->next) {
int row_group_height = 0;
+ invalidate_descendants(row_group);
for (row = row_group->children; row != 0; row = row->next) {
int row_height = 0;
+ invalidate_descendants(row);
for (c = row->children; c != 0; c = c->next) {
assert(c->style != 0);
c->width = xs[c->start_column + c->columns] - xs[c->start_column];