From f67a1ab4cf3fc59bc9314623a6fbf41f7772d7bd Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 20 Aug 2012 22:25:02 +0100 Subject: Avoid box_at_point. --- atari/ctxmenu.c | 38 +++++--------------------------------- 1 file changed, 5 insertions(+), 33 deletions(-) (limited to 'atari/ctxmenu.c') diff --git a/atari/ctxmenu.c b/atari/ctxmenu.c index 25b3c847b..2230e0046 100644 --- a/atari/ctxmenu.c +++ b/atari/ctxmenu.c @@ -32,11 +32,8 @@ #include "desktop/textinput.h" #include "content/content.h" #include "content/hlcache.h" -#include "content/urldb.h" -#include "render/html.h" +#include "content/urldb.h" #include "css/css.h" -#include "render/box.h" -#include "render/form.h" #include "utils/log.h" #include "utils/messages.h" @@ -68,12 +65,10 @@ struct s_context_info ctxinfo; static struct s_context_info * get_context_info( struct gui_window * gw, short mx, short my ) { - struct box *box; hlcache_handle *h; - int box_x, box_y; LGRECT bwrect; struct contextual_content ccdata; - struct browser_window * bw = gw->browser->bw; + struct browser_window * bw = gw->browser->bw; h = bw->current_content; ctxinfo.flags = 0; @@ -107,31 +102,8 @@ static struct s_context_info * get_context_info( struct gui_window * gw, short m ctxinfo.flags |= CNT_IMG; } } - - box = html_get_box_tree(h); - box_x = box->margin[LEFT]; - box_y = box->margin[TOP]; - - while ((box = box_at_point(box, mx+gw->browser->scroll.current.x, my+gw->browser->scroll.current.y, &box_x, &box_y, &h))) - { - if (box->style && css_computed_visibility(box->style) == CSS_VISIBILITY_HIDDEN) - continue; - if (box->gadget) - { - switch (box->gadget->type) - { - case GADGET_TEXTBOX: - case GADGET_TEXTAREA: - case GADGET_PASSWORD: - // TODO: check if there is really an selection, but it - // doesn't hurt for now...: - ctxinfo.flags |= (CNT_INTERACTIVE | CNT_SELECTION); - break; - - default: break; - } - } - } + if ( ctxinfo.ccdata.form_features == CTX_FORM_TEXT ) + ctxinfo.flags |= (CNT_INTERACTIVE | CNT_SELECTION); return( &ctxinfo ); } @@ -259,7 +231,7 @@ void context_popup( struct gui_window * gw, short x, short y ) case POP_CTX_VIEW_SOURCE: editor = nsoption_charp(atari_editor); if (editor != NULL && strlen(editor)>0) { - data = content_get_source_data(gw->browser->bw->current_content, + data = content_get_source_data(gw->browser->bw->current_content, &size); if (size > 0 && data != NULL){ tempfile = tmpnam( NULL ); -- cgit v1.2.3