When scrollbar extents are updated, scale current offset appropriately.
svn path=/trunk/netsurf/; revision=12667
This commit is contained in:
parent
65398660e5
commit
bbc06d6449
|
@ -458,8 +458,7 @@ void scrollbar_set_extents(struct scrollbar *s, int length,
|
|||
int visible_size, int full_size)
|
||||
{
|
||||
int well_length;
|
||||
|
||||
/* TODO: update offset appropriately */
|
||||
int cur_excess = s->full_size - s->visible_size;
|
||||
|
||||
if (length != -1)
|
||||
s->length = length;
|
||||
|
@ -468,6 +467,9 @@ void scrollbar_set_extents(struct scrollbar *s, int length,
|
|||
if (full_size != -1)
|
||||
s->full_size = full_size;
|
||||
|
||||
/* Update scroll offset (scaled in proportion with change in excess) */
|
||||
s->offset = (s->full_size - s->visible_size) * s->offset / cur_excess;
|
||||
|
||||
well_length = s->length - 2 * SCROLLBAR_WIDTH;
|
||||
|
||||
s->bar_len = (well_length * s->visible_size) / s->full_size;
|
||||
|
|
Loading…
Reference in New Issue