Avoid box_at_point.

This commit is contained in:
Michael Drake 2012-08-20 22:25:02 +01:00
parent 45736594a1
commit f67a1ab4cf

View File

@ -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 );