From b1342796448c01515d8dcb4d992f804a5f2f4fb4 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 20 Aug 2012 22:02:37 +0100 Subject: Allow the presence of form inputs to be obtained without knowledge of html content internals. --- desktop/browser.c | 1 + gtk/scaffolding.c | 3 ++- render/html.c | 17 +++++++++++++++++ utils/types.h | 5 +++++ 4 files changed, 25 insertions(+), 1 deletion(-) diff --git a/desktop/browser.c b/desktop/browser.c index a33bbff25..42acc3452 100644 --- a/desktop/browser.c +++ b/desktop/browser.c @@ -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); } diff --git a/gtk/scaffolding.c b/gtk/scaffolding.c index 84c20ee1e..7973cc743 100644 --- a/gtk/scaffolding.c +++ b/gtk/scaffolding.c @@ -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 }; /** diff --git a/render/html.c b/render/html.c index 17ca80184..8d64fdf7d 100644 --- a/render/html.c +++ b/render/html.c @@ -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; + } + } } } diff --git a/utils/types.h b/utils/types.h index 3500968ce..617b4938c 100644 --- a/utils/types.h +++ b/utils/types.h @@ -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 -- cgit v1.2.3