summaryrefslogtreecommitdiff
path: root/desktop/scrollbar.c
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2014-09-19 12:32:52 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2014-09-19 12:32:52 +0100
commit6a74106d36059d27ad7150e0ad2c56d0ead80990 (patch)
treeebe6fe247161116b0a7994a67a31ee77c0e6936a /desktop/scrollbar.c
parentf95b9d2eb3c9d10003f64db2af6b932c17d043e1 (diff)
downloadnetsurf-6a74106d36059d27ad7150e0ad2c56d0ead80990.tar.gz
netsurf-6a74106d36059d27ad7150e0ad2c56d0ead80990.tar.bz2
Make code more readable.
Diffstat (limited to 'desktop/scrollbar.c')
-rw-r--r--desktop/scrollbar.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/desktop/scrollbar.c b/desktop/scrollbar.c
index dadb82801..3d21aae02 100644
--- a/desktop/scrollbar.c
+++ b/desktop/scrollbar.c
@@ -524,9 +524,11 @@ void scrollbar_set_extents(struct scrollbar *s, int length,
s->full_size = s->visible_size;
/* Update scroll offset (scaled in proportion with change in excess) */
- s->offset = (cur_excess < 1) ? 0 :
- ((s->full_size - s->visible_size) * s->offset /
- cur_excess);
+ if (cur_excess <= 0) {
+ s->offset = 0;
+ } else {
+ s->offset = (full_size - visible_size) * s->offset / cur_excess;
+ }
well_length = s->length - 2 * SCROLLBAR_WIDTH;