Allow the presence of form inputs to be obtained without knowledge of html content internals.

This commit is contained in:
Michael Drake 2012-08-20 22:02:37 +01:00
parent 74a9ec6de4
commit b134279644
4 changed files with 25 additions and 1 deletions

View File

@ -549,6 +549,7 @@ void browser_window_get_contextual_content(struct browser_window *bw,
data->link_url = NULL;
data->object = NULL;
data->main = NULL;
data->form_features = CTX_FORM_NONE;
browser_window__get_contextual_content(bw, x, y, data);
}

View File

@ -162,7 +162,8 @@ nsgtk_scaffolding *scaf_list = NULL;
/** holds the context data for what's under the pointer, when the contextual
* menu is opened. */
static struct contextual_content current_menu_ctx = { NULL, NULL, NULL };
static struct contextual_content current_menu_ctx = {
NULL, NULL, NULL, CTX_FORM_NONE };
/**

View File

@ -2670,6 +2670,23 @@ html_get_contextual_content(struct content *c,
box->usemap, box_x, box_y, x, y,
&target));
}
if (box->gadget) {
switch (box->gadget->type) {
case GADGET_TEXTBOX:
case GADGET_TEXTAREA:
case GADGET_PASSWORD:
data->form_features = CTX_FORM_TEXT;
break;
case GADGET_FILE:
data->form_features = CTX_FORM_FILE;
break;
default:
data->form_features = CTX_FORM_NONE;
break;
}
}
}
}

View File

@ -52,6 +52,11 @@ struct contextual_content {
const char *link_url;
struct hlcache_handle *object;
struct hlcache_handle *main;
enum {
CTX_FORM_NONE,
CTX_FORM_TEXT,
CTX_FORM_FILE
} form_features;
};
#endif