mirror of
https://github.com/netsurf-browser/netsurf
synced 2025-02-06 01:24:20 +03:00
Merge branch 'master' of git://git.netsurf-browser.org/netsurf
This commit is contained in:
commit
27b65235e9
@ -419,7 +419,7 @@ browser_drag_type browser_window_get_drag_type(struct browser_window *bw)
|
||||
/* exported interface, documented in browser.h */
|
||||
struct browser_window * browser_window_get_root(struct browser_window *bw)
|
||||
{
|
||||
while (bw && !bw->window && bw->parent) {
|
||||
while (bw && bw->parent) {
|
||||
bw = bw->parent;
|
||||
}
|
||||
return bw;
|
||||
|
@ -59,9 +59,6 @@ void browser_window_scroll_callback(void *client_data,
|
||||
struct browser_window *bw = client_data;
|
||||
|
||||
switch(scrollbar_data->msg) {
|
||||
case SCROLLBAR_MSG_REDRAW:
|
||||
/* TODO: Is this needed? */
|
||||
break;
|
||||
case SCROLLBAR_MSG_MOVED:
|
||||
if (bw->browser_window_type == BROWSER_WINDOW_IFRAME) {
|
||||
html_redraw_a_box(bw->parent->current_content, bw->box);
|
||||
@ -291,7 +288,8 @@ void browser_window_recalculate_iframes(struct browser_window *bw)
|
||||
*/
|
||||
|
||||
void browser_window_create_frameset(struct browser_window *bw,
|
||||
struct content_html_frames *frameset) {
|
||||
struct content_html_frames *frameset)
|
||||
{
|
||||
int row, col, index;
|
||||
struct content_html_frames *frame;
|
||||
struct browser_window *window;
|
||||
@ -404,7 +402,8 @@ void browser_window_create_frameset(struct browser_window *bw,
|
||||
* \param bw The browser window to reposition framesets for
|
||||
*/
|
||||
|
||||
void browser_window_recalculate_frameset(struct browser_window *bw) {
|
||||
void browser_window_recalculate_frameset(struct browser_window *bw)
|
||||
{
|
||||
int widths[bw->cols][bw->rows];
|
||||
int heights[bw->cols][bw->rows];
|
||||
int bw_width, bw_height;
|
||||
@ -639,7 +638,8 @@ void browser_window_recalculate_frameset(struct browser_window *bw) {
|
||||
* \param bw The browser window to resize
|
||||
*/
|
||||
|
||||
void browser_window_resize_frame(struct browser_window *bw, int x, int y) {
|
||||
void browser_window_resize_frame(struct browser_window *bw, int x, int y)
|
||||
{
|
||||
struct browser_window *parent;
|
||||
struct browser_window *sibling;
|
||||
int col = -1, row = -1, i;
|
||||
@ -682,7 +682,8 @@ void browser_window_resize_frame(struct browser_window *bw, int x, int y) {
|
||||
|
||||
bool browser_window_resolve_frame_dimension(struct browser_window *bw,
|
||||
struct browser_window *sibling,
|
||||
int x, int y, bool width, bool height) {
|
||||
int x, int y, bool width, bool height)
|
||||
{
|
||||
int bw_dimension, sibling_dimension;
|
||||
int bw_pixels, sibling_pixels;
|
||||
struct frame_dimension *bw_d, *sibling_d;
|
||||
@ -797,10 +798,10 @@ bool browser_window_resolve_frame_dimension(struct browser_window *bw,
|
||||
}
|
||||
|
||||
|
||||
bool browser_window_resize_frames(struct browser_window *bw,
|
||||
static bool browser_window_resize_frames(struct browser_window *bw,
|
||||
browser_mouse_state mouse, int x, int y,
|
||||
gui_pointer_shape *pointer, const char **status,
|
||||
bool *action) {
|
||||
gui_pointer_shape *pointer)
|
||||
{
|
||||
struct browser_window *parent;
|
||||
bool left, right, up, down;
|
||||
int i, resize_margin;
|
||||
@ -851,13 +852,21 @@ bool browser_window_resize_frames(struct browser_window *bw,
|
||||
|
||||
/* check the sibling frames can be resized */
|
||||
if (left)
|
||||
left &= !parent->children[row * parent->cols + (col - 1)].no_resize;
|
||||
left &= !parent->children[row *
|
||||
parent->cols + (col - 1)].
|
||||
no_resize;
|
||||
if (right)
|
||||
right &= !parent->children[row * parent->cols + (col + 1)].no_resize;
|
||||
right &= !parent->children[row *
|
||||
parent->cols + (col + 1)].
|
||||
no_resize;
|
||||
if (up)
|
||||
up &= !parent->children[(row - 1) * parent->cols + col].no_resize;
|
||||
up &= !parent->children[(row - 1) *
|
||||
parent->cols + col].
|
||||
no_resize;
|
||||
if (down)
|
||||
down &= !parent->children[(row + 1) * parent->cols + col].no_resize;
|
||||
down &= !parent->children[(row + 1) *
|
||||
parent->cols + col].
|
||||
no_resize;
|
||||
|
||||
/* can't have opposite directions simultaneously */
|
||||
if (up)
|
||||
@ -899,9 +908,6 @@ bool browser_window_resize_frames(struct browser_window *bw,
|
||||
bw->drag_resize_right = right;
|
||||
bw->drag_resize_up = up;
|
||||
bw->drag_resize_down = down;
|
||||
|
||||
*status = messages_get("FrameDrag");
|
||||
*action = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -910,14 +916,28 @@ bool browser_window_resize_frames(struct browser_window *bw,
|
||||
if (bw->children) {
|
||||
for (i = 0; i < (bw->cols * bw->rows); i++)
|
||||
if (browser_window_resize_frames(&bw->children[i],
|
||||
mouse, x, y, pointer, status, action))
|
||||
mouse, x, y, pointer))
|
||||
return true;
|
||||
}
|
||||
if (bw->iframes) {
|
||||
for (i = 0; i < bw->iframe_count; i++)
|
||||
if (browser_window_resize_frames(&bw->iframes[i],
|
||||
mouse, x, y, pointer, status, action))
|
||||
mouse, x, y, pointer))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool browser_window_frame_resize_start(struct browser_window *bw,
|
||||
browser_mouse_state mouse, int x, int y,
|
||||
gui_pointer_shape *pointer)
|
||||
{
|
||||
struct browser_window *root = browser_window_get_root(bw);
|
||||
int offx, offy;
|
||||
|
||||
browser_window_get_position(bw, true, &offx, &offy);
|
||||
|
||||
return browser_window_resize_frames(root, mouse,
|
||||
x + offx, y + offy, pointer);
|
||||
}
|
||||
|
@ -33,9 +33,9 @@ void browser_window_recalculate_iframes(struct browser_window *bw);
|
||||
void browser_window_create_frameset(struct browser_window *bw,
|
||||
struct content_html_frames *frameset);
|
||||
void browser_window_recalculate_frameset(struct browser_window *bw);
|
||||
bool browser_window_resize_frames(struct browser_window *bw,
|
||||
bool browser_window_frame_resize_start(struct browser_window *bw,
|
||||
browser_mouse_state mouse, int x, int y,
|
||||
gui_pointer_shape *pointer, const char **status, bool *action);
|
||||
gui_pointer_shape *pointer);
|
||||
void browser_window_resize_frame(struct browser_window *bw, int x, int y);
|
||||
|
||||
void browser_window_scroll_callback(void *client_data,
|
||||
|
@ -427,16 +427,6 @@ void scrollbar_set(struct scrollbar *s, int value, bool bar_pos)
|
||||
msg.msg = SCROLLBAR_MSG_MOVED;
|
||||
msg.scroll_offset = s->offset;
|
||||
s->client_callback(s->client_data, &msg);
|
||||
|
||||
msg.msg = SCROLLBAR_MSG_REDRAW;
|
||||
msg.x0 = s->horizontal ? SCROLLBAR_WIDTH - 1 : 0;
|
||||
msg.y0 = s->horizontal ? 0 : SCROLLBAR_WIDTH - 1;
|
||||
msg.x1 = (s->horizontal ? s->length - SCROLLBAR_WIDTH + 1 :
|
||||
SCROLLBAR_WIDTH);
|
||||
msg.y1 = (s->horizontal ? SCROLLBAR_WIDTH :
|
||||
s->length - SCROLLBAR_WIDTH + 1);
|
||||
|
||||
s->client_callback(s->client_data, &msg);
|
||||
}
|
||||
|
||||
|
||||
@ -498,16 +488,6 @@ bool scrollbar_scroll(struct scrollbar *s, int change)
|
||||
msg.scroll_offset = s->offset;
|
||||
s->client_callback(s->client_data, &msg);
|
||||
|
||||
msg.msg = SCROLLBAR_MSG_REDRAW;
|
||||
msg.x0 = s->horizontal ? SCROLLBAR_WIDTH - 1 : 0;
|
||||
msg.y0 = s->horizontal ? 0 : SCROLLBAR_WIDTH - 1;
|
||||
msg.x1 = (s->horizontal ? s->length - SCROLLBAR_WIDTH + 1 :
|
||||
SCROLLBAR_WIDTH);
|
||||
msg.y1 = (s->horizontal ? SCROLLBAR_WIDTH :
|
||||
s->length - SCROLLBAR_WIDTH + 1);
|
||||
|
||||
s->client_callback(s->client_data, &msg);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -39,7 +39,6 @@
|
||||
struct scrollbar;
|
||||
|
||||
typedef enum {
|
||||
SCROLLBAR_MSG_REDRAW, /* the scrollbar requests a redraw */
|
||||
SCROLLBAR_MSG_MOVED, /* the scroll value has changed */
|
||||
SCROLLBAR_MSG_SCROLL_START, /* a scrollbar drag has started, all
|
||||
* mouse events should be passed to
|
||||
@ -47,7 +46,6 @@ typedef enum {
|
||||
* coordinates
|
||||
*/
|
||||
SCROLLBAR_MSG_SCROLL_FINISHED, /* cancel the above */
|
||||
|
||||
} scrollbar_msg;
|
||||
|
||||
struct scrollbar_msg_data {
|
||||
|
@ -1272,18 +1272,10 @@ void form_select_menu_scroll_callback(void *client_data,
|
||||
html_content *html = (html_content *)menu->c;
|
||||
|
||||
switch (scrollbar_data->msg) {
|
||||
case SCROLLBAR_MSG_REDRAW:
|
||||
menu->callback(menu->client_data,
|
||||
menu->width -
|
||||
SCROLLBAR_WIDTH + scrollbar_data->x0,
|
||||
scrollbar_data->y0,
|
||||
scrollbar_data->x1 - scrollbar_data->x0,
|
||||
scrollbar_data->y1 - scrollbar_data->y0);
|
||||
break;
|
||||
case SCROLLBAR_MSG_MOVED:
|
||||
menu->callback(menu->client_data,
|
||||
0, 0,
|
||||
menu->width - SCROLLBAR_WIDTH,
|
||||
menu->width,
|
||||
menu->height);
|
||||
break;
|
||||
case SCROLLBAR_MSG_SCROLL_START:
|
||||
|
@ -2359,13 +2359,13 @@ void html_redraw_a_box(hlcache_handle *h, struct box *box)
|
||||
* \param box box to redraw
|
||||
*/
|
||||
|
||||
void html__redraw_a_box(struct content *c, struct box *box)
|
||||
void html__redraw_a_box(struct html_content *html, struct box *box)
|
||||
{
|
||||
int x, y;
|
||||
|
||||
box_coords(box, &x, &y);
|
||||
|
||||
content__request_redraw(c, x, y,
|
||||
content__request_redraw((struct content *)html, x, y,
|
||||
box->padding[LEFT] + box->width + box->padding[RIGHT],
|
||||
box->padding[TOP] + box->height + box->padding[BOTTOM]);
|
||||
}
|
||||
@ -2786,7 +2786,7 @@ static bool html_drop_file_at_point(struct content *c, int x, int y, char *file)
|
||||
|
||||
/* Redraw box. */
|
||||
if (containing_content == NULL)
|
||||
html__redraw_a_box(c, file_box);
|
||||
html__redraw_a_box(html, file_box);
|
||||
else
|
||||
html_redraw_a_box(containing_content, file_box);
|
||||
|
||||
|
@ -581,13 +581,13 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
|
||||
bool done = false;
|
||||
|
||||
/* frame resizing */
|
||||
if (bw->parent) {
|
||||
struct browser_window *parent;
|
||||
for (parent = bw->parent; parent->parent;
|
||||
parent = parent->parent);
|
||||
browser_window_resize_frames(parent, mouse,
|
||||
x + bw->x, y + bw->y,
|
||||
&pointer, &status, &done);
|
||||
if (browser_window_frame_resize_start(bw, mouse, x, y,
|
||||
&pointer)) {
|
||||
if (mouse & (BROWSER_MOUSE_DRAG_1 |
|
||||
BROWSER_MOUSE_DRAG_2)) {
|
||||
status = messages_get("FrameDrag");
|
||||
}
|
||||
done = true;
|
||||
}
|
||||
|
||||
/* if clicking in the main page, remove the selection from any
|
||||
@ -833,34 +833,10 @@ void html_overflow_scroll_callback(void *client_data,
|
||||
struct html_scrollbar_data *data = client_data;
|
||||
html_content *html = (html_content *)data->c;
|
||||
struct box *box = data->box;
|
||||
int x, y, box_x, box_y, diff_x, diff_y;
|
||||
|
||||
switch(scrollbar_data->msg) {
|
||||
case SCROLLBAR_MSG_REDRAW:
|
||||
diff_x = box->padding[LEFT] + box->width +
|
||||
box->padding[RIGHT] - SCROLLBAR_WIDTH;
|
||||
diff_y = box->padding[TOP] + box->height +
|
||||
box->padding[BOTTOM] - SCROLLBAR_WIDTH;
|
||||
|
||||
box_coords(box, &box_x, &box_y);
|
||||
if (scrollbar_is_horizontal(
|
||||
scrollbar_data->scrollbar)) {
|
||||
x = box_x + scrollbar_get_offset(box->scroll_x);
|
||||
y = box_y + scrollbar_get_offset(box->scroll_y) +
|
||||
diff_y;
|
||||
} else {
|
||||
x = box_x + scrollbar_get_offset(box->scroll_x) +
|
||||
diff_x;
|
||||
y = box_y + scrollbar_get_offset(box->scroll_y);
|
||||
}
|
||||
content__request_redraw((struct content *)html,
|
||||
x + scrollbar_data->x0,
|
||||
y + scrollbar_data->y0,
|
||||
scrollbar_data->x1 - scrollbar_data->x0,
|
||||
scrollbar_data->y1 - scrollbar_data->y0);
|
||||
break;
|
||||
case SCROLLBAR_MSG_MOVED:
|
||||
html_redraw_a_box(html->bw->current_content, box);
|
||||
html__redraw_a_box(html, box);
|
||||
break;
|
||||
case SCROLLBAR_MSG_SCROLL_START:
|
||||
{
|
||||
|
@ -122,7 +122,7 @@ bool html_fetch_object(html_content *c, nsurl *url, struct box *box,
|
||||
|
||||
void html_set_status(html_content *c, const char *extra);
|
||||
|
||||
void html__redraw_a_box(struct content *c, struct box *box);
|
||||
void html__redraw_a_box(html_content *html, struct box *box);
|
||||
|
||||
struct browser_window *html_get_browser_window(struct content *c);
|
||||
struct search_context *html_get_search(struct content *c);
|
||||
|
@ -967,7 +967,7 @@ bool textinput_textarea_paste_text(struct browser_window *bw,
|
||||
textinput_textarea_move_caret,
|
||||
textarea, c);
|
||||
|
||||
html__redraw_a_box(c, textarea);
|
||||
html__redraw_a_box((html_content *)c, textarea);
|
||||
}
|
||||
|
||||
return success;
|
||||
@ -1085,7 +1085,7 @@ static void textinput_input_update_display(struct content *c, struct box *input,
|
||||
input, c);
|
||||
|
||||
if (dx || redraw)
|
||||
html__redraw_a_box(c, input);
|
||||
html__redraw_a_box(html, input);
|
||||
}
|
||||
|
||||
|
||||
@ -1599,7 +1599,7 @@ bool textinput_textarea_callback(struct browser_window *bw, uint32_t key,
|
||||
textarea, c);
|
||||
|
||||
if (scrolled || reflow)
|
||||
html__redraw_a_box(c, textarea);
|
||||
html__redraw_a_box(html, textarea);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1657,7 +1657,7 @@ void textinput_textarea_click(struct content *c, browser_mouse_state mouse,
|
||||
textarea, c);
|
||||
|
||||
if (scrolled)
|
||||
html__redraw_a_box(c, textarea);
|
||||
html__redraw_a_box(html, textarea);
|
||||
}
|
||||
|
||||
|
||||
@ -2122,7 +2122,7 @@ void textinput_input_click(struct content *c, struct box *input,
|
||||
input, c);
|
||||
|
||||
if (dx)
|
||||
html__redraw_a_box(c, input);
|
||||
html__redraw_a_box(html, input);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user