diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2008-02-02 00:13:19 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2008-02-02 00:13:19 +0000 |
commit | 120ca506c1de0d45884354b425762e90c660f52e (patch) | |
tree | 802bf68de8fb60088c4236484e6c9228278bd08d /css/css.c | |
parent | 83941da263d03bdfc97ff48780af6881a250f3bc (diff) | |
download | netsurf-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 'css/css.c')
-rw-r--r-- | css/css.c | 31 |
1 files changed, 27 insertions, 4 deletions
@@ -99,6 +99,7 @@ #include "css/parser.h" #ifdef riscos #include "desktop/gui.h" +#include "desktop/options.h" #endif #include "utils/log.h" #include "utils/messages.h" @@ -3010,12 +3011,34 @@ unsigned int css_hash(const char *s, int length) float css_len2px(const struct css_length *length, const struct css_style *style) { - assert(!((length->unit == CSS_UNIT_EM || length->unit == CSS_UNIT_EX) && style == 0)); + struct css_length font; + font.unit = CSS_UNIT_PT; + + assert(!((length->unit == CSS_UNIT_EM || length->unit == CSS_UNIT_EX) && + style == 0)); switch (length->unit) { - case CSS_UNIT_EM: return length->value * css_len2px(&style->font_size.value.length, 0); - case CSS_UNIT_EX: return length->value * css_len2px(&style->font_size.value.length, 0) * 0.6; + case CSS_UNIT_EM: + if ((font.value = css_len2pt(&style-> + font_size.value.length, style)) < + option_font_min_size / 10) { + font.value = option_font_min_size / 10; + return length->value * css_len2px(&font, + style); + } else + return length->value * css_len2px(&style-> + font_size.value.length, 0); + case CSS_UNIT_EX: + if ((font.value = css_len2pt(&style-> + font_size.value.length, style)) < + option_font_min_size / 10) { + font.value = option_font_min_size / 10; + return length->value * css_len2px(&font, + style) * 0.6; + } else + return length->value * css_len2px(&style-> + font_size.value.length, 0) * 0.6; case CSS_UNIT_PX: return length->value; - /* We assume the screen and any other output has the same dpi */ + /* We assume the screen and any other output has the same dpi */ case CSS_UNIT_IN: return length->value * css_screen_dpi; case CSS_UNIT_CM: return length->value * css_screen_dpi / 2.54; case CSS_UNIT_MM: return length->value * css_screen_dpi / 25.4; |