diff options
-rw-r--r-- | ChangeLog | 1 | ||||
-rw-r--r-- | src/table.cc | 19 | ||||
-rw-r--r-- | test/html/Makefile.am | 1 |
3 files changed, 15 insertions, 6 deletions
@@ -58,6 +58,7 @@ dillo-3.1 [not released yet] scroll_switches_tabs to disable the behavior. - Fix OpenSSL handling of unexpected EOF without close notify alert. - Expand home tilde '~' in the file plugin. + - Ignore width attribute with relative values for td and th elements. Patches: Rodrigo Arias Mallo <rodarima@gmail.com> ----------------------------------------------------------------------------- diff --git a/src/table.cc b/src/table.cc index 859b1063..1268fbd9 100644 --- a/src/table.cc +++ b/src/table.cc @@ -2,6 +2,7 @@ * File: table.cc * * Copyright 2008 Jorge Arellano Cid <jcid@dillo.org> + * Copyright 2024 Rodrigo Arias Mallo <rodarima@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -414,9 +415,17 @@ static void Html_tag_open_table_cell(DilloHtml *html, a_Html_tag_set_align_attr (html, tag, tagsize); if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "width"))) { - html->styleEngine->setNonCssHint (CSS_PROPERTY_WIDTH, - CSS_TYPE_LENGTH_PERCENTAGE, - a_Html_parse_length (html, attrbuf)); + CssLength l = a_Html_parse_length (html, attrbuf); + /* Only apply the width if the width is given in pixels, + * otherwise the percent value is applied to the size of the + * cell instead of to the table available width */ + if (CSS_LENGTH_TYPE(l) == CSS_LENGTH_TYPE_PX) { + html->styleEngine->setNonCssHint (CSS_PROPERTY_WIDTH, + CSS_TYPE_LENGTH, l); + } else { + /* TODO: Support relative sizes for HTML 4.01 pages in + * transitional mode */ + } if (html->DocType == DT_HTML && html->DocTypeVersion >= 5.0f) BUG_MSG("<t%c> width attribute is obsolete.", (tagsize >=3 && (D_ASCII_TOLOWER(tag[2]) == 'd')) ? 'd' : 'h'); @@ -433,7 +442,7 @@ static void Html_tag_open_table_cell(DilloHtml *html, BUG_MSG("<t%c> bgcolor attribute is obsolete.", (tagsize >=3 && (D_ASCII_TOLOWER(tag[2]) == 'd')) ? 'd' : 'h'); } - + break; default: /* compiler happiness */ break; @@ -457,7 +466,7 @@ static void Html_tag_content_table_cell(DilloHtml *html, BUG_MSG("<t%c> outside <tr>.", (tagsize >=3 && (D_ASCII_TOLOWER(tag[2]) == 'd')) ? 'd' : 'h'); /* a_Dw_table_add_cell takes care that dillo does not crash. */ - /* continues */ + /* fallthrough */ case DILLO_HTML_TABLE_MODE_TR: case DILLO_HTML_TABLE_MODE_TD: if ((attrbuf = a_Html_get_attr(html, tag, tagsize, "colspan"))) { diff --git a/test/html/Makefile.am b/test/html/Makefile.am index a6d9d4cf..28548f83 100644 --- a/test/html/Makefile.am +++ b/test/html/Makefile.am @@ -32,5 +32,4 @@ XFAIL_TESTS = \ render/max-width-html.html \ render/min-width-html.html \ render/span-padding.html \ - render/table-td-width-percent-img.html \ render/table-td-width-percent.html |