diff options
author | James Bursa <james@netsurf-browser.org> | 2004-11-21 19:45:17 +0000 |
---|---|---|
committer | James Bursa <james@netsurf-browser.org> | 2004-11-21 19:45:17 +0000 |
commit | 58401792bd4127d506c85f6352441f17e21b6e30 (patch) | |
tree | ec8c0a719c63f407df3fab04e73097f3dc042cb2 /render/html_redraw.c | |
parent | 8821cb6b2e72aa79ae47539c8c102a9d21c5c074 (diff) | |
download | netsurf-58401792bd4127d506c85f6352441f17e21b6e30.tar.gz netsurf-58401792bd4127d506c85f6352441f17e21b6e30.tar.bz2 |
[project @ 2004-11-21 19:45:17 by bursa]
Fix possible divide by 0. Scroll objects correctly.
svn path=/import/netsurf/; revision=1366
Diffstat (limited to 'render/html_redraw.c')
-rw-r--r-- | render/html_redraw.c | 31 |
1 files changed, 22 insertions, 9 deletions
diff --git a/render/html_redraw.c b/render/html_redraw.c index a46edbd47..1e4a32def 100644 --- a/render/html_redraw.c +++ b/render/html_redraw.c @@ -264,7 +264,8 @@ bool html_redraw_box(struct box *box, if (box->object) { if (!content_redraw(box->object, - x + padding_left, y + padding_top, + x_scrolled + padding_left, + y_scrolled + padding_top, width, height, x0, y0, x1, y1, scale, current_background_color)) return false; @@ -925,13 +926,25 @@ void box_scrollbar_dimensions(const struct box * const box, *vscroll = box_vscrollbar_present(box); *hscroll = box_hscrollbar_present(box); *well_height = padding_height - w - w; - *bar_top = (float) *well_height * (float) box->scroll_y / - (float) (box->descendant_y1 - box->descendant_y0); - *bar_height = (float) *well_height * (float) box->height / - (float) (box->descendant_y1 - box->descendant_y0); + *bar_top = 0; + *bar_height = *well_height; + if (box->descendant_y1 - box->descendant_y0 != 0) { + *bar_top = (float) *well_height * (float) box->scroll_y / + (float) (box->descendant_y1 - + box->descendant_y0); + *bar_height = (float) *well_height * (float) box->height / + (float) (box->descendant_y1 - + box->descendant_y0); + } *well_width = padding_width - w - w - (*vscroll ? w : 0); - *bar_left = (float) *well_width * (float) box->scroll_x / - (float) (box->descendant_x1 - box->descendant_x0); - *bar_width = (float) *well_width * (float) box->width / - (float) (box->descendant_x1 - box->descendant_x0); + *bar_left = 0; + *bar_width = *well_width; + if (box->descendant_x1 - box->descendant_x0 != 0) { + *bar_left = (float) *well_width * (float) box->scroll_x / + (float) (box->descendant_x1 - + box->descendant_x0); + *bar_width = (float) *well_width * (float) box->width / + (float) (box->descendant_x1 - + box->descendant_x0); + } } |