summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2009-08-14 23:10:53 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2009-08-14 23:10:53 +0000
commitc26611b32b3796d4bbc886e7efd839ad999885c6 (patch)
treed6ba79dc0aa97c326449ee0e7eb57e25abed21c0 /desktop
parent45e05288f0b7f521dfe706ce152072c422cc8ae1 (diff)
downloadnetsurf-c26611b32b3796d4bbc886e7efd839ad999885c6.tar.gz
netsurf-c26611b32b3796d4bbc886e7efd839ad999885c6.tar.bz2
Merge from Paul Blokus' selectscroll branch. Fixes text input scrollbar behaviour.
svn path=/trunk/netsurf/; revision=9306
Diffstat (limited to 'desktop')
-rw-r--r--desktop/scroll.c23
-rw-r--r--desktop/scroll.h4
-rw-r--r--desktop/textinput.c3
3 files changed, 21 insertions, 9 deletions
diff --git a/desktop/scroll.c b/desktop/scroll.c
index 248c70908..8b14e7a2a 100644
--- a/desktop/scroll.c
+++ b/desktop/scroll.c
@@ -489,24 +489,33 @@ int scroll_get_offset(struct scroll *scroll)
/**
- * Set the length of the scroll and the visible part of the scrolled area.
+ * Set the length of the scroll and the visible or scrolled part of the scrolled
+ * area.
*
* \param scroll the scroll to set the values for
- * \param length the new scroll length to be set
- * \param scrolled_visible the new value of the visible part of the
+ * \param length -1 or the new scroll length to be set
+ * \param scrolled_visible -1 or the new value of the visible part of the
* scrolled area to be set
+ * \param scrolled_dimension -1 or the new dimension of the scrolled content
*/
-void scroll_set_length_and_visible(struct scroll *scroll, int length,
- int scrolled_visible)
+void scroll_set_extents(struct scroll *scroll, int length,
+ int scrolled_visible, int scrolled_dimension)
{
int well_length;
- scroll->length = length;
- scroll->scrolled_vis = scrolled_visible;
+ if (length != -1)
+ scroll->length = length;
+ if (scrolled_visible != -1)
+ scroll->scrolled_vis = scrolled_visible;
+ if (scrolled_dimension != -1)
+ scroll->scrolled_d = scrolled_dimension;
+
well_length = length - 2 * SCROLLBAR_WIDTH;
scroll->bar_len = (well_length * scrolled_visible) /
scroll->scrolled_d;
+ scroll->bar_off = (well_length * scroll->area_scroll) /
+ scroll->scrolled_d;
}
/**
diff --git a/desktop/scroll.h b/desktop/scroll.h
index f0569c37f..3e15d5f3e 100644
--- a/desktop/scroll.h
+++ b/desktop/scroll.h
@@ -71,8 +71,8 @@ bool scroll_redraw(struct scroll *scroll, int x, int y,
void scroll_set(struct scroll *scroll, int scroll_val, bool bar);
int scroll_get_offset(struct scroll *scroll);
-void scroll_set_length_and_visible(struct scroll *scroll, int length,
- int scrolled_visible);
+void scroll_set_extents(struct scroll *scroll, int length,
+ int scrolled_visible, int scrolled_dimension);
bool scroll_is_horizontal(struct scroll *scroll);
diff --git a/desktop/textinput.c b/desktop/textinput.c
index 4a0aef467..f05f57fe1 100644
--- a/desktop/textinput.c
+++ b/desktop/textinput.c
@@ -2098,6 +2098,9 @@ void textarea_reflow(struct browser_window *bw, struct box *textarea,
textarea->width = width;
textarea->height = height;
layout_calculate_descendant_bboxes(textarea);
+ box_handle_scrollbars(bw, textarea,
+ box_hscrollbar_present(textarea),
+ box_vscrollbar_present(textarea));
}