mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-11-22 06:21:45 +03:00
Improve browser_window_scroll_at_point_internal
This commit is contained in:
parent
dcd9baeb80
commit
1d08a36562
@ -2403,7 +2403,6 @@ browser_window_scroll_at_point_internal(struct browser_window *bw,
|
||||
int x, int y,
|
||||
int scrx, int scry)
|
||||
{
|
||||
bool handled_scroll = false;
|
||||
assert(bw != NULL);
|
||||
|
||||
/* Handle (i)frame scroll offset (core-managed browser windows only) */
|
||||
@ -2443,18 +2442,9 @@ browser_window_scroll_at_point_internal(struct browser_window *bw,
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Try to scroll this window, if scroll not already handled */
|
||||
if (handled_scroll == false) {
|
||||
if (bw->scroll_y && scrollbar_scroll(bw->scroll_y, scry)) {
|
||||
handled_scroll = true;
|
||||
}
|
||||
|
||||
if (bw->scroll_x && scrollbar_scroll(bw->scroll_x, scrx)) {
|
||||
handled_scroll = true;
|
||||
}
|
||||
}
|
||||
|
||||
return handled_scroll;
|
||||
/* Try to scroll this window */
|
||||
return scrollbar_scroll(bw->scroll_y, scry) |
|
||||
scrollbar_scroll(bw->scroll_x, scrx);
|
||||
}
|
||||
|
||||
|
||||
|
@ -562,11 +562,11 @@ void scrollbar_set(struct scrollbar *s, int value, bool bar_pos)
|
||||
bool scrollbar_scroll(struct scrollbar *s, int change)
|
||||
{
|
||||
int well_length;
|
||||
int old_offset = s->offset;
|
||||
int old_offset;
|
||||
struct scrollbar_msg_data msg;
|
||||
|
||||
if (change == 0 || s->full_size <= s->visible_size) {
|
||||
/* zero scroll step, or unscrollable */
|
||||
if (s == NULL || change == 0 || s->full_size <= s->visible_size) {
|
||||
/* scrollbar not present, zero scroll step, or unscrollable */
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -594,6 +594,7 @@ bool scrollbar_scroll(struct scrollbar *s, int change)
|
||||
}
|
||||
|
||||
/* Get new offset */
|
||||
old_offset = s->offset;
|
||||
if (s->offset + change > s->full_size - s->visible_size) {
|
||||
s->offset = s->full_size - s->visible_size;
|
||||
} else if (s->offset + change < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user