Remove dead assignements and add assert to check table cells aren't set to span no columns at layout time (Note: colspan=0 is treated as colspan=1 by box normalisation. It should probably be handled in table_calculate_columns_types() properly. Either way, there shouldn't be colspans of 0 by the time we get to layout.)

svn path=/trunk/netsurf/; revision=10601
This commit is contained in:
Michael Drake 2010-07-06 20:23:07 +00:00
parent 2d4222def8
commit 71644097be
1 changed files with 17 additions and 18 deletions

View File

@ -1527,26 +1527,23 @@ void layout_find_dimensions(int available_width, int viewport_height,
} }
if (padding) { if (padding) {
enum css_padding_e type;
css_fixed value = 0; css_fixed value = 0;
css_unit unit = CSS_UNIT_PX; css_unit unit = CSS_UNIT_PX;
switch (i) { switch (i) {
case TOP: case TOP:
type = css_computed_padding_top(style, css_computed_padding_top(style, &value, &unit);
&value, &unit);
break; break;
case RIGHT: case RIGHT:
type = css_computed_padding_right(style, css_computed_padding_right(style, &value,
&value, &unit); &unit);
break; break;
case BOTTOM: case BOTTOM:
type = css_computed_padding_bottom(style, css_computed_padding_bottom(style, &value,
&value, &unit); &unit);
break; break;
case LEFT: case LEFT:
type = css_computed_padding_left(style, css_computed_padding_left(style, &value, &unit);
&value, &unit);
break; break;
} }
@ -1561,7 +1558,6 @@ void layout_find_dimensions(int available_width, int viewport_height,
/* Table cell borders are populated in table.c */ /* Table cell borders are populated in table.c */
if (border && box->type != BOX_TABLE_CELL) { if (border && box->type != BOX_TABLE_CELL) {
enum css_border_width_e wtype;
enum css_border_style_e bstyle = CSS_BORDER_STYLE_NONE; enum css_border_style_e bstyle = CSS_BORDER_STYLE_NONE;
enum css_border_color_e bcolor = enum css_border_color_e bcolor =
CSS_BORDER_COLOR_TRANSPARENT; CSS_BORDER_COLOR_TRANSPARENT;
@ -1571,30 +1567,30 @@ void layout_find_dimensions(int available_width, int viewport_height,
switch (i) { switch (i) {
case TOP: case TOP:
wtype = css_computed_border_top_width(style, css_computed_border_top_width(style, &value,
&value, &unit); &unit);
bstyle = css_computed_border_top_style(style); bstyle = css_computed_border_top_style(style);
bcolor = css_computed_border_top_color(style, bcolor = css_computed_border_top_color(style,
&color); &color);
break; break;
case RIGHT: case RIGHT:
wtype = css_computed_border_right_width(style, css_computed_border_right_width(style, &value,
&value, &unit); &unit);
bstyle = css_computed_border_right_style(style); bstyle = css_computed_border_right_style(style);
bcolor = css_computed_border_right_color(style, bcolor = css_computed_border_right_color(style,
&color); &color);
break; break;
case BOTTOM: case BOTTOM:
wtype = css_computed_border_bottom_width(style, css_computed_border_bottom_width(style, &value,
&value, &unit); &unit);
bstyle = css_computed_border_bottom_style( bstyle = css_computed_border_bottom_style(
style); style);
bcolor = css_computed_border_bottom_color(style, bcolor = css_computed_border_bottom_color(style,
&color); &color);
break; break;
case LEFT: case LEFT:
wtype = css_computed_border_left_width(style, css_computed_border_left_width(style, &value,
&value, &unit); &unit);
bstyle = css_computed_border_left_style(style); bstyle = css_computed_border_left_style(style);
bcolor = css_computed_border_left_color(style, bcolor = css_computed_border_left_color(style,
&color); &color);
@ -3513,6 +3509,9 @@ void layout_minmax_table(struct box *table,
for (cell = row->children; cell; cell = cell->next) { for (cell = row->children; cell; cell = cell->next) {
assert(cell->type == BOX_TABLE_CELL); assert(cell->type == BOX_TABLE_CELL);
assert(cell->style); assert(cell->style);
/** TODO: Handle colspan="0" correctly.
* It's currently converted to 1 in box normaisation */
assert(cell->columns != 0);
if (cell->columns != 1) if (cell->columns != 1)
continue; continue;