summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorChris Young <chris@unsatisfactorysoftware.co.uk>2012-08-18 16:26:56 +0100
committerChris Young <chris@unsatisfactorysoftware.co.uk>2012-08-18 16:26:56 +0100
commit19d2a0c01185451d2e2903f116f792e591b8ff5f (patch)
tree9b3a790d659effcefcc175c1eb1abd2cc43e61ca /render
parent8e4819e450f5922cde793477c634df9c82c21fb6 (diff)
parenteb35a576c1b5845d4aa6b2b77d8039f49f048edc (diff)
downloadnetsurf-19d2a0c01185451d2e2903f116f792e591b8ff5f.tar.gz
netsurf-19d2a0c01185451d2e2903f116f792e591b8ff5f.tar.bz2
Merge branch 'master' of git://git.netsurf-browser.org/netsurf
Diffstat (limited to 'render')
-rw-r--r--render/form.c164
-rw-r--r--render/form.h2
-rw-r--r--render/html.c15
-rw-r--r--render/html_interaction.c364
-rw-r--r--render/textinput.c2
-rw-r--r--render/textplain.c8
6 files changed, 287 insertions, 268 deletions
diff --git a/render/form.c b/render/form.c
index c1f097f79..09579dc5b 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.
*/
@@ -1453,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;
@@ -1500,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:
@@ -1513,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.c b/render/html.c
index 22fa80fbd..ed7e7ebaa 100644
--- a/render/html.c
+++ b/render/html.c
@@ -1242,6 +1242,21 @@ 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;
+
+ case CONTENT_MSG_SAVELINK:
+ /* Pass it on */
+ 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);
}
diff --git a/render/html_interaction.c b/render/html_interaction.c
index 4cdff7608..b6f2dc615 100644
--- a/render/html_interaction.c
+++ b/render/html_interaction.c
@@ -46,9 +46,135 @@
#include "utils/utils.h"
-static gui_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);
+/**
+ * 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);
+ }
+}
/**
@@ -175,7 +301,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;
@@ -266,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];
@@ -314,7 +440,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)
@@ -370,19 +496,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;
@@ -410,8 +536,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 +546,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 +593,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 |
@@ -526,12 +651,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);
@@ -561,22 +690,25 @@ 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) {
/* 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;
@@ -593,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) {
@@ -647,8 +779,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(
@@ -658,13 +794,17 @@ 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) {
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(
@@ -674,7 +814,7 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
drag_candidate,
x, y);
}
- pointer = GUI_POINTER_MOVE;
+ pointer = BROWSER_POINTER_MOVE;
}
}
}
@@ -684,24 +824,22 @@ 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);
}
- 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
*/
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;
@@ -716,114 +854,6 @@ void html_mouse_action(struct content *c, struct browser_window *bw,
}
-gui_pointer_shape get_pointer_shape(struct browser_window *bw, struct box *box,
- bool imagemap)
-{
- gui_pointer_shape pointer;
- 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 GUI_POINTER_PROGRESS;
-
- if (box->type == BOX_FLOAT_LEFT || box->type == BOX_FLOAT_RIGHT)
- style = box->children->style;
- else
- style = box->style;
-
- if (style == NULL)
- return GUI_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 = GUI_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;
- } else {
- /* anything else */
- if (loading) {
- /* loading new content */
- pointer = GUI_POINTER_PROGRESS;
- } else {
- pointer = GUI_POINTER_DEFAULT;
- }
- }
- break;
- case CSS_CURSOR_CROSSHAIR:
- pointer = GUI_POINTER_CROSS;
- break;
- case CSS_CURSOR_POINTER:
- pointer = GUI_POINTER_POINT;
- break;
- case CSS_CURSOR_MOVE:
- pointer = GUI_POINTER_MOVE;
- break;
- case CSS_CURSOR_E_RESIZE:
- pointer = GUI_POINTER_RIGHT;
- break;
- case CSS_CURSOR_W_RESIZE:
- pointer = GUI_POINTER_LEFT;
- break;
- case CSS_CURSOR_N_RESIZE:
- pointer = GUI_POINTER_UP;
- break;
- case CSS_CURSOR_S_RESIZE:
- pointer = GUI_POINTER_DOWN;
- break;
- case CSS_CURSOR_NE_RESIZE:
- pointer = GUI_POINTER_RU;
- break;
- case CSS_CURSOR_SW_RESIZE:
- pointer = GUI_POINTER_LD;
- break;
- case CSS_CURSOR_SE_RESIZE:
- pointer = GUI_POINTER_RD;
- break;
- case CSS_CURSOR_NW_RESIZE:
- pointer = GUI_POINTER_LU;
- break;
- case CSS_CURSOR_TEXT:
- pointer = GUI_POINTER_CARET;
- break;
- case CSS_CURSOR_WAIT:
- pointer = GUI_POINTER_WAIT;
- break;
- case CSS_CURSOR_PROGRESS:
- pointer = GUI_POINTER_PROGRESS;
- break;
- case CSS_CURSOR_HELP:
- pointer = GUI_POINTER_HELP;
- break;
- default:
- pointer = GUI_POINTER_DEFAULT;
- break;
- }
-
- return pointer;
-}
-
-
/**
* Callback for in-page scrollbars.
*/
@@ -833,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:
@@ -857,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,
- GUI_POINTER_DEFAULT);
+
+ msg_data.pointer = BROWSER_POINTER_AUTO;
+ content_broadcast(data->c, CONTENT_MSG_POINTER,
+ msg_data);
break;
}
}
@@ -899,37 +931,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);
- }
-}
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:
diff --git a/render/textplain.c b/render/textplain.c
index 7b0262be9..71d576579 100644
--- a/render/textplain.c
+++ b/render/textplain.c
@@ -675,7 +675,8 @@ 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;
+ union content_msg_data msg_data;
const char *status = 0;
size_t idx;
int dir = 0;
@@ -701,14 +702,15 @@ 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;
}
}
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);
}