summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2016-01-20 18:42:30 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2016-01-20 20:02:56 +0000
commitc13080d96c41f42ce58b063a7883cac191d6c64b (patch)
treef03f974441a5bc4e7cd0d8a878915b286caa35eb
parent948a93041dba3ec95dbb04bee523a9bbd4ca9918 (diff)
downloadnetsurf-c13080d96c41f42ce58b063a7883cac191d6c64b.tar.gz
netsurf-c13080d96c41f42ce58b063a7883cac191d6c64b.tar.bz2
Optimise white hot find_sides to take advantage of sorted float_children.
Now we have an early exit when we get to the floats above the area we're interested in.
-rw-r--r--render/layout.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/render/layout.c b/render/layout.c
index f1e321e7f..95f3681aa 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -2062,8 +2062,14 @@ void find_sides(struct box *fl, int y0, int y1,
*left = *right = 0;
for (; fl; fl = fl->next_float) {
- fy0 = fl->y;
fy1 = fl->y + fl->height;
+ if (fy1 < y0) {
+ /* Floats are sorted in order of decreasing bottom pos.
+ * Past here, all floats will be too high to concern us.
+ */
+ return;
+ }
+ fy0 = fl->y;
if (y0 < fy1 && fy0 <= y1) {
if (fl->type == BOX_FLOAT_LEFT) {
fx1 = fl->x + fl->width;