summaryrefslogtreecommitdiff
path: root/render/html_redraw.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2008-12-27 17:29:17 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2008-12-27 17:29:17 +0000
commitd27a1c625f9d41da04101392a3cf8005c3faf862 (patch)
tree694e1ff5f6b5233cde01c4c878600e0d4553dd7c /render/html_redraw.c
parent04d7ddde4f3ec998b5a0384fd0afef45baf230f9 (diff)
downloadnetsurf-d27a1c625f9d41da04101392a3cf8005c3faf862.tar.gz
netsurf-d27a1c625f9d41da04101392a3cf8005c3faf862.tar.bz2
Only increase the root element's redraw box to cover margin, if the redraw box isn't already bigger due to protruding descendants.
svn path=/trunk/netsurf/; revision=5934
Diffstat (limited to 'render/html_redraw.c')
-rw-r--r--render/html_redraw.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/render/html_redraw.c b/render/html_redraw.c
index 5c8cfd330..2ecfd82ae 100644
--- a/render/html_redraw.c
+++ b/render/html_redraw.c
@@ -222,24 +222,7 @@ bool html_redraw_box(struct box *box,
}
/* calculate rectangle covering this box and descendants */
- if (!box->parent) {
- int margin_left, margin_top, margin_right, margin_bottom;
- if (scale == 1.0) {
- margin_left = box->margin[LEFT];
- margin_top = box->margin[TOP];
- margin_right = box->margin[RIGHT];
- margin_bottom = box->margin[BOTTOM];
- } else {
- margin_left = box->margin[LEFT] * scale;
- margin_top = box->margin[TOP] * scale;
- margin_right = box->margin[RIGHT] * scale;
- margin_bottom = box->margin[BOTTOM] * scale;
- }
- x0 = x - border_left - margin_left;
- y0 = y - border_top - margin_top;
- x1 = x + padding_width + border_right + margin_right;
- y1 = y + padding_height + border_bottom + margin_bottom;
- } else if (box->style && box->style->overflow != CSS_OVERFLOW_VISIBLE) {
+ if (box->style && box->style->overflow != CSS_OVERFLOW_VISIBLE) {
x0 = x - border_left;
y0 = y - border_top;
x1 = x + padding_width + border_right;
@@ -249,6 +232,33 @@ bool html_redraw_box(struct box *box,
y0 = y + box->descendant_y0 * scale;
x1 = x + box->descendant_x1 * scale + 1;
y1 = y + box->descendant_y1 * scale + 1;
+ if (!box->parent) {
+ int margin_left, margin_right;
+ int margin_top, margin_bottom;
+ if (scale == 1.0) {
+ margin_left = box->margin[LEFT];
+ margin_top = box->margin[TOP];
+ margin_right = box->margin[RIGHT];
+ margin_bottom = box->margin[BOTTOM];
+ } else {
+ margin_left = box->margin[LEFT] * scale;
+ margin_top = box->margin[TOP] * scale;
+ margin_right = box->margin[RIGHT] * scale;
+ margin_bottom = box->margin[BOTTOM] * scale;
+ }
+ x0 = x - border_left - margin_left < x0 ?
+ x - border_left - margin_left : x0;
+ y0 = y - border_top - margin_top < y0 ?
+ y - border_top - margin_top : y0;
+ x1 = x + padding_width + border_right +
+ margin_right > x1 ?
+ x + padding_width + border_right +
+ margin_right : x1;
+ y1 = y + padding_height + border_bottom +
+ margin_bottom > y1 ?
+ y + padding_height + border_bottom +
+ margin_bottom : y1;
+ }
}
/* return if the rectangle is completely outside the clip rectangle */