diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2008-09-20 23:25:37 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2008-09-20 23:25:37 +0000 |
commit | 38ef84bf8723461d5ec58f6e94c35623e1003d28 (patch) | |
tree | b61838c263268b6b956394b53dd8affd1598a816 /render | |
parent | d75ece0d71535ca9ea300e12c167e4fcb78c20a5 (diff) | |
download | netsurf-38ef84bf8723461d5ec58f6e94c35623e1003d28.tar.gz netsurf-38ef84bf8723461d5ec58f6e94c35623e1003d28.tar.bz2 |
Fix floated radio buttons and checkboxes.
svn path=/trunk/netsurf/; revision=5386
Diffstat (limited to 'render')
-rw-r--r-- | render/layout.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/render/layout.c b/render/layout.c index 9ee6db76c..6e7ef29fc 100644 --- a/render/layout.c +++ b/render/layout.c @@ -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, |