mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-25 05:27:00 +03:00
[project @ 2004-11-21 19:45:17 by bursa]
Fix possible divide by 0. Scroll objects correctly. svn path=/import/netsurf/; revision=1366
This commit is contained in:
parent
8821cb6b2e
commit
58401792bd
@ -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 = 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);
|
||||
(float) (box->descendant_y1 -
|
||||
box->descendant_y0);
|
||||
*bar_height = (float) *well_height * (float) box->height /
|
||||
(float) (box->descendant_y1 - box->descendant_y0);
|
||||
(float) (box->descendant_y1 -
|
||||
box->descendant_y0);
|
||||
}
|
||||
*well_width = padding_width - w - w - (*vscroll ? w : 0);
|
||||
*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);
|
||||
(float) (box->descendant_x1 -
|
||||
box->descendant_x0);
|
||||
*bar_width = (float) *well_width * (float) box->width /
|
||||
(float) (box->descendant_x1 - box->descendant_x0);
|
||||
(float) (box->descendant_x1 -
|
||||
box->descendant_x0);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user