summaryrefslogtreecommitdiff
path: root/render/layout.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2016-01-20 19:24:12 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2016-01-20 20:09:40 +0000
commit0bbc03c5776fdcf6006bb0447341f82967d2b5d1 (patch)
treeff17c4f172bce697dd2ea9618cd40466eea2f5eb /render/layout.c
parentc13080d96c41f42ce58b063a7883cac191d6c64b (diff)
downloadnetsurf-0bbc03c5776fdcf6006bb0447341f82967d2b5d1.tar.gz
netsurf-0bbc03c5776fdcf6006bb0447341f82967d2b5d1.tar.bz2
Cache place below level, to avoid pointless calls to find_sides.
Diffstat (limited to 'render/layout.c')
-rw-r--r--render/layout.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/render/layout.c b/render/layout.c
index 95f3681aa..f069cd665 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -227,6 +227,7 @@ bool layout_block_context(struct box *block, int viewport_height,
assert(block->width != AUTO);
block->float_children = NULL;
+ block->cached_place_below_level = 0;
block->clear_level = 0;
/* special case if the block contains an object */
@@ -2737,6 +2738,7 @@ bool layout_line(struct box *first, int *width, int *y,
d = b->children;
d->float_children = 0;
+ d->cached_place_below_level = 0;
b->float_container = d->float_container = cont;
if (!layout_float(d, *width, content))
@@ -3439,10 +3441,13 @@ bool layout_float(struct box *b, int width, html_content *content)
void place_float_below(struct box *c, int width, int cx, int y,
struct box *cont)
{
- int x0, x1, yy = y;
+ int x0, x1, yy;
struct box *left;
struct box *right;
+ yy = y > cont->cached_place_below_level ?
+ y : cont->cached_place_below_level;
+
#ifdef LAYOUT_DEBUG
LOG("c %p, width %i, cx %i, y %i, cont %p", c, width, cx, y, cont);
#endif
@@ -3471,6 +3476,7 @@ void place_float_below(struct box *c, int width, int cx, int y,
c->x = x1 - c->width;
}
c->y = y;
+ cont->cached_place_below_level = y;
}
@@ -3864,6 +3870,7 @@ bool layout_table(struct box *table, int available_width,
c->padding[RIGHT] -
c->border[RIGHT].width;
c->float_children = 0;
+ c->cached_place_below_level = 0;
c->height = AUTO;
if (!layout_block_context(c, -1, content)) {