summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2008-02-02 00:13:19 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2008-02-02 00:13:19 +0000
commit120ca506c1de0d45884354b425762e90c660f52e (patch)
tree802bf68de8fb60088c4236484e6c9228278bd08d /render
parent83941da263d03bdfc97ff48780af6881a250f3bc (diff)
downloadnetsurf-120ca506c1de0d45884354b425762e90c660f52e.tar.gz
netsurf-120ca506c1de0d45884354b425762e90c660f52e.tar.bz2
Make text input boxes with height:auto; and no initial value get a sensible height. Make all form elements have their dimensions based on the configured minimum font size, if the current text size is smaller. Remove redundant code for setting radio icon and checkbox sizes. All em/ex based sizes now respect the min font size, when it's in effect. Updated default styles for form elements.
svn path=/trunk/netsurf/; revision=3813
Diffstat (limited to 'render')
-rw-r--r--render/layout.c53
1 files changed, 12 insertions, 41 deletions
diff --git a/render/layout.c b/render/layout.c
index ae2fa20cf..a12029a47 100644
--- a/render/layout.c
+++ b/render/layout.c
@@ -46,7 +46,6 @@
#include "desktop/options.h"
#include "render/box.h"
#include "render/font.h"
-#include "render/form.h"
#include "render/layout.h"
#define NDEBUG
#include "utils/log.h"
@@ -1028,7 +1027,6 @@ bool layout_line(struct box *first, int *width, int *y,
int space_before = 0, space_after = 0;
unsigned int inline_count = 0;
unsigned int i;
- int min_gadget_size = 0;
LOG(("first %p, first->text '%.*s', width %i, y %i, cx %i, cy %i",
first, (int) first->length, first->text, *width,
@@ -1047,8 +1045,10 @@ bool layout_line(struct box *first, int *width, int *y,
if (x1 < x0)
x1 = x0;
- /* get minimum line height from containing block */
- if (has_text_children)
+ /* get minimum line height from containing block.
+ * this is the line-height if there are text children and also in the
+ * case of an initially empty text input */
+ if (has_text_children || first->parent->parent->gadget)
used_height = height = line_height(first->parent->parent->style);
else
/* inline containers with no text are usually for layout and
@@ -1159,24 +1159,11 @@ bool layout_line(struct box *first, int *width, int *y,
/* inline replaced, 10.3.2 and 10.6.2 */
assert(b->style);
- min_gadget_size = 0;
- /* checkboxes and radiobuttons contain no text but need to
- * follow configured min font size option */
- if (b->gadget && (b->gadget->type == GADGET_RADIO ||
- b->gadget->type == GADGET_CHECKBOX)) {
- min_gadget_size = option_font_min_size * css_screen_dpi
- / 720.0;
- min_gadget_size = min_gadget_size > css_len2px(&b->
- style->font_size.value.length, b->style) ?
- min_gadget_size : 0;
- }
-
/* calculate box width */
switch (b->style->width.width) {
case CSS_WIDTH_LENGTH:
- b->width = min_gadget_size ? min_gadget_size :
- css_len2px(&b->style->width.value.
- length, b->style);
+ b->width = css_len2px(&b->style->width.value.
+ length, b->style);
break;
case CSS_WIDTH_PERCENT:
b->width = *width *
@@ -1192,9 +1179,8 @@ bool layout_line(struct box *first, int *width, int *y,
/* height */
switch (b->style->height.height) {
case CSS_HEIGHT_LENGTH:
- b->height = min_gadget_size ? min_gadget_size :
- css_len2px(&b->style->height.length,
- b->style);
+ b->height = css_len2px(&b->style->height.length,
+ b->style);
break;
case CSS_HEIGHT_AUTO:
default:
@@ -1577,7 +1563,6 @@ struct box *layout_minmax_line(struct box *first,
float frac;
size_t i, j;
struct box *b;
- int min_gadget_size = 0;
/* corresponds to the pass 1 loop in layout_line() */
for (b = first; b; b = b->next) {
@@ -1672,24 +1657,11 @@ struct box *layout_minmax_line(struct box *first,
/* inline replaced, 10.3.2 and 10.6.2 */
assert(b->style);
- min_gadget_size = 0;
- /* checkboxes and radiobuttons contain no text but need to
- * follow configured min font size option */
- if (b->gadget && (b->gadget->type == GADGET_RADIO ||
- b->gadget->type == GADGET_CHECKBOX)) {
- min_gadget_size = option_font_min_size * css_screen_dpi
- / 720.0;
- min_gadget_size = min_gadget_size > css_len2px(&b->
- style->font_size.value.length, b->style) ?
- min_gadget_size : 0;
- }
-
/* calculate box width */
switch (b->style->width.width) {
case CSS_WIDTH_LENGTH:
- width = min_gadget_size ? min_gadget_size :
- css_len2px(&b->style->width.value.
- length, b->style);
+ width = css_len2px(&b->style->width.value.
+ length, b->style);
if (width < 0)
width = 0;
break;
@@ -1707,9 +1679,8 @@ struct box *layout_minmax_line(struct box *first,
/* height */
switch (b->style->height.height) {
case CSS_HEIGHT_LENGTH:
- height = min_gadget_size ? min_gadget_size :
- css_len2px(&b->style->height.length,
- b->style);
+ height = css_len2px(&b->style->height.length,
+ b->style);
break;
case CSS_HEIGHT_AUTO:
default: