Prevent tabbing into textfields whose styling is display: none;

svn path=/trunk/netsurf/; revision=3849
This commit is contained in:
John Mark Bell 2008-02-07 00:50:37 +00:00
parent 5c1f3bd8c8
commit 2c2ac87e37
2 changed files with 20 additions and 4 deletions

View File

@ -925,11 +925,14 @@ bool browser_window_input_callback(struct browser_window *bw,
case 9: { /* Tab */
struct form_control *next_input;
/* Find next text entry field that is actually
* displayed (i.e. has an associated box) */
for (next_input = input->gadget->next;
next_input &&
next_input->type != GADGET_TEXTBOX &&
((next_input->type != GADGET_TEXTBOX &&
next_input->type != GADGET_TEXTAREA &&
next_input->type != GADGET_PASSWORD;
next_input->type != GADGET_PASSWORD) ||
!next_input->box);
next_input = next_input->next)
;
if (!next_input)
@ -950,11 +953,14 @@ bool browser_window_input_callback(struct browser_window *bw,
case 11: { /* Shift + Tab */
struct form_control *prev_input;
/* Find previous text entry field that is actually
* displayed (i.e. has an associated box) */
for (prev_input = input->gadget->prev;
prev_input &&
prev_input->type != GADGET_TEXTBOX &&
((prev_input->type != GADGET_TEXTBOX &&
prev_input->type != GADGET_TEXTAREA &&
prev_input->type != GADGET_PASSWORD;
prev_input->type != GADGET_PASSWORD) ||
!prev_input->box);
prev_input = prev_input->prev)
;
if (!prev_input)

View File

@ -355,7 +355,17 @@ bool box_construct_element(xmlNode *n, struct content *content,
target = box->target;
}
if (style->display == CSS_DISPLAY_NONE) {
/* Free style and invalidate box's style pointer */
talloc_free(style);
box->style = NULL;
/* If this box has an associated gadget, invalidate the
* gadget's box pointer and our pointer to the gadget. */
if (box->gadget) {
box->gadget->box = NULL;
box->gadget = NULL;
}
/* We can't do this, as it will destroy any gadget
* associated with the box, thus making any form usage
* access freed memory. The box is in the talloc context,