summaryrefslogtreecommitdiff
path: root/render
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 /render
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 'render')
-rw-r--r--render/box.c25
-rw-r--r--render/box.h5
-rw-r--r--render/html_redraw.c3
3 files changed, 18 insertions, 15 deletions
diff --git a/render/box.c b/render/box.c
index 0c0985dab..b355e68d1 100644
--- a/render/box.c
+++ b/render/box.c
@@ -997,15 +997,14 @@ void box_duplicate_update(struct box *box,
* Applies the given scroll setup to a box. This includes scroll
* creation/deletion as well as scroll dimension updates.
*
+ * \param bw browser window in which the box is located
* \param box the box to handle the scrolls for
- * \param x X coordinate of the box
- * \param y Y coordinate of the box
* \param bottom whether the horizontal scrollbar should be present
* \param right whether the vertical scrollbar should be present
* \return true on success false otherwise
*/
-bool box_handle_scrollbars(struct box *box, int x, int y, bool bottom,
- bool right)
+bool box_handle_scrollbars(struct browser_window *bw, struct box *box,
+ bool bottom, bool right)
{
struct browser_scroll_data *data;
int padding_width, padding_height;
@@ -1021,7 +1020,7 @@ bool box_handle_scrollbars(struct box *box, int x, int y, bool bottom,
}
if (!right && box->scroll_y != NULL) {
- data = scroll_get_data(box->scroll_x);
+ data = scroll_get_data(box->scroll_y);
scroll_destroy(box->scroll_y);
free(data);
box->scroll_y = NULL;
@@ -1038,7 +1037,7 @@ bool box_handle_scrollbars(struct box *box, int x, int y, bool bottom,
warn_user("NoMemory", 0);
return false;
}
- data->bw = current_redraw_browser;
+ data->bw = bw;
data->box = box;
if (!scroll_create(false,
padding_height,
@@ -1049,8 +1048,10 @@ bool box_handle_scrollbars(struct box *box, int x, int y, bool bottom,
&(box->scroll_y)))
return false;
} else
- scroll_set_length_and_visible(box->scroll_y,
- padding_height, box->height);
+ scroll_set_extents(box->scroll_y,
+ padding_height, box->height,
+ box->descendant_y1 -
+ box->descendant_y0);
}
if (bottom) {
if (box->scroll_x == NULL) {
@@ -1060,7 +1061,7 @@ bool box_handle_scrollbars(struct box *box, int x, int y, bool bottom,
warn_user("NoMemory", 0);
return false;
}
- data->bw = current_redraw_browser;
+ data->bw = bw;
data->box = box;
if (!scroll_create(true,
padding_width -
@@ -1072,10 +1073,12 @@ bool box_handle_scrollbars(struct box *box, int x, int y, bool bottom,
&box->scroll_x))
return false;
} else
- scroll_set_length_and_visible(box->scroll_x,
+ scroll_set_extents(box->scroll_x,
padding_width -
(right ? SCROLLBAR_WIDTH : 0),
- box->width);
+ box->width,
+ box->descendant_x1 -
+ box->descendant_x0);
}
if (right && bottom)
diff --git a/render/box.h b/render/box.h
index 39a6c2521..b53e0481c 100644
--- a/render/box.h
+++ b/render/box.h
@@ -91,6 +91,7 @@
#include <stdio.h>
#include <libxml/HTMLparser.h>
+#include "desktop/browser.h"
#include "css/css.h"
struct box;
@@ -314,8 +315,8 @@ bool box_visible(struct box *box);
void box_dump(FILE *stream, struct box *box, unsigned int depth);
bool box_extract_link(const char *rel, const char *base, char **result);
-bool box_handle_scrollbars(struct box *box, int x, int y, bool bottom,
- bool right);
+bool box_handle_scrollbars(struct browser_window *bw, struct box *box,
+ bool bottom, bool right);
bool box_vscrollbar_present(const struct box *box);
bool box_hscrollbar_present(const struct box *box);
diff --git a/render/html_redraw.c b/render/html_redraw.c
index 2f4fdf794..becf99fe4 100644
--- a/render/html_redraw.c
+++ b/render/html_redraw.c
@@ -712,8 +712,7 @@ bool html_redraw_box(struct box *box,
has_y_scroll = box_vscrollbar_present(box);
- if (!box_handle_scrollbars(box,
- x_parent + box->x, y_parent + box->y,
+ if (!box_handle_scrollbars(current_redraw_browser,box,
has_x_scroll, has_y_scroll))
return false;