mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-24 04:56:50 +03:00
Fix floated radio buttons and checkboxes.
svn path=/trunk/netsurf/; revision=5386
This commit is contained in:
parent
d75ece0d71
commit
38ef84bf87
@ -184,6 +184,7 @@ bool layout_block_context(struct box *block, struct content *content)
|
||||
int max_neg_margin = 0;
|
||||
int y = 0;
|
||||
struct box *margin_box;
|
||||
struct css_length gadget_size; /* Checkbox / radio buttons */
|
||||
|
||||
assert(block->type == BOX_BLOCK ||
|
||||
block->type == BOX_INLINE_BLOCK ||
|
||||
@ -248,6 +249,17 @@ bool layout_block_context(struct box *block, struct content *content)
|
||||
return true;
|
||||
}
|
||||
|
||||
/* special case if the block contains an radio button or checkbox */
|
||||
if (block->gadget && (block->gadget->type == GADGET_RADIO ||
|
||||
block->gadget->type == GADGET_CHECKBOX)) {
|
||||
/* form checkbox or radio button
|
||||
* if width or height is AUTO, set it to 1em */
|
||||
gadget_size.unit = CSS_UNIT_EM;
|
||||
gadget_size.value = 1;
|
||||
if (block->height == AUTO)
|
||||
block->height = css_len2px(&gadget_size, block->style);
|
||||
}
|
||||
|
||||
box = margin_box = block->children;
|
||||
/* set current coordinates to top-left of the block */
|
||||
cx = 0;
|
||||
@ -530,6 +542,9 @@ void layout_minmax_block(struct box *block, const struct font_functions *font_fu
|
||||
struct css_length size;
|
||||
size.unit = CSS_UNIT_EM;
|
||||
size.value = 10;
|
||||
struct css_length gadget_size; /* Checkbox / radio buttons */
|
||||
gadget_size.unit = CSS_UNIT_EM;
|
||||
gadget_size.value = 1;
|
||||
|
||||
assert(block->type == BOX_BLOCK ||
|
||||
block->type == BOX_INLINE_BLOCK ||
|
||||
@ -548,6 +563,15 @@ void layout_minmax_block(struct box *block, const struct font_functions *font_fu
|
||||
min = max = css_len2px(&size, block->style);
|
||||
}
|
||||
|
||||
if (block->gadget && (block->gadget->type == GADGET_RADIO ||
|
||||
block->gadget->type == GADGET_CHECKBOX) &&
|
||||
block->style &&
|
||||
block->style->width.width == CSS_WIDTH_AUTO) {
|
||||
/* form checkbox or radio button
|
||||
* if width is AUTO, set it to 1em */
|
||||
min = max = css_len2px(&gadget_size, block->style);
|
||||
}
|
||||
|
||||
if (block->object) {
|
||||
if (block->object->type == CONTENT_HTML) {
|
||||
layout_minmax_block(block->object->data.html.layout,
|
||||
|
Loading…
Reference in New Issue
Block a user