RESOLVED FIXED 74636
td element ignores zero width/height input element
https://bugs.webkit.org/show_bug.cgi?id=74636
Summary td element ignores zero width/height input element
blahblah676
Reported 2011-12-15 11:36:42 PST
Created attachment 119472 [details] demonstrates the bug If you have an input element with style width=0px and height=0px inside a td element, webkit will give the td element the incorrect size (ignoring the zero width and height). If you inspect the element you'll see that the input element is correctly sized, it is just the td element that has the wrong size. Setting the width and height to 1px fixes the problem. The problem also only occurs with input elements...if you try it with a <P> it works fine. The bug occurs on Chrome and Safari on both OS X and Windows. Firefox and IE work fine. Oh, and please don't tell me I shouldn't be using zero sized inputs...there is a good reason for it.
Attachments
demonstrates the bug (389 bytes, text/html)
2011-12-15 11:36 PST, blahblah676
no flags
Patch (4.62 KB, patch)
2011-12-19 13:36 PST, Florin Malita
no flags
Patch (3.57 KB, patch)
2011-12-20 08:59 PST, Florin Malita
no flags
Florin Malita
Comment 1 2011-12-19 13:33:18 PST
The strict inequality in RenderTextControl::computePreferredLogicalWidths ignores width == 0 attributes and falls back on estimating a default preferred width: if (style()->width().isFixed() && style()->width().value() > 0) m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = computeContentBoxLogicalWidth(style()->width().value()); else { ... The following patch relaxes the test.
Florin Malita
Comment 2 2011-12-19 13:36:05 PST
Kent Tamura
Comment 3 2011-12-19 17:36:57 PST
Comment on attachment 119909 [details] Patch The code change looks good. Can you convert the test to a ref test? http://trac.webkit.org/wiki/Writing%20Reftests
Florin Malita
Comment 4 2011-12-20 07:40:06 PST
(In reply to comment #3) > Can you convert the test to a ref test? > http://trac.webkit.org/wiki/Writing%20Reftests Will do. There's still an off-by-one issue lurking (unless I'm missing some styling interference): the calculated enclosing <td> width seems to be 1. I was planning to investigate that separately, but to get a correct ref test I think I'll have to tackle it upfront.
Florin Malita
Comment 5 2011-12-20 08:22:30 PST
(In reply to comment #4) > There's still an off-by-one issue lurking (unless I'm missing some styling interference): the calculated enclosing <td> width seems to be 1. Tracked it down to AutoTableLayout::recalcColumn(): if (cell->colSpan() == 1) { // A cell originates in this column. Ensure we have // a min/max width of at least 1px for this column now. columnLayout.minLogicalWidth = max<int>(columnLayout.minLogicalWidth, cellHasContent ? 1 : 0); columnLayout.maxLogicalWidth = max<int>(columnLayout.maxLogicalWidth, 1); I can't say that I understand the reason, but it's definitely intentional so I'll leave it alone (unless someone thinks it's wrong). I'll work around it in the ref test.
Florin Malita
Comment 6 2011-12-20 08:59:42 PST
Created attachment 120033 [details] Patch Updated reftest.
Kent Tamura
Comment 7 2011-12-20 16:53:15 PST
Comment on attachment 120033 [details] Patch Looks good.
WebKit Review Bot
Comment 8 2011-12-20 17:41:28 PST
Comment on attachment 120033 [details] Patch Clearing flags on attachment: 120033 Committed r103377: <http://trac.webkit.org/changeset/103377>
WebKit Review Bot
Comment 9 2011-12-20 17:41:32 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.