mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-01-03 17:54:33 +03:00
Merge from Paul Blokus' selectscroll branch. Fixes text input scrollbar behaviour.
svn path=/trunk/netsurf/; revision=9306
This commit is contained in:
parent
45e05288f0
commit
c26611b32b
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
25
render/box.c
25
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)
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user