diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2009-04-28 20:13:10 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2009-04-28 20:13:10 +0000 |
commit | a99a5bdd707f27c9fb9a92a18f94830d710a7bee (patch) | |
tree | 1d12e722ca260012edec5df748c819ac4c08db44 /render/box_construct.c | |
parent | 044a9534008fd77a2cf8755943f3fe42fa177d54 (diff) | |
download | netsurf-a99a5bdd707f27c9fb9a92a18f94830d710a7bee.tar.gz netsurf-a99a5bdd707f27c9fb9a92a18f94830d710a7bee.tar.bz2 |
Move handling of TR height attribute from box construction to layout and add support for height property on TR.
svn path=/trunk/netsurf/; revision=7358
Diffstat (limited to 'render/box_construct.c')
-rw-r--r-- | render/box_construct.c | 53 |
1 files changed, 4 insertions, 49 deletions
diff --git a/render/box_construct.c b/render/box_construct.c index f31b51538..1141f75dd 100644 --- a/render/box_construct.c +++ b/render/box_construct.c @@ -562,52 +562,6 @@ bool box_construct_element(xmlNode *n, struct content *content, xmlFree(s); } - /* transfer <tr height="n"> down to the <td> elements */ - /* \todo move this into box_get_style() */ - if (strcmp((const char *) n->name, "tr") == 0) { - if ((s = (char *) xmlGetProp(n, - (const xmlChar *) "height"))) { - float value = atof(s); - if (value < 0 || strlen(s) == 0) { - /* ignore negative values and height="" */ - } else if (strrchr(s, '%')) { - /* the specification doesn't make clear what - * percentage heights mean, so ignore them */ - } else { - /* The tree is not normalized yet, so accept - * cells not in rows and rows not in row - * groups. */ - struct box *child; - float current; - for (child = box->children; child; - child = child->next) { - if (child->style->height.height == - CSS_HEIGHT_LENGTH) - current = css_len2px( - &child->style->height. - value.length, - child->style); - else - current = 0; - if (child->type == BOX_TABLE_CELL && - value > current) { - /* Row height exceeds cell - * height, increase cell height - * to row height */ - child->style->height.height = - CSS_HEIGHT_LENGTH; - child->style->height.value. - length.unit = - CSS_UNIT_PX; - child->style->height.value. - length.value = value; - } - } - } - xmlFree(s); - } - } - /* fetch any background image for this box */ if (style->background_image.type == CSS_BACKGROUND_IMAGE_URI) { if (!html_fetch_object(content, style->background_image.uri, @@ -925,6 +879,7 @@ struct css_style * box_get_style(struct content *c, ((strcmp((const char *) n->name, "iframe") == 0) || (strcmp((const char *) n->name, "td") == 0) || (strcmp((const char *) n->name, "th") == 0) || + (strcmp((const char *) n->name, "tr") == 0) || (strcmp((const char *) n->name, "img") == 0) || (strcmp((const char *) n->name, "object") == 0) || (strcmp((const char *) n->name, "applet") == 0))) { @@ -932,8 +887,8 @@ struct css_style * box_get_style(struct content *c, if (value <= 0 || strlen(s) == 0) { /* ignore negative values and height="" */ } else if (strrchr(s, '%')) { - /* the specification doesn't make clear what - * percentage heights mean, so ignore them */ + style->height.height = CSS_HEIGHT_PERCENT; + style->height.value.percent = value; } else { style->height.height = CSS_HEIGHT_LENGTH; style->height.value.length.unit = CSS_UNIT_PX; @@ -2328,7 +2283,7 @@ bool box_button(BOX_SPECIAL_PARAMS) gadget->box = box; box->type = BOX_INLINE_BLOCK; - + /* Just render the contents */ return true; |