From 049d5097b8d625fc19f86cb9fb836de9a164b56b Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 16 Aug 2012 19:36:25 +0100 Subject: Don't need to include content.h --- desktop/gui.h | 1 - 1 file changed, 1 deletion(-) diff --git a/desktop/gui.h b/desktop/gui.h index 2fc2b9130..eccf0b4c6 100644 --- a/desktop/gui.h +++ b/desktop/gui.h @@ -67,7 +67,6 @@ typedef enum { GUI_POINTER_DEFAULT, GUI_POINTER_POINT, GUI_POINTER_CARET, #include #include "utils/config.h" -#include "content/content.h" #include "content/hlcache.h" #include "desktop/download.h" #include "desktop/search.h" -- cgit v1.2.3 From 1919c8e07168859cc6362c5283d47d0ced3a9bc2 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 16 Aug 2012 20:20:49 +0100 Subject: Add message for content wanting wanting drag save to start. --- content/content.h | 13 ++++++++++++- desktop/browser.c | 30 ++++++++++++++++++++++++++++++ render/html.c | 5 +++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/content/content.h b/content/content.h index f1ff2a2c9..5ff40d00c 100644 --- a/content/content.h +++ b/content/content.h @@ -74,7 +74,8 @@ typedef enum { CONTENT_MSG_DOWNLOAD, /**< download, not for display */ CONTENT_MSG_LINK, /**< RFC5988 link */ CONTENT_MSG_GETCTX, /**< Javascript context */ - CONTENT_MSG_SCROLL /**< Request to scroll content */ + CONTENT_MSG_SCROLL, /**< Request to scroll content */ + CONTENT_MSG_DRAGSAVE /**< Allow drag saving of content */ } content_msg; /** RFC5988 metadata link */ @@ -128,6 +129,16 @@ union content_msg_data { int x0, y0; int x1, y1; } scroll; + /** CONTENT_MSG_DRAGSAVE - Drag save a content */ + struct { + enum { + CONTENT_SAVE_ORIG, + CONTENT_SAVE_NATIVE, + CONTENT_SAVE_COMPLETE, + CONTENT_SAVE_SOURCE + } type; + struct hlcache_handle *content; + } dragsave; }; /** parameters to content redraw */ diff --git a/desktop/browser.c b/desktop/browser.c index 136557a75..95edf1d63 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -1440,6 +1440,36 @@ nserror browser_window_callback(hlcache_handle *c, break; + case CONTENT_MSG_DRAGSAVE: + { + /* Content wants drag save of a content */ + struct browser_window *root = browser_window_get_root(bw); + + switch(event->data.dragsave.type) { + case CONTENT_SAVE_ORIG: + gui_drag_save_object(GUI_SAVE_OBJECT_ORIG, + event->data.dragsave.content, + root->window); + break; + case CONTENT_SAVE_NATIVE: + gui_drag_save_object(GUI_SAVE_OBJECT_NATIVE, + event->data.dragsave.content, + root->window); + break; + case CONTENT_SAVE_COMPLETE: + gui_drag_save_object(GUI_SAVE_COMPLETE, + event->data.dragsave.content, + root->window); + break; + case CONTENT_SAVE_SOURCE: + gui_drag_save_object(GUI_SAVE_SOURCE, + event->data.dragsave.content, + root->window); + break; + } + } + break; + default: assert(0); } diff --git a/render/html.c b/render/html.c index 22fa80fbd..62b3d1d4e 100644 --- a/render/html.c +++ b/render/html.c @@ -1242,6 +1242,11 @@ html_object_callback(hlcache_handle *object, false); break; + case CONTENT_MSG_DRAGSAVE: + /* Pass it on */ + content_broadcast(&c->base, CONTENT_MSG_DRAGSAVE, event->data); + break; + default: assert(0); } -- cgit v1.2.3 From f04845b2cf3aaa6b15dbaa2acaa20197075d3234 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 16 Aug 2012 20:39:45 +0100 Subject: Broadcast message for drag save start and avoid messing inside bw. --- render/html_interaction.c | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/render/html_interaction.c b/render/html_interaction.c index 4cdff7608..e013b54a8 100644 --- a/render/html_interaction.c +++ b/render/html_interaction.c @@ -526,12 +526,16 @@ void html_mouse_action(struct content *c, struct browser_window *bw, } else if (object && (mouse & BROWSER_MOUSE_MOD_2)) { - if (mouse & BROWSER_MOUSE_DRAG_2) - gui_drag_save_object(GUI_SAVE_OBJECT_NATIVE, object, - bw->window); - else if (mouse & BROWSER_MOUSE_DRAG_1) - gui_drag_save_object(GUI_SAVE_OBJECT_ORIG, object, - bw->window); + if (mouse & BROWSER_MOUSE_DRAG_2) { + msg_data.dragsave.type = CONTENT_SAVE_NATIVE; + msg_data.dragsave.content = object; + content_broadcast(c, CONTENT_MSG_DRAGSAVE, msg_data); + + } else if (mouse & BROWSER_MOUSE_DRAG_1) { + msg_data.dragsave.type = CONTENT_SAVE_ORIG; + msg_data.dragsave.content = object; + content_broadcast(c, CONTENT_MSG_DRAGSAVE, msg_data); + } /* \todo should have a drag-saving object msg */ status = content_get_status_message(h); @@ -647,8 +651,12 @@ void html_mouse_action(struct content *c, struct browser_window *bw, if (mouse & BROWSER_MOUSE_DRAG_1) { if (mouse & BROWSER_MOUSE_MOD_2) { - gui_drag_save_object(GUI_SAVE_COMPLETE, - h, bw->window); + msg_data.dragsave.type = + CONTENT_SAVE_COMPLETE; + msg_data.dragsave.content = h; + content_broadcast(c, + CONTENT_MSG_DRAGSAVE, + msg_data); } else { if (drag_candidate == NULL) browser_window_page_drag_start( @@ -663,8 +671,12 @@ void html_mouse_action(struct content *c, struct browser_window *bw, } else if (mouse & BROWSER_MOUSE_DRAG_2) { if (mouse & BROWSER_MOUSE_MOD_2) { - gui_drag_save_object(GUI_SAVE_SOURCE, - h, bw->window); + msg_data.dragsave.type = + CONTENT_SAVE_SOURCE; + msg_data.dragsave.content = h; + content_broadcast(c, + CONTENT_MSG_DRAGSAVE, + msg_data); } else { if (drag_candidate == NULL) browser_window_page_drag_start( -- cgit v1.2.3 From cb9781e057c4da81f014de9a5a560dd80e5543d1 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 16 Aug 2012 21:35:42 +0100 Subject: Move bw time recording to bw layer. --- desktop/browser.c | 3 +++ render/html_interaction.c | 4 ---- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/desktop/browser.c b/desktop/browser.c index 95edf1d63..af2c2ff4f 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -1003,6 +1003,9 @@ void browser_window_go_post(struct browser_window *bw, const char *url, warn_user("NoMemory", 0); } + + /* Record time */ + bw->last_action = wallclock(); } diff --git a/render/html_interaction.c b/render/html_interaction.c index e013b54a8..6be3e5e0d 100644 --- a/render/html_interaction.c +++ b/render/html_interaction.c @@ -696,10 +696,6 @@ void html_mouse_action(struct content *c, struct browser_window *bw, } } - - if (action == ACTION_SUBMIT || action == ACTION_GO) - bw->last_action = wallclock(); - if (status != NULL) { msg_data.explicit_status_text = status; content_broadcast(c, CONTENT_MSG_STATUS, msg_data); -- cgit v1.2.3 From 35fd2ad7f2f2a62624f1445e352c0aaf6ac0b0ac Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 16 Aug 2012 22:21:08 +0100 Subject: Don't use GUI_POINTERs in content handlers. --- desktop/browser.c | 26 ++++++++++++------- desktop/browser.h | 25 +++++++++++++++++- desktop/frames.c | 22 ++++++++-------- desktop/frames.h | 3 +-- render/html_interaction.c | 64 +++++++++++++++++++++++------------------------ render/textplain.c | 4 +-- 6 files changed, 87 insertions(+), 57 deletions(-) diff --git a/desktop/browser.c b/desktop/browser.c index af2c2ff4f..779f7082f 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -1920,14 +1920,22 @@ void browser_window_set_status(struct browser_window *bw, const char *text) */ void browser_window_set_pointer(struct browser_window *bw, - gui_pointer_shape shape) + browser_pointer_shape shape) { struct browser_window *root = browser_window_get_root(bw); + gui_pointer_shape gui_shape; assert(root); assert(root->window); - gui_window_set_pointer(root->window, shape); + if (shape == BROWSER_POINTER_AUTO) { + gui_shape = GUI_POINTER_DEFAULT; + + } else { + gui_shape = (gui_pointer_shape)shape; + } + + gui_window_set_pointer(root->window, gui_shape); } @@ -2400,7 +2408,7 @@ void browser_window_mouse_track(struct browser_window *bw, { hlcache_handle *c = bw->current_content; const char *status = NULL; - gui_pointer_shape pointer = GUI_POINTER_DEFAULT; + browser_pointer_shape pointer = BROWSER_POINTER_DEFAULT; if (bw->window != NULL && bw->drag_window && bw != bw->drag_window) { /* This is the root browser window and there's an active drag @@ -2481,7 +2489,7 @@ void browser_window_mouse_track(struct browser_window *bw, /* Start a scrollbar drag, or continue existing drag */ status = scrollbar_mouse_action(bw->scroll_x, mouse, scr_x, scr_y); - pointer = GUI_POINTER_DEFAULT; + pointer = BROWSER_POINTER_DEFAULT; if (status != NULL) browser_window_set_status(bw, status); @@ -2506,7 +2514,7 @@ void browser_window_mouse_track(struct browser_window *bw, /* Start a scrollbar drag, or continue existing drag */ status = scrollbar_mouse_action(bw->scroll_y, mouse, scr_x, scr_y); - pointer = GUI_POINTER_DEFAULT; + pointer = BROWSER_POINTER_DEFAULT; if (status != NULL) browser_window_set_status(bw, status); @@ -2552,7 +2560,7 @@ void browser_window_mouse_click(struct browser_window *bw, { hlcache_handle *c = bw->current_content; const char *status = NULL; - gui_pointer_shape pointer = GUI_POINTER_DEFAULT; + browser_pointer_shape pointer = BROWSER_POINTER_DEFAULT; if (bw->children) { /* Browser window has children (frames) */ @@ -2600,7 +2608,7 @@ void browser_window_mouse_click(struct browser_window *bw, scr_y > 0 && scr_y < SCROLLBAR_WIDTH) { status = scrollbar_mouse_action(bw->scroll_x, mouse, scr_x, scr_y); - pointer = GUI_POINTER_DEFAULT; + pointer = BROWSER_POINTER_DEFAULT; if (status != NULL) browser_window_set_status(bw, status); @@ -2621,7 +2629,7 @@ void browser_window_mouse_click(struct browser_window *bw, scr_x > 0 && scr_x < SCROLLBAR_WIDTH) { status = scrollbar_mouse_action(bw->scroll_y, mouse, scr_x, scr_y); - pointer = GUI_POINTER_DEFAULT; + pointer = BROWSER_POINTER_DEFAULT; if (status != NULL) browser_window_set_status(bw, status); @@ -2648,7 +2656,7 @@ void browser_window_mouse_click(struct browser_window *bw, else if (mouse & (BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_2)) { browser_window_page_drag_start(bw, x, y); - browser_window_set_pointer(bw, GUI_POINTER_MOVE); + browser_window_set_pointer(bw, BROWSER_POINTER_MOVE); } break; } diff --git a/desktop/browser.h b/desktop/browser.h index c8af7889c..be5628880 100644 --- a/desktop/browser.h +++ b/desktop/browser.h @@ -68,6 +68,29 @@ typedef enum { DRAGGING_OTHER } browser_drag_type; +typedef enum { + BROWSER_POINTER_DEFAULT = GUI_POINTER_DEFAULT, + BROWSER_POINTER_POINT = GUI_POINTER_POINT, + BROWSER_POINTER_CARET = GUI_POINTER_CARET, + BROWSER_POINTER_MENU = GUI_POINTER_MENU, + BROWSER_POINTER_UP = GUI_POINTER_UP, + BROWSER_POINTER_DOWN = GUI_POINTER_DOWN, + BROWSER_POINTER_LEFT = GUI_POINTER_LEFT, + BROWSER_POINTER_RIGHT = GUI_POINTER_RIGHT, + BROWSER_POINTER_RU = GUI_POINTER_RU, + BROWSER_POINTER_LD = GUI_POINTER_LD, + BROWSER_POINTER_LU = GUI_POINTER_LU, + BROWSER_POINTER_RD = GUI_POINTER_RD, + BROWSER_POINTER_CROSS = GUI_POINTER_CROSS, + BROWSER_POINTER_MOVE = GUI_POINTER_MOVE, + BROWSER_POINTER_WAIT = GUI_POINTER_WAIT, + BROWSER_POINTER_HELP = GUI_POINTER_HELP, + BROWSER_POINTER_NO_DROP = GUI_POINTER_NO_DROP, + BROWSER_POINTER_NOT_ALLOWED = GUI_POINTER_NOT_ALLOWED, + BROWSER_POINTER_PROGRESS = GUI_POINTER_PROGRESS, + BROWSER_POINTER_AUTO +} browser_pointer_shape; + /** Browser window data. */ struct browser_window { /** Page currently displayed, or 0. Must have status READY or DONE. */ @@ -301,7 +324,7 @@ void browser_window_redraw_rect(struct browser_window *bw, int x, int y, void browser_window_set_status(struct browser_window *bw, const char *text); void browser_window_set_pointer(struct browser_window *bw, - gui_pointer_shape shape); + browser_pointer_shape shape); void browser_window_page_drag_start(struct browser_window *bw, int x, int y); bool browser_window_back_available(struct browser_window *bw); diff --git a/desktop/frames.c b/desktop/frames.c index 836108aa3..0d67ad8c5 100644 --- a/desktop/frames.c +++ b/desktop/frames.c @@ -91,7 +91,7 @@ void browser_window_scroll_callback(void *client_data, case SCROLLBAR_MSG_SCROLL_FINISHED: browser_window_set_drag_type(bw, DRAGGING_NONE, NULL); - browser_window_set_pointer(bw, GUI_POINTER_DEFAULT); + browser_window_set_pointer(bw, BROWSER_POINTER_DEFAULT); break; } } @@ -800,7 +800,7 @@ bool browser_window_resolve_frame_dimension(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) + browser_pointer_shape *pointer) { struct browser_window *parent; bool left, right, up, down; @@ -878,22 +878,22 @@ static bool browser_window_resize_frames(struct browser_window *bw, if (left || right || up || down) { if (left) { if (down) - *pointer = GUI_POINTER_LD; + *pointer = BROWSER_POINTER_LD; else if (up) - *pointer = GUI_POINTER_LU; + *pointer = BROWSER_POINTER_LU; else - *pointer = GUI_POINTER_LEFT; + *pointer = BROWSER_POINTER_LEFT; } else if (right) { if (down) - *pointer = GUI_POINTER_RD; + *pointer = BROWSER_POINTER_RD; else if (up) - *pointer = GUI_POINTER_RU; + *pointer = BROWSER_POINTER_RU; else - *pointer = GUI_POINTER_RIGHT; + *pointer = BROWSER_POINTER_RIGHT; } else if (up) { - *pointer = GUI_POINTER_UP; + *pointer = BROWSER_POINTER_UP; } else { - *pointer = GUI_POINTER_DOWN; + *pointer = BROWSER_POINTER_DOWN; } if (mouse & (BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_2)) { @@ -931,7 +931,7 @@ static 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) + browser_pointer_shape *pointer) { struct browser_window *root = browser_window_get_root(bw); int offx, offy; diff --git a/desktop/frames.h b/desktop/frames.h index efbe6a8c2..149921641 100644 --- a/desktop/frames.h +++ b/desktop/frames.h @@ -24,7 +24,6 @@ #define _NETSURF_DESKTOP_FRAMES_H_ #include "desktop/browser.h" -#include "desktop/gui.h" void browser_window_create_iframes(struct browser_window *bw, @@ -35,7 +34,7 @@ void browser_window_create_frameset(struct browser_window *bw, void browser_window_recalculate_frameset(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); + browser_pointer_shape *pointer); void browser_window_resize_frame(struct browser_window *bw, int x, int y); void browser_window_scroll_callback(void *client_data, diff --git a/render/html_interaction.c b/render/html_interaction.c index 6be3e5e0d..5ba286e04 100644 --- a/render/html_interaction.c +++ b/render/html_interaction.c @@ -46,7 +46,7 @@ #include "utils/utils.h" -static gui_pointer_shape get_pointer_shape(struct browser_window *bw, +static browser_pointer_shape get_pointer_shape(struct browser_window *bw, struct box *box, bool imagemap); static void html_box_drag_start(struct box *box, int x, int y); @@ -175,7 +175,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, const char *target = 0; char status_buffer[200]; const char *status = 0; - gui_pointer_shape pointer = GUI_POINTER_DEFAULT; + browser_pointer_shape pointer = BROWSER_POINTER_DEFAULT; bool imagemap = false; int box_x = 0, box_y = 0; int gadget_box_x = 0, gadget_box_y = 0; @@ -370,19 +370,19 @@ void html_mouse_action(struct content *c, struct browser_window *bw, if (scrollbar) { status = scrollbar_mouse_action(scrollbar, mouse, scroll_mouse_x, scroll_mouse_y); - pointer = GUI_POINTER_DEFAULT; + pointer = BROWSER_POINTER_DEFAULT; } else if (gadget) { switch (gadget->type) { case GADGET_SELECT: status = messages_get("FormSelect"); - pointer = GUI_POINTER_MENU; + pointer = BROWSER_POINTER_MENU; if (mouse & BROWSER_MOUSE_CLICK_1 && nsoption_bool(core_select_menu)) { html->visible_select_menu = gadget; form_open_select_menu(c, gadget, form_select_menu_callback, c); - pointer = GUI_POINTER_DEFAULT; + pointer = BROWSER_POINTER_DEFAULT; } else if (mouse & BROWSER_MOUSE_CLICK_1) gui_create_form_select_menu(bw, gadget); break; @@ -666,7 +666,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, drag_candidate, x, y); } - pointer = GUI_POINTER_MOVE; + pointer = BROWSER_POINTER_MOVE; } } else if (mouse & BROWSER_MOUSE_DRAG_2) { @@ -686,7 +686,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, drag_candidate, x, y); } - pointer = GUI_POINTER_MOVE; + pointer = BROWSER_POINTER_MOVE; } } } @@ -724,10 +724,10 @@ void html_mouse_action(struct content *c, struct browser_window *bw, } -gui_pointer_shape get_pointer_shape(struct browser_window *bw, struct box *box, +browser_pointer_shape get_pointer_shape(struct browser_window *bw, struct box *box, bool imagemap) { - gui_pointer_shape pointer; + browser_pointer_shape pointer; css_computed_style *style; enum css_cursor_e cursor; lwc_string **cursor_uris; @@ -742,7 +742,7 @@ gui_pointer_shape get_pointer_shape(struct browser_window *bw, struct box *box, if (wallclock() - bw->last_action < 100 && loading) /* If less than 1 second since last link followed, show * progress indicating pointer and we're loading something */ - return GUI_POINTER_PROGRESS; + return BROWSER_POINTER_PROGRESS; if (box->type == BOX_FLOAT_LEFT || box->type == BOX_FLOAT_RIGHT) style = box->children->style; @@ -750,7 +750,7 @@ gui_pointer_shape get_pointer_shape(struct browser_window *bw, struct box *box, style = box->style; if (style == NULL) - return GUI_POINTER_DEFAULT; + return BROWSER_POINTER_DEFAULT; cursor = css_computed_cursor(style, &cursor_uris); @@ -761,70 +761,70 @@ gui_pointer_shape get_pointer_shape(struct browser_window *bw, struct box *box, box->gadget->type == GADGET_SUBMIT)) || imagemap) { /* link */ - pointer = GUI_POINTER_POINT; + pointer = BROWSER_POINTER_POINT; } else if (box->gadget && (box->gadget->type == GADGET_TEXTBOX || box->gadget->type == GADGET_PASSWORD || box->gadget->type == GADGET_TEXTAREA)) { /* text input */ - pointer = GUI_POINTER_CARET; + pointer = BROWSER_POINTER_CARET; } else { /* anything else */ if (loading) { /* loading new content */ - pointer = GUI_POINTER_PROGRESS; + pointer = BROWSER_POINTER_PROGRESS; } else { - pointer = GUI_POINTER_DEFAULT; + pointer = BROWSER_POINTER_DEFAULT; } } break; case CSS_CURSOR_CROSSHAIR: - pointer = GUI_POINTER_CROSS; + pointer = BROWSER_POINTER_CROSS; break; case CSS_CURSOR_POINTER: - pointer = GUI_POINTER_POINT; + pointer = BROWSER_POINTER_POINT; break; case CSS_CURSOR_MOVE: - pointer = GUI_POINTER_MOVE; + pointer = BROWSER_POINTER_MOVE; break; case CSS_CURSOR_E_RESIZE: - pointer = GUI_POINTER_RIGHT; + pointer = BROWSER_POINTER_RIGHT; break; case CSS_CURSOR_W_RESIZE: - pointer = GUI_POINTER_LEFT; + pointer = BROWSER_POINTER_LEFT; break; case CSS_CURSOR_N_RESIZE: - pointer = GUI_POINTER_UP; + pointer = BROWSER_POINTER_UP; break; case CSS_CURSOR_S_RESIZE: - pointer = GUI_POINTER_DOWN; + pointer = BROWSER_POINTER_DOWN; break; case CSS_CURSOR_NE_RESIZE: - pointer = GUI_POINTER_RU; + pointer = BROWSER_POINTER_RU; break; case CSS_CURSOR_SW_RESIZE: - pointer = GUI_POINTER_LD; + pointer = BROWSER_POINTER_LD; break; case CSS_CURSOR_SE_RESIZE: - pointer = GUI_POINTER_RD; + pointer = BROWSER_POINTER_RD; break; case CSS_CURSOR_NW_RESIZE: - pointer = GUI_POINTER_LU; + pointer = BROWSER_POINTER_LU; break; case CSS_CURSOR_TEXT: - pointer = GUI_POINTER_CARET; + pointer = BROWSER_POINTER_CARET; break; case CSS_CURSOR_WAIT: - pointer = GUI_POINTER_WAIT; + pointer = BROWSER_POINTER_WAIT; break; case CSS_CURSOR_PROGRESS: - pointer = GUI_POINTER_PROGRESS; + pointer = BROWSER_POINTER_PROGRESS; break; case CSS_CURSOR_HELP: - pointer = GUI_POINTER_HELP; + pointer = BROWSER_POINTER_HELP; break; default: - pointer = GUI_POINTER_DEFAULT; + pointer = BROWSER_POINTER_DEFAULT; break; } @@ -867,7 +867,7 @@ void html_overflow_scroll_callback(void *client_data, DRAGGING_NONE, NULL); browser_window_set_pointer(html->bw, - GUI_POINTER_DEFAULT); + BROWSER_POINTER_DEFAULT); break; } } diff --git a/render/textplain.c b/render/textplain.c index 7b0262be9..7411e3b75 100644 --- a/render/textplain.c +++ b/render/textplain.c @@ -675,7 +675,7 @@ void textplain_mouse_action(struct content *c, struct browser_window *bw, browser_mouse_state mouse, int x, int y) { textplain_content *text = (textplain_content *) c; - gui_pointer_shape pointer = GUI_POINTER_DEFAULT; + browser_pointer_shape pointer = BROWSER_POINTER_DEFAULT; const char *status = 0; size_t idx; int dir = 0; @@ -701,7 +701,7 @@ void textplain_mouse_action(struct content *c, struct browser_window *bw, if (mouse & (BROWSER_MOUSE_DRAG_1 | BROWSER_MOUSE_DRAG_2)) { browser_window_page_drag_start(bw, x, y); - pointer = GUI_POINTER_MOVE; + pointer = BROWSER_POINTER_MOVE; } } -- cgit v1.2.3 From d9bd357802795ba3b30d280bafe2c66daa44be54 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 16 Aug 2012 22:44:25 +0100 Subject: Move browser window related control over mouse pointer out of html content handler. --- desktop/browser.c | 19 +++++++++++++++++-- render/html_interaction.c | 19 ++----------------- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/desktop/browser.c b/desktop/browser.c index 779f7082f..17e35619d 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -1924,14 +1924,29 @@ void browser_window_set_pointer(struct browser_window *bw, { struct browser_window *root = browser_window_get_root(bw); gui_pointer_shape gui_shape; + bool loading; assert(root); assert(root->window); - if (shape == BROWSER_POINTER_AUTO) { - gui_shape = GUI_POINTER_DEFAULT; + loading = (bw->loading_content != NULL || (bw->current_content && + content_get_status(bw->current_content) == + CONTENT_STATUS_READY)); + + if (wallclock() - bw->last_action < 100 && loading) { + /* If loading and less than 1 second since last link followed, + * force progress indicator pointer */ + gui_shape = GUI_POINTER_PROGRESS; + + } else if (shape == BROWSER_POINTER_AUTO) { + /* Up to browser window to decide */ + if (loading) + gui_shape = GUI_POINTER_PROGRESS; + else + gui_shape = GUI_POINTER_DEFAULT; } else { + /* Use what we were told */ gui_shape = (gui_pointer_shape)shape; } diff --git a/render/html_interaction.c b/render/html_interaction.c index 5ba286e04..b4e2c049b 100644 --- a/render/html_interaction.c +++ b/render/html_interaction.c @@ -731,19 +731,9 @@ browser_pointer_shape get_pointer_shape(struct browser_window *bw, struct box *b css_computed_style *style; enum css_cursor_e cursor; lwc_string **cursor_uris; - bool loading; assert(bw); - loading = (bw->loading_content != NULL || (bw->current_content && - content_get_status(bw->current_content) == - CONTENT_STATUS_READY)); - - if (wallclock() - bw->last_action < 100 && loading) - /* If less than 1 second since last link followed, show - * progress indicating pointer and we're loading something */ - return BROWSER_POINTER_PROGRESS; - if (box->type == BOX_FLOAT_LEFT || box->type == BOX_FLOAT_RIGHT) style = box->children->style; else @@ -769,13 +759,8 @@ browser_pointer_shape get_pointer_shape(struct browser_window *bw, struct box *b /* text input */ pointer = BROWSER_POINTER_CARET; } else { - /* anything else */ - if (loading) { - /* loading new content */ - pointer = BROWSER_POINTER_PROGRESS; - } else { - pointer = BROWSER_POINTER_DEFAULT; - } + /* html content doesn't mind */ + pointer = BROWSER_POINTER_AUTO; } break; case CSS_CURSOR_CROSSHAIR: -- cgit v1.2.3 From 317a1dd92326e5bd189d529e395f5d6917d6bbab Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 16 Aug 2012 22:48:28 +0100 Subject: get_pointer_shape() doesn't need bw. --- render/html_interaction.c | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/render/html_interaction.c b/render/html_interaction.c index b4e2c049b..7edde10d1 100644 --- a/render/html_interaction.c +++ b/render/html_interaction.c @@ -46,8 +46,7 @@ #include "utils/utils.h" -static browser_pointer_shape get_pointer_shape(struct browser_window *bw, - struct box *box, bool imagemap); +static browser_pointer_shape get_pointer_shape(struct box *box, bool imagemap); static void html_box_drag_start(struct box *box, int x, int y); @@ -314,7 +313,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, if (box->title) title = box->title; - pointer = get_pointer_shape(bw, box, false); + pointer = get_pointer_shape(box, false); if ((box->scroll_x != NULL || box->scroll_y != NULL) && drag_candidate == NULL) @@ -410,8 +409,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, messages_get("FormSubmit"), gadget->form->action); status = status_buffer; - pointer = get_pointer_shape(bw, gadget_box, - false); + pointer = get_pointer_shape(gadget_box, false); if (mouse & (BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_CLICK_2)) action = ACTION_SUBMIT; @@ -421,7 +419,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, break; case GADGET_TEXTAREA: status = messages_get("FormTextarea"); - pointer = get_pointer_shape(bw, gadget_box, false); + pointer = get_pointer_shape(gadget_box, false); if (mouse & (BROWSER_MOUSE_PRESS_1 | BROWSER_MOUSE_PRESS_2)) { @@ -468,7 +466,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, case GADGET_TEXTBOX: case GADGET_PASSWORD: status = messages_get("FormTextbox"); - pointer = get_pointer_shape(bw, gadget_box, false); + pointer = get_pointer_shape(gadget_box, false); if ((mouse & BROWSER_MOUSE_PRESS_1) && !(mouse & (BROWSER_MOUSE_MOD_1 | @@ -565,7 +563,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, } else status = nsurl_access(url); - pointer = get_pointer_shape(bw, url_box, imagemap); + pointer = get_pointer_shape(url_box, imagemap); if (mouse & BROWSER_MOUSE_CLICK_1 && mouse & BROWSER_MOUSE_MOD_1) { @@ -724,16 +722,13 @@ void html_mouse_action(struct content *c, struct browser_window *bw, } -browser_pointer_shape get_pointer_shape(struct browser_window *bw, struct box *box, - bool imagemap) +browser_pointer_shape get_pointer_shape(struct box *box, bool imagemap) { browser_pointer_shape pointer; css_computed_style *style; enum css_cursor_e cursor; lwc_string **cursor_uris; - assert(bw); - if (box->type == BOX_FLOAT_LEFT || box->type == BOX_FLOAT_RIGHT) style = box->children->style; else -- cgit v1.2.3 From a548275fa238870075fc3c9a5076a731d3d11a9e Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 16 Aug 2012 22:54:00 +0100 Subject: Avoid forward declaration of functions. Add missing comment to one function. --- render/html_interaction.c | 255 +++++++++++++++++++++++----------------------- 1 file changed, 129 insertions(+), 126 deletions(-) diff --git a/render/html_interaction.c b/render/html_interaction.c index 7edde10d1..a74e99d9a 100644 --- a/render/html_interaction.c +++ b/render/html_interaction.c @@ -46,8 +46,135 @@ #include "utils/utils.h" -static browser_pointer_shape get_pointer_shape(struct box *box, bool imagemap); -static void html_box_drag_start(struct box *box, int x, int y); +/** + * Get pointer shape for given box + * + * \param box box in question + * \param imagemap whether an imagemap applies to the box + */ + +static browser_pointer_shape get_pointer_shape(struct box *box, bool imagemap) +{ + browser_pointer_shape pointer; + css_computed_style *style; + enum css_cursor_e cursor; + lwc_string **cursor_uris; + + if (box->type == BOX_FLOAT_LEFT || box->type == BOX_FLOAT_RIGHT) + style = box->children->style; + else + style = box->style; + + if (style == NULL) + return BROWSER_POINTER_DEFAULT; + + cursor = css_computed_cursor(style, &cursor_uris); + + switch (cursor) { + case CSS_CURSOR_AUTO: + if (box->href || (box->gadget && + (box->gadget->type == GADGET_IMAGE || + box->gadget->type == GADGET_SUBMIT)) || + imagemap) { + /* link */ + pointer = BROWSER_POINTER_POINT; + } else if (box->gadget && + (box->gadget->type == GADGET_TEXTBOX || + box->gadget->type == GADGET_PASSWORD || + box->gadget->type == GADGET_TEXTAREA)) { + /* text input */ + pointer = BROWSER_POINTER_CARET; + } else { + /* html content doesn't mind */ + pointer = BROWSER_POINTER_AUTO; + } + break; + case CSS_CURSOR_CROSSHAIR: + pointer = BROWSER_POINTER_CROSS; + break; + case CSS_CURSOR_POINTER: + pointer = BROWSER_POINTER_POINT; + break; + case CSS_CURSOR_MOVE: + pointer = BROWSER_POINTER_MOVE; + break; + case CSS_CURSOR_E_RESIZE: + pointer = BROWSER_POINTER_RIGHT; + break; + case CSS_CURSOR_W_RESIZE: + pointer = BROWSER_POINTER_LEFT; + break; + case CSS_CURSOR_N_RESIZE: + pointer = BROWSER_POINTER_UP; + break; + case CSS_CURSOR_S_RESIZE: + pointer = BROWSER_POINTER_DOWN; + break; + case CSS_CURSOR_NE_RESIZE: + pointer = BROWSER_POINTER_RU; + break; + case CSS_CURSOR_SW_RESIZE: + pointer = BROWSER_POINTER_LD; + break; + case CSS_CURSOR_SE_RESIZE: + pointer = BROWSER_POINTER_RD; + break; + case CSS_CURSOR_NW_RESIZE: + pointer = BROWSER_POINTER_LU; + break; + case CSS_CURSOR_TEXT: + pointer = BROWSER_POINTER_CARET; + break; + case CSS_CURSOR_WAIT: + pointer = BROWSER_POINTER_WAIT; + break; + case CSS_CURSOR_PROGRESS: + pointer = BROWSER_POINTER_PROGRESS; + break; + case CSS_CURSOR_HELP: + pointer = BROWSER_POINTER_HELP; + break; + default: + pointer = BROWSER_POINTER_DEFAULT; + break; + } + + return pointer; +} + + +/** + * Start drag scrolling the contents of a box + * + * \param box the box to be scrolled + * \param x x ordinate of initial mouse position + * \param y y ordinate + */ + +static void html_box_drag_start(struct box *box, int x, int y) +{ + int box_x, box_y; + int scroll_mouse_x, scroll_mouse_y; + + box_coords(box, &box_x, &box_y); + + if (box->scroll_x != NULL) { + scroll_mouse_x = x - box_x ; + scroll_mouse_y = y - (box_y + box->padding[TOP] + + box->height + box->padding[BOTTOM] - + SCROLLBAR_WIDTH); + scrollbar_start_content_drag(box->scroll_x, + scroll_mouse_x, scroll_mouse_y); + } else if (box->scroll_y != NULL) { + scroll_mouse_x = x - (box_x + box->padding[LEFT] + + box->width + box->padding[RIGHT] - + SCROLLBAR_WIDTH); + scroll_mouse_y = y - box_y; + + scrollbar_start_content_drag(box->scroll_y, + scroll_mouse_x, scroll_mouse_y); + } +} /** @@ -722,96 +849,6 @@ void html_mouse_action(struct content *c, struct browser_window *bw, } -browser_pointer_shape get_pointer_shape(struct box *box, bool imagemap) -{ - browser_pointer_shape pointer; - css_computed_style *style; - enum css_cursor_e cursor; - lwc_string **cursor_uris; - - if (box->type == BOX_FLOAT_LEFT || box->type == BOX_FLOAT_RIGHT) - style = box->children->style; - else - style = box->style; - - if (style == NULL) - return BROWSER_POINTER_DEFAULT; - - cursor = css_computed_cursor(style, &cursor_uris); - - switch (cursor) { - case CSS_CURSOR_AUTO: - if (box->href || (box->gadget && - (box->gadget->type == GADGET_IMAGE || - box->gadget->type == GADGET_SUBMIT)) || - imagemap) { - /* link */ - pointer = BROWSER_POINTER_POINT; - } else if (box->gadget && - (box->gadget->type == GADGET_TEXTBOX || - box->gadget->type == GADGET_PASSWORD || - box->gadget->type == GADGET_TEXTAREA)) { - /* text input */ - pointer = BROWSER_POINTER_CARET; - } else { - /* html content doesn't mind */ - pointer = BROWSER_POINTER_AUTO; - } - break; - case CSS_CURSOR_CROSSHAIR: - pointer = BROWSER_POINTER_CROSS; - break; - case CSS_CURSOR_POINTER: - pointer = BROWSER_POINTER_POINT; - break; - case CSS_CURSOR_MOVE: - pointer = BROWSER_POINTER_MOVE; - break; - case CSS_CURSOR_E_RESIZE: - pointer = BROWSER_POINTER_RIGHT; - break; - case CSS_CURSOR_W_RESIZE: - pointer = BROWSER_POINTER_LEFT; - break; - case CSS_CURSOR_N_RESIZE: - pointer = BROWSER_POINTER_UP; - break; - case CSS_CURSOR_S_RESIZE: - pointer = BROWSER_POINTER_DOWN; - break; - case CSS_CURSOR_NE_RESIZE: - pointer = BROWSER_POINTER_RU; - break; - case CSS_CURSOR_SW_RESIZE: - pointer = BROWSER_POINTER_LD; - break; - case CSS_CURSOR_SE_RESIZE: - pointer = BROWSER_POINTER_RD; - break; - case CSS_CURSOR_NW_RESIZE: - pointer = BROWSER_POINTER_LU; - break; - case CSS_CURSOR_TEXT: - pointer = BROWSER_POINTER_CARET; - break; - case CSS_CURSOR_WAIT: - pointer = BROWSER_POINTER_WAIT; - break; - case CSS_CURSOR_PROGRESS: - pointer = BROWSER_POINTER_PROGRESS; - break; - case CSS_CURSOR_HELP: - pointer = BROWSER_POINTER_HELP; - break; - default: - pointer = BROWSER_POINTER_DEFAULT; - break; - } - - return pointer; -} - - /** * Callback for in-page scrollbars. */ @@ -887,37 +924,3 @@ void html_overflow_scroll_drag_end(struct scrollbar *scrollbar, scroll_mouse_x, scroll_mouse_y); } } - - -/** - * Start drag scrolling the contents of a box - * - * \param box the box to be scrolled - * \param x x ordinate of initial mouse position - * \param y y ordinate - */ - -void html_box_drag_start(struct box *box, int x, int y) -{ - int box_x, box_y; - int scroll_mouse_x, scroll_mouse_y; - - box_coords(box, &box_x, &box_y); - - if (box->scroll_x != NULL) { - scroll_mouse_x = x - box_x ; - scroll_mouse_y = y - (box_y + box->padding[TOP] + - box->height + box->padding[BOTTOM] - - SCROLLBAR_WIDTH); - scrollbar_start_content_drag(box->scroll_x, - scroll_mouse_x, scroll_mouse_y); - } else if (box->scroll_y != NULL) { - scroll_mouse_x = x - (box_x + box->padding[LEFT] + - box->width + box->padding[RIGHT] - - SCROLLBAR_WIDTH); - scroll_mouse_y = y - box_y; - - scrollbar_start_content_drag(box->scroll_y, - scroll_mouse_x, scroll_mouse_y); - } -} -- cgit v1.2.3 From 402de7572d76686dd65a5ee71274a690a421cc8f Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Thu, 16 Aug 2012 23:26:05 +0100 Subject: Use new content message for saving of hyperlink target URL. --- content/content.h | 8 +++++++- desktop/browser.c | 10 ++++++++++ render/html.c | 5 +++++ render/html_interaction.c | 11 +++++++---- 4 files changed, 29 insertions(+), 5 deletions(-) diff --git a/content/content.h b/content/content.h index 5ff40d00c..f3a443868 100644 --- a/content/content.h +++ b/content/content.h @@ -75,7 +75,8 @@ typedef enum { CONTENT_MSG_LINK, /**< RFC5988 link */ CONTENT_MSG_GETCTX, /**< Javascript context */ CONTENT_MSG_SCROLL, /**< Request to scroll content */ - CONTENT_MSG_DRAGSAVE /**< Allow drag saving of content */ + CONTENT_MSG_DRAGSAVE, /**< Allow drag saving of content */ + CONTENT_MSG_SAVELINK /**< Allow URL to be saved */ } content_msg; /** RFC5988 metadata link */ @@ -139,6 +140,11 @@ union content_msg_data { } type; struct hlcache_handle *content; } dragsave; + /** CONTENT_MSG_SAVELINK - Save a URL */ + struct { + const char *url; + const char *title; + } savelink; }; /** parameters to content redraw */ diff --git a/desktop/browser.c b/desktop/browser.c index 17e35619d..3c99c5fb4 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -1473,6 +1473,16 @@ nserror browser_window_callback(hlcache_handle *c, } break; + case CONTENT_MSG_SAVELINK: + { + /* Content wants a link to be saved */ + struct browser_window *root = browser_window_get_root(bw); + gui_window_save_link(root->window, + event->data.savelink.url, + event->data.savelink.title); + } + break; + default: assert(0); } diff --git a/render/html.c b/render/html.c index 62b3d1d4e..7c7b797ba 100644 --- a/render/html.c +++ b/render/html.c @@ -1247,6 +1247,11 @@ html_object_callback(hlcache_handle *object, content_broadcast(&c->base, CONTENT_MSG_DRAGSAVE, event->data); break; + case CONTENT_MSG_SAVELINK: + /* Pass it on */ + content_broadcast(&c->base, CONTENT_MSG_SAVELINK, event->data); + break; + default: assert(0); } diff --git a/render/html_interaction.c b/render/html_interaction.c index a74e99d9a..a3cfaa95f 100644 --- a/render/html_interaction.c +++ b/render/html_interaction.c @@ -696,16 +696,19 @@ void html_mouse_action(struct content *c, struct browser_window *bw, mouse & BROWSER_MOUSE_MOD_1) { /* force download of link */ browser_window_go_post(bw, nsurl_access(url), 0, 0, - false, nsurl_access(hlcache_handle_get_url(h)), + false, + nsurl_access(hlcache_handle_get_url(h)), true, true, 0); + } else if (mouse & BROWSER_MOUSE_CLICK_2 && mouse & BROWSER_MOUSE_MOD_1) { - gui_window_save_link(bw->window, - nsurl_access(url), title); + msg_data.savelink.url = nsurl_access(url); + msg_data.savelink.title = title; + content_broadcast(c, CONTENT_MSG_SAVELINK, msg_data); + } else if (mouse & (BROWSER_MOUSE_CLICK_1 | BROWSER_MOUSE_CLICK_2)) action = ACTION_GO; - } else { bool done = false; -- cgit v1.2.3 From e177fa49c29ca05f5b2498f286f78da6545f8278 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 17 Aug 2012 09:45:15 +0100 Subject: Move mouse pointer enums to mouse header. --- desktop/browser.h | 23 ----------------------- desktop/gui.h | 9 +-------- desktop/mouse.h | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 31 deletions(-) diff --git a/desktop/browser.h b/desktop/browser.h index be5628880..489a7edad 100644 --- a/desktop/browser.h +++ b/desktop/browser.h @@ -68,29 +68,6 @@ typedef enum { DRAGGING_OTHER } browser_drag_type; -typedef enum { - BROWSER_POINTER_DEFAULT = GUI_POINTER_DEFAULT, - BROWSER_POINTER_POINT = GUI_POINTER_POINT, - BROWSER_POINTER_CARET = GUI_POINTER_CARET, - BROWSER_POINTER_MENU = GUI_POINTER_MENU, - BROWSER_POINTER_UP = GUI_POINTER_UP, - BROWSER_POINTER_DOWN = GUI_POINTER_DOWN, - BROWSER_POINTER_LEFT = GUI_POINTER_LEFT, - BROWSER_POINTER_RIGHT = GUI_POINTER_RIGHT, - BROWSER_POINTER_RU = GUI_POINTER_RU, - BROWSER_POINTER_LD = GUI_POINTER_LD, - BROWSER_POINTER_LU = GUI_POINTER_LU, - BROWSER_POINTER_RD = GUI_POINTER_RD, - BROWSER_POINTER_CROSS = GUI_POINTER_CROSS, - BROWSER_POINTER_MOVE = GUI_POINTER_MOVE, - BROWSER_POINTER_WAIT = GUI_POINTER_WAIT, - BROWSER_POINTER_HELP = GUI_POINTER_HELP, - BROWSER_POINTER_NO_DROP = GUI_POINTER_NO_DROP, - BROWSER_POINTER_NOT_ALLOWED = GUI_POINTER_NOT_ALLOWED, - BROWSER_POINTER_PROGRESS = GUI_POINTER_PROGRESS, - BROWSER_POINTER_AUTO -} browser_pointer_shape; - /** Browser window data. */ struct browser_window { /** Page currently displayed, or 0. Must have status READY or DONE. */ diff --git a/desktop/gui.h b/desktop/gui.h index eccf0b4c6..aa3fc8191 100644 --- a/desktop/gui.h +++ b/desktop/gui.h @@ -53,14 +53,6 @@ struct browser_window; struct selection; struct form_control; -typedef enum { GUI_POINTER_DEFAULT, GUI_POINTER_POINT, GUI_POINTER_CARET, - GUI_POINTER_MENU, GUI_POINTER_UP, GUI_POINTER_DOWN, - GUI_POINTER_LEFT, GUI_POINTER_RIGHT, GUI_POINTER_RU, - GUI_POINTER_LD, GUI_POINTER_LU, GUI_POINTER_RD, - GUI_POINTER_CROSS, GUI_POINTER_MOVE, GUI_POINTER_WAIT, - GUI_POINTER_HELP, GUI_POINTER_NO_DROP, GUI_POINTER_NOT_ALLOWED, - GUI_POINTER_PROGRESS } gui_pointer_shape; - #include #include @@ -69,6 +61,7 @@ typedef enum { GUI_POINTER_DEFAULT, GUI_POINTER_POINT, GUI_POINTER_CARET, #include "utils/config.h" #include "content/hlcache.h" #include "desktop/download.h" +#include "desktop/mouse.h" #include "desktop/search.h" #include "utils/errors.h" diff --git a/desktop/mouse.h b/desktop/mouse.h index 84af82f69..42603a67a 100644 --- a/desktop/mouse.h +++ b/desktop/mouse.h @@ -63,6 +63,40 @@ typedef enum { * (eg. Alt) */ } browser_mouse_state; + +typedef enum { GUI_POINTER_DEFAULT, GUI_POINTER_POINT, GUI_POINTER_CARET, + GUI_POINTER_MENU, GUI_POINTER_UP, GUI_POINTER_DOWN, + GUI_POINTER_LEFT, GUI_POINTER_RIGHT, GUI_POINTER_RU, + GUI_POINTER_LD, GUI_POINTER_LU, GUI_POINTER_RD, + GUI_POINTER_CROSS, GUI_POINTER_MOVE, GUI_POINTER_WAIT, + GUI_POINTER_HELP, GUI_POINTER_NO_DROP, GUI_POINTER_NOT_ALLOWED, + GUI_POINTER_PROGRESS } gui_pointer_shape; + +/** Mouse pointer type */ +typedef enum { + BROWSER_POINTER_DEFAULT = GUI_POINTER_DEFAULT, + BROWSER_POINTER_POINT = GUI_POINTER_POINT, + BROWSER_POINTER_CARET = GUI_POINTER_CARET, + BROWSER_POINTER_MENU = GUI_POINTER_MENU, + BROWSER_POINTER_UP = GUI_POINTER_UP, + BROWSER_POINTER_DOWN = GUI_POINTER_DOWN, + BROWSER_POINTER_LEFT = GUI_POINTER_LEFT, + BROWSER_POINTER_RIGHT = GUI_POINTER_RIGHT, + BROWSER_POINTER_RU = GUI_POINTER_RU, + BROWSER_POINTER_LD = GUI_POINTER_LD, + BROWSER_POINTER_LU = GUI_POINTER_LU, + BROWSER_POINTER_RD = GUI_POINTER_RD, + BROWSER_POINTER_CROSS = GUI_POINTER_CROSS, + BROWSER_POINTER_MOVE = GUI_POINTER_MOVE, + BROWSER_POINTER_WAIT = GUI_POINTER_WAIT, + BROWSER_POINTER_HELP = GUI_POINTER_HELP, + BROWSER_POINTER_NO_DROP = GUI_POINTER_NO_DROP, + BROWSER_POINTER_NOT_ALLOWED = GUI_POINTER_NOT_ALLOWED, + BROWSER_POINTER_PROGRESS = GUI_POINTER_PROGRESS, + BROWSER_POINTER_AUTO +} browser_pointer_shape; + + void browser_mouse_state_dump(browser_mouse_state mouse); #endif -- cgit v1.2.3 From 142a0bf859b70a2b278b007aac99a5ab0811a956 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 17 Aug 2012 10:01:15 +0100 Subject: Add content message for setting mouse pointer. --- content/content.h | 5 ++++- desktop/browser.c | 5 +++++ render/html.c | 5 +++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/content/content.h b/content/content.h index f3a443868..d0b525c85 100644 --- a/content/content.h +++ b/content/content.h @@ -76,7 +76,8 @@ typedef enum { CONTENT_MSG_GETCTX, /**< Javascript context */ CONTENT_MSG_SCROLL, /**< Request to scroll content */ CONTENT_MSG_DRAGSAVE, /**< Allow drag saving of content */ - CONTENT_MSG_SAVELINK /**< Allow URL to be saved */ + CONTENT_MSG_SAVELINK, /**< Allow URL to be saved */ + CONTENT_MSG_POINTER /**< Wants a specific mouse pointer set */ } content_msg; /** RFC5988 metadata link */ @@ -145,6 +146,8 @@ union content_msg_data { const char *url; const char *title; } savelink; + /** CONTENT_MSG_POINTER - Mouse pointer to set */ + browser_pointer_shape pointer; }; /** parameters to content redraw */ diff --git a/desktop/browser.c b/desktop/browser.c index 3c99c5fb4..f9519b011 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -1483,6 +1483,11 @@ nserror browser_window_callback(hlcache_handle *c, } break; + case CONTENT_MSG_POINTER: + /* Content wants to have specific mouse pointer */ + browser_window_set_pointer(bw, event->data.pointer); + break; + default: assert(0); } diff --git a/render/html.c b/render/html.c index 7c7b797ba..ed7e7ebaa 100644 --- a/render/html.c +++ b/render/html.c @@ -1252,6 +1252,11 @@ html_object_callback(hlcache_handle *object, content_broadcast(&c->base, CONTENT_MSG_SAVELINK, event->data); break; + case CONTENT_MSG_POINTER: + /* Pass it on */ + content_broadcast(&c->base, CONTENT_MSG_POINTER, event->data); + break; + default: assert(0); } -- cgit v1.2.3 From 8e315f9f8fceb6cc847fddd30095c2460b7cd637 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 17 Aug 2012 10:02:10 +0100 Subject: Set content handlers now set pointer via content msg. --- render/html_interaction.c | 14 +++++++++----- render/textplain.c | 4 +++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/render/html_interaction.c b/render/html_interaction.c index a3cfaa95f..1365d77e0 100644 --- a/render/html_interaction.c +++ b/render/html_interaction.c @@ -829,8 +829,10 @@ void html_mouse_action(struct content *c, struct browser_window *bw, content_broadcast(c, CONTENT_MSG_STATUS, msg_data); } - if (!iframe) - browser_window_set_pointer(bw, pointer); + if (!iframe) { + msg_data.pointer = pointer; + content_broadcast(c, CONTENT_MSG_POINTER, msg_data); + } /* deferred actions that can cause this browser_window to be destroyed * and must therefore be done after set_status/pointer @@ -861,6 +863,7 @@ 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; + union content_msg_data msg_data; switch(scrollbar_data->msg) { case SCROLLBAR_MSG_MOVED: @@ -885,9 +888,10 @@ void html_overflow_scroll_callback(void *client_data, browser_window_set_drag_type(html->bw, DRAGGING_NONE, NULL); - - browser_window_set_pointer(html->bw, - BROWSER_POINTER_DEFAULT); + + msg_data.pointer = BROWSER_POINTER_AUTO; + content_broadcast(data->c, CONTENT_MSG_POINTER, + msg_data); break; } } diff --git a/render/textplain.c b/render/textplain.c index 7411e3b75..71d576579 100644 --- a/render/textplain.c +++ b/render/textplain.c @@ -676,6 +676,7 @@ void textplain_mouse_action(struct content *c, struct browser_window *bw, { textplain_content *text = (textplain_content *) c; browser_pointer_shape pointer = BROWSER_POINTER_DEFAULT; + union content_msg_data msg_data; const char *status = 0; size_t idx; int dir = 0; @@ -708,7 +709,8 @@ void textplain_mouse_action(struct content *c, struct browser_window *bw, if (status != NULL) browser_window_set_status(bw, status); - browser_window_set_pointer(bw, pointer); + msg_data.pointer = pointer; + content_broadcast(c, CONTENT_MSG_POINTER, msg_data); } -- cgit v1.2.3 From fb6186484e105ae3041ec630c06dc71cb8bd4190 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 17 Aug 2012 10:02:41 +0100 Subject: Now contents types without mouse handling can set default pointer. Fixes standalone images showing e.g. link pointer if that was the last pointer before the standalone image loaded. --- content/content.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/content/content.c b/content/content.c index 758a615ce..e78ead295 100644 --- a/content/content.c +++ b/content/content.c @@ -416,8 +416,14 @@ void content_mouse_track(hlcache_handle *h, struct browser_window *bw, struct content *c = hlcache_handle_get_content(h); assert(c != NULL); - if (c->handler->mouse_track != NULL) + if (c->handler->mouse_track != NULL) { c->handler->mouse_track(c, bw, mouse, x, y); + } else { + union content_msg_data msg_data; + msg_data.pointer = BROWSER_POINTER_AUTO; + content_broadcast(c, CONTENT_MSG_POINTER, msg_data); + } + return; } -- cgit v1.2.3 From fc0f732dec6a89e4c169bee222ee50daf33c7acd Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 17 Aug 2012 10:29:34 +0100 Subject: s/[8 spaces]/[tab]/ --- amiga/Makefile.target | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/amiga/Makefile.target b/amiga/Makefile.target index 3ff3f9bca..2a821ba25 100644 --- a/amiga/Makefile.target +++ b/amiga/Makefile.target @@ -116,7 +116,7 @@ netsurf.lha: NetSurf $(Q)cp \!NetSurf/Resources/CSS,f79 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/nsdefault.css $(Q)cp \!NetSurf/Resources/internal.css,f79 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/internal.css $(Q)cp \!NetSurf/Resources/Quirks,f79 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/quirks.css - $(Q)cp \!NetSurf/Resources/netsurf.png,b60 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/netsurf.png + $(Q)cp \!NetSurf/Resources/netsurf.png,b60 $(AMIGA_INSTALL_TARGET_DIR)/NetSurf/Resources/netsurf.png $(Q)cp amiga/pkg/fitr $(AMIGA_INSTALL_TARGET_DIR)/NetSurf $(Q)cp amiga/pkg/drawer.info $(AMIGA_INSTALL_TARGET_DIR)/NetSurf.info $(Q)cp amiga/pkg/AutoInstall $(AMIGA_INSTALL_TARGET_DIR) -- cgit v1.2.3 From 22368db2325bf25d597023f34399b51c59cdfc2e Mon Sep 17 00:00:00 2001 From: Vincent Sanders Date: Fri, 17 Aug 2012 11:52:59 +0100 Subject: add js property (dom attribute) support to the document/element objects --- javascript/jsapi.h | 13 ++++++++++++- javascript/jsapi/document.c | 3 +++ javascript/jsapi/element.c | 15 +++++++++++++++ javascript/jsapi/htmldocument.c | 8 +++++++- javascript/jsapi/htmlelement.c | 10 +++++++++- javascript/jsapi/node.c | 25 +++++++++++++++++++++++-- javascript/jsapi/window.c | 15 ++------------- 7 files changed, 71 insertions(+), 18 deletions(-) diff --git a/javascript/jsapi.h b/javascript/jsapi.h index 2c10d02ce..c4c1ed099 100644 --- a/javascript/jsapi.h +++ b/javascript/jsapi.h @@ -69,6 +69,9 @@ #define JSAPI_PS(name, tinyid, flags) \ { #name , tinyid , flags , jsapi_property_##name##_get , jsapi_property_##name##_set } +#define JSAPI_PS_RO(name, tinyid, flags) \ + { #name , tinyid , flags | JSPROP_READONLY, jsapi_property_##name##_get , NULL } + #define JSAPI_PS_END { NULL, 0, 0, NULL, NULL } static inline JSObject * @@ -126,7 +129,15 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx, jsapi_property_##name##_set \ } -#define JSAPI_PS_END { NULL, 0,0,NULL,NULL } +#define JSAPI_PS_RO(name, tinyid, flags) { \ + #name , \ + tinyid , \ + flags | JSPROP_READONLY, \ + jsapi_property_##name##_get , \ + NULL \ + } + +#define JSAPI_PS_END { NULL, 0, 0, NULL, NULL } #define JSString_to_char(injsstring, outchar, outlen) \ diff --git a/javascript/jsapi/document.c b/javascript/jsapi/document.c index e5dfcd523..2d3bde41a 100644 --- a/javascript/jsapi/document.c +++ b/javascript/jsapi/document.c @@ -105,3 +105,6 @@ static JSBool JSAPI_NATIVE(getElementById, JSContext *cx, uintN argc, jsval *vp) JSAPI_FS_NODE, \ JSAPI_FS(getElementById, 1, 0) \ + +#define JSAPI_PS_DOCUMENT \ + JSAPI_PS_NODE diff --git a/javascript/jsapi/element.c b/javascript/jsapi/element.c index cefb95966..d301321d9 100644 --- a/javascript/jsapi/element.c +++ b/javascript/jsapi/element.c @@ -82,3 +82,18 @@ static JSBool JSAPI_NATIVE(getAttribute, JSContext *cx, uintN argc, jsval *vp) #define JSAPI_FS_ELEMENT \ JSAPI_FS_NODE, \ JSAPI_FS(getAttribute, 0, 0) + +static JSBool JSAPI_PROPERTYGET(id, JSContext *cx, JSObject *obj, jsval *vp) +{ + JS_SET_RVAL(cx, vp, JSVAL_NULL); + return JS_TRUE; +} + +static JSBool JSAPI_PROPERTYSET(id, JSContext *cx, JSObject *obj, jsval *vp) +{ + return JS_FALSE; +} + +#define JSAPI_PS_ELEMENT \ + JSAPI_PS_NODE, \ + JSAPI_PS(id, 0, JSPROP_ENUMERATE | JSPROP_SHARED) diff --git a/javascript/jsapi/htmldocument.c b/javascript/jsapi/htmldocument.c index aa9efbcd1..1a58e4e19 100644 --- a/javascript/jsapi/htmldocument.c +++ b/javascript/jsapi/htmldocument.c @@ -209,6 +209,12 @@ static JSFunctionSpec jsfunctions_document[] = { JSAPI_FS_END }; +static JSPropertySpec jsproperties_document[] = +{ + JSAPI_PS_DOCUMENT, + JSAPI_PS_END +}; + static void jsfinalize_document(JSContext *cx, JSObject *obj) { struct jsclass_document_priv *document; @@ -238,7 +244,7 @@ JSObject *jsapi_new_document(JSContext *cx, JSObject *parent, struct html_conten &JSCLASS_OBJECT, NULL, 0, - NULL, + jsproperties_document, jsfunctions_document, NULL, NULL); diff --git a/javascript/jsapi/htmlelement.c b/javascript/jsapi/htmlelement.c index 90cb06aba..a7846bacd 100644 --- a/javascript/jsapi/htmlelement.c +++ b/javascript/jsapi/htmlelement.c @@ -178,6 +178,14 @@ static JSFunctionSpec jsfunctions_element[] = { }; + + +static JSPropertySpec jsproperties_element[] = +{ + JSAPI_PS_ELEMENT, + JSAPI_PS_END +}; + JSObject * jsapi_new_element(JSContext *cx, JSObject *parent, @@ -201,7 +209,7 @@ jsapi_new_element(JSContext *cx, &JSCLASS_OBJECT, NULL, 0, - NULL, + jsproperties_element, jsfunctions_element, NULL, NULL); diff --git a/javascript/jsapi/node.c b/javascript/jsapi/node.c index d6a4f4406..b8c073752 100644 --- a/javascript/jsapi/node.c +++ b/javascript/jsapi/node.c @@ -260,8 +260,7 @@ static JSBool JSAPI_NATIVE(isDefaultNamespace, JSContext *cx, uintN argc, jsval return JS_TRUE; } - -#define JSAPI_FS_NODE \ +#define JSAPI_FS_NODE \ JSAPI_FS_EVENTTARGET, \ JSAPI_FS(hasChildNodes, 0, 0), \ JSAPI_FS(compareDocumentPosition, 0, 0), \ @@ -276,3 +275,25 @@ static JSBool JSAPI_NATIVE(isDefaultNamespace, JSContext *cx, uintN argc, jsval JSAPI_FS(lookupPrefix, 0, 0), \ JSAPI_FS(lookupNamespaceURI, 0, 0), \ JSAPI_FS(isDefaultNamespace, 0, 0) + + +static JSBool JSAPI_PROPERTYGET(nodeType, JSContext *cx, JSObject *obj, jsval *vp) +{ + JS_SET_RVAL(cx, vp, JSVAL_NULL); + return JS_TRUE; +} + +static JSBool JSAPI_PROPERTYGET(textContent, JSContext *cx, JSObject *obj, jsval *vp) +{ + JS_SET_RVAL(cx, vp, JSVAL_NULL); + return JS_TRUE; +} + +static JSBool JSAPI_PROPERTYSET(textContent, JSContext *cx, JSObject *obj, jsval *vp) +{ + return JS_FALSE; +} + +#define JSAPI_PS_NODE \ + JSAPI_PS_RO(nodeType, 0, JSPROP_ENUMERATE | JSPROP_SHARED), \ + JSAPI_PS(textContent, 0, JSPROP_ENUMERATE | JSPROP_SHARED) diff --git a/javascript/jsapi/window.c b/javascript/jsapi/window.c index 4f7e75109..72d3837d9 100644 --- a/javascript/jsapi/window.c +++ b/javascript/jsapi/window.c @@ -248,27 +248,16 @@ static JSBool JSAPI_PROPERTYGET(window, JSContext *cx, JSObject *obj, jsval *vp) return JS_TRUE; } -static JSBool JSAPI_PROPERTYSET(window, JSContext *cx, JSObject *obj, jsval *vp) -{ - return JS_FALSE; -} - static JSBool JSAPI_PROPERTYGET(self, JSContext *cx, JSObject *obj, jsval *vp) { JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj)); return JS_TRUE; } -static JSBool JSAPI_PROPERTYSET(self, JSContext *cx, JSObject *obj, jsval *vp) -{ - return JS_FALSE; -} - - static JSPropertySpec jsproperties_window[] = { - JSAPI_PS(window, 0, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_SHARED), - JSAPI_PS(self, 0, JSPROP_ENUMERATE | JSPROP_READONLY | JSPROP_SHARED), + JSAPI_PS_RO(window, 0, JSPROP_ENUMERATE | JSPROP_SHARED), + JSAPI_PS_RO(self, 0, JSPROP_ENUMERATE | JSPROP_SHARED), JSAPI_PS_END }; -- cgit v1.2.3 From be00425776514fccddd79d69caa8ed01dc172779 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 17 Aug 2012 15:20:53 +0100 Subject: Avoid bw dereference. --- render/form.c | 151 ++++++++++++++++++++++++++++++---------------------------- 1 file changed, 79 insertions(+), 72 deletions(-) diff --git a/render/form.c b/render/form.c index c1f097f79..40e95ea31 100644 --- a/render/form.c +++ b/render/form.c @@ -1121,6 +1121,84 @@ bool form_clip_inside_select_menu(struct form_control *control, float scale, return false; } + +/** + * Process a selection from a form select menu. + * + * \param bw browser window with menu + * \param control form control with menu + * \param item index of item selected from the menu + */ + +static void form__select_process_selection(html_content *html, + struct form_control *control, int item) +{ + struct box *inline_box; + struct form_option *o; + int count; + + assert(control != NULL); + assert(html != NULL); + + /** \todo Even though the form code is effectively part of the html + * content handler, poking around inside contents is not good */ + + inline_box = control->box->children->children; + + for (count = 0, o = control->data.select.items; + o != NULL; + count++, o = o->next) { + if (!control->data.select.multiple) + o->selected = false; + if (count == item) { + if (control->data.select.multiple) { + if (o->selected) { + o->selected = false; + control->data.select.num_selected--; + } else { + o->selected = true; + control->data.select.num_selected++; + } + } else { + o->selected = true; + } + } + if (o->selected) + control->data.select.current = o; + } + + talloc_free(inline_box->text); + inline_box->text = 0; + if (control->data.select.num_selected == 0) + inline_box->text = talloc_strdup(html, + messages_get("Form_None")); + else if (control->data.select.num_selected == 1) + inline_box->text = talloc_strdup(html, + control->data.select.current->text); + else + inline_box->text = talloc_strdup(html, + messages_get("Form_Many")); + if (!inline_box->text) { + warn_user("NoMemory", 0); + inline_box->length = 0; + } else + inline_box->length = strlen(inline_box->text); + inline_box->width = control->box->width; + + html__redraw_a_box(html, control->box); +} + + +void form_select_process_selection(hlcache_handle *h, + struct form_control *control, int item) +{ + assert(h != NULL); + + form__select_process_selection( + (html_content *)hlcache_handle_get_content(h), + control, item); +} + /** * Handle a click on the area of the currently opened select menu. * @@ -1153,9 +1231,7 @@ void form_select_menu_clicked(struct form_control *control, int x, int y) } if (option != NULL) { - /* TODO: going via the bw to get a hlcache_handle is nasty */ - form_select_process_selection(html->bw->current_content, - control, i); + form__select_process_selection(html, control, i); } menu->callback(menu->client_data, 0, 0, menu->width, menu->height); @@ -1318,75 +1394,6 @@ void form_select_get_dimensions(struct form_control *control, *height = control->data.select.menu->height; } - -/** - * Process a selection from a form select menu. - * - * \param bw browser window with menu - * \param control form control with menu - * \param item index of item selected from the menu - */ - -void form_select_process_selection(hlcache_handle *h, - struct form_control *control, int item) -{ - struct box *inline_box; - struct form_option *o; - int count; - struct content *current_content; - - assert(control != NULL); - assert(h != NULL); - - /** \todo Even though the form code is effectively part of the html - * content handler, poking around inside contents is not good */ - current_content = hlcache_handle_get_content(h); - - inline_box = control->box->children->children; - - for (count = 0, o = control->data.select.items; - o != NULL; - count++, o = o->next) { - if (!control->data.select.multiple) - o->selected = false; - if (count == item) { - if (control->data.select.multiple) { - if (o->selected) { - o->selected = false; - control->data.select.num_selected--; - } else { - o->selected = true; - control->data.select.num_selected++; - } - } else { - o->selected = true; - } - } - if (o->selected) - control->data.select.current = o; - } - - talloc_free(inline_box->text); - inline_box->text = 0; - if (control->data.select.num_selected == 0) - inline_box->text = talloc_strdup(current_content, - messages_get("Form_None")); - else if (control->data.select.num_selected == 1) - inline_box->text = talloc_strdup(current_content, - control->data.select.current->text); - else - inline_box->text = talloc_strdup(current_content, - messages_get("Form_Many")); - if (!inline_box->text) { - warn_user("NoMemory", 0); - inline_box->length = 0; - } else - inline_box->length = strlen(inline_box->text); - inline_box->width = control->box->width; - - html_redraw_a_box(h, control->box); -} - /** * Callback for the core select menu. */ -- cgit v1.2.3 From 6d39b569c700ddfa405c5c9a7a49320be2945997 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 17 Aug 2012 20:26:00 +0100 Subject: Pass content containing form's nsurl to form_submit, instead of its hlcache_handle. Avoid dereferencing bw in html content handlers. --- render/form.c | 13 +++++-------- render/form.h | 2 +- render/html_interaction.c | 2 +- render/textinput.c | 2 +- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/render/form.c b/render/form.c index 40e95ea31..09579dc5b 100644 --- a/render/form.c +++ b/render/form.c @@ -1460,7 +1460,7 @@ void form_radio_set(hlcache_handle *content, * Collect controls and submit a form. */ -void form_submit(hlcache_handle *h, struct browser_window *target, +void form_submit(nsurl *page_url, struct browser_window *target, struct form *form, struct form_control *submit_button) { char *data = NULL, *url = NULL; @@ -1507,8 +1507,7 @@ void form_submit(hlcache_handle *h, struct browser_window *target, url_destroy_components(&components); - browser_window_go(target, url, nsurl_access(hlcache_handle_get_url(h)), - true); + browser_window_go(target, url, nsurl_access(page_url), true); break; case method_POST_URLENC: @@ -1520,14 +1519,12 @@ void form_submit(hlcache_handle *h, struct browser_window *target, } browser_window_go_post(target, form->action, data, 0, - true, nsurl_access(hlcache_handle_get_url(h)), - false, true, 0); + true, nsurl_access(page_url), false, true, 0); break; case method_POST_MULTIPART: - browser_window_go_post(target, form->action, 0, - success, true, nsurl_access(hlcache_handle_get_url(h)), - false, true, 0); + browser_window_go_post(target, form->action, 0, success, + true, nsurl_access(page_url), false, true, 0); break; } diff --git a/render/form.h b/render/form.h index e2f9f63b6..dab6a625d 100644 --- a/render/form.h +++ b/render/form.h @@ -173,7 +173,7 @@ void form_select_get_dimensions(struct form_control *control, int *width, int *height); void form_select_process_selection(hlcache_handle *h, struct form_control *control, int item); -void form_submit(struct hlcache_handle *h, struct browser_window *target, +void form_submit(nsurl *page_url, struct browser_window *target, struct form *form, struct form_control *submit_button); void form_radio_set(struct hlcache_handle *content, struct form_control *radio); diff --git a/render/html_interaction.c b/render/html_interaction.c index 1365d77e0..4d21b222c 100644 --- a/render/html_interaction.c +++ b/render/html_interaction.c @@ -839,7 +839,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, */ switch (action) { case ACTION_SUBMIT: - form_submit(bw->current_content, + form_submit(content_get_url(c), browser_window_find_target(bw, target, mouse), gadget->form, gadget); break; diff --git a/render/textinput.c b/render/textinput.c index 3c3eb7361..6c580a8cd 100644 --- a/render/textinput.c +++ b/render/textinput.c @@ -1911,7 +1911,7 @@ bool textinput_input_callback(struct browser_window *bw, uint32_t key, selection_clear(&html->sel, true); if (form) - form_submit(bw->current_content, bw, form, 0); + form_submit(content_get_url(c), bw, form, 0); return true; case KEY_SHIFT_TAB: -- cgit v1.2.3 From eb35a576c1b5845d4aa6b2b77d8039f49f048edc Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 17 Aug 2012 20:57:35 +0100 Subject: Can get root element node directly from within the html content handler. Avoids using hlcache_handle which needs to go. --- render/html_interaction.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/render/html_interaction.c b/render/html_interaction.c index 4d21b222c..b6f2dc615 100644 --- a/render/html_interaction.c +++ b/render/html_interaction.c @@ -392,7 +392,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, /* search the box tree for a link, imagemap, form control, or * box with scrollbars */ - box = html_get_box_tree(h); + box = html->layout; /* Consider the margins of the html page now */ box_x = box->margin[LEFT]; @@ -725,7 +725,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw, /* if clicking in the main page, remove the selection from any * text areas */ if (!done) { - struct box *layout = html_get_box_tree(h); + struct box *layout = html->layout; if (mouse && (mouse < BROWSER_MOUSE_MOD_1) && selection_root(&html->sel) != layout) { -- cgit v1.2.3