RESOLVED FIXED 77028
Specified width CSS tables should not include border and padding as part of that width.
https://bugs.webkit.org/show_bug.cgi?id=77028
Summary Specified width CSS tables should not include border and padding as part of t...
Max Vujovic
Reported 2012-01-25 10:52:01 PST
Created attachment 123973 [details] Reproduction In the attached reproduction, the div with display: table (a CSS table) should be 400px wide, which is 50% of its 800px wide parent div. In FF and Opera, the CSS table is 400px wide. In WebKit, it is only 200px wide because the CSS table's 200px padding is included in the CSS table's percent width.
Attachments
Reproduction (328 bytes, text/html)
2012-01-25 10:52 PST, Max Vujovic
no flags
Screenshot (71.22 KB, image/png)
2012-01-25 10:53 PST, Max Vujovic
no flags
Patch (20.88 KB, text/plain)
2012-10-29 03:35 PDT, Arpita Bahuguna
no flags
Patch (22.63 KB, patch)
2012-10-30 00:38 PDT, Arpita Bahuguna
no flags
Patch (24.48 KB, patch)
2012-11-03 05:27 PDT, Arpita Bahuguna
no flags
Patch (26.00 KB, text/plain)
2012-11-06 03:09 PST, Arpita Bahuguna
no flags
Patch (26.07 KB, patch)
2012-11-06 03:42 PST, Arpita Bahuguna
no flags
Patch (25.39 KB, patch)
2012-11-07 02:50 PST, Arpita Bahuguna
no flags
Patch (24.09 KB, patch)
2012-11-08 06:07 PST, Arpita Bahuguna
no flags
Patch (24.88 KB, patch)
2012-11-09 00:30 PST, Arpita Bahuguna
no flags
Max Vujovic
Comment 1 2012-01-25 10:53:15 PST
Created attachment 123974 [details] Screenshot Adding a screenshot with renderings from WebKit on top, Opera in the middle, and FF on bottom.
Arpita Bahuguna
Comment 2 2012-10-29 03:35:57 PDT
Arpita Bahuguna
Comment 3 2012-10-30 00:38:44 PDT
Julien Chaffraix
Comment 4 2012-11-02 02:17:55 PDT
Comment on attachment 171381 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=171381&action=review > Source/WebCore/rendering/RenderTable.cpp:321 > + if (isCSSTable && (styleLogicalWidth.isFixed() || styleLogicalWidth.isPercent()) && styleLogicalWidth.isPositive()) { Shouldn't *any* specified width be handled in this way? This will fix the issue for percent but other values still have the issue (e.g. viewport relative length). We should fix all cases at once by using styleLogicalWidth.isSpecified() instead of just patching our way around. > LayoutTests/fast/table/css-table-width-with-border-padding.html:43 > + </div> This should probably be a check-layout.js (the upside is that it would run faster). > LayoutTests/fast/table/css-table-width-with-border-padding.html:46 > +</html> It would be nice to have some checks against box-sizing values as part of this too. That makes sure we don't break it (which I don't think you do).
Arpita Bahuguna
Comment 5 2012-11-03 05:27:26 PDT
Arpita Bahuguna
Comment 6 2012-11-03 06:05:54 PDT
(In reply to comment #4) > (From update of attachment 171381 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=171381&action=review > Thanks for the review Julien. Have uploaded another patch with the changes. > > Source/WebCore/rendering/RenderTable.cpp:321 > > + if (isCSSTable && (styleLogicalWidth.isFixed() || styleLogicalWidth.isPercent()) && styleLogicalWidth.isPositive()) { > > Shouldn't *any* specified width be handled in this way? This will fix the issue for percent but other values still have the issue (e.g. viewport relative length). > > We should fix all cases at once by using styleLogicalWidth.isSpecified() instead of just patching our way around. > Yes, the check should indeed be for all specified values. Have made the change. > > LayoutTests/fast/table/css-table-width-with-border-padding.html:43 > > + </div> > > This should probably be a check-layout.js (the upside is that it would run faster). > Done. > > LayoutTests/fast/table/css-table-width-with-border-padding.html:46 > > +</html> > > It would be nice to have some checks against box-sizing values as part of this too. That makes sure we don't break it (which I don't think you do). Done.
Arpita Bahuguna
Comment 7 2012-11-06 03:09:16 PST
Arpita Bahuguna
Comment 8 2012-11-06 03:26:57 PST
Patch with modified layout test for verifying viewport relative widths as well.
Arpita Bahuguna
Comment 9 2012-11-06 03:42:31 PST
WebKit Review Bot
Comment 10 2012-11-06 08:39:52 PST
Comment on attachment 172544 [details] Patch Attachment 172544 [details] did not pass chromium-ews (chromium-xvfb): Output: http://queues.webkit.org/results/14728860 New failing tests: fast/table/css-table-width-with-border-padding.html
Build Bot
Comment 11 2012-11-06 11:40:20 PST
Comment on attachment 172544 [details] Patch Attachment 172544 [details] did not pass mac-ews (mac): Output: http://queues.webkit.org/results/14744471 New failing tests: fast/table/css-table-width-with-border-padding.html
Arpita Bahuguna
Comment 12 2012-11-07 02:50:20 PST
Arpita Bahuguna
Comment 13 2012-11-07 03:42:33 PST
Comment on attachment 172747 [details] Patch Changed the layout test using check-layout.js to a ref test since verifying the behavior with viewport relative width made the test platform specific.
Arpita Bahuguna
Comment 14 2012-11-08 06:07:04 PST
Arpita Bahuguna
Comment 15 2012-11-08 17:10:08 PST
Comment on attachment 173029 [details] Patch DRT does force set the width of our viewport to 800 across all platforms. Thus reverting the layout test to use check-layout.js again.
Julien Chaffraix
Comment 16 2012-11-08 17:38:01 PST
Comment on attachment 173029 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=173029&action=review I don't need to see the updated patch. > Source/WebCore/ChangeLog:12 > + This was already handled for fixed width CSS tables but not for percent > + width tables. The ChangeLog seems stale as you handle any specified length. Also please rename the bug to cover the extended use case (which includes updating the tests). > LayoutTests/fast/table/css-table-width-with-border-padding.html:86 > + <!-- For box-sizing: padding-box (not supported) --> You should probably mention that the results as checking in are wrong: because we don't support box-sizing: padding-box, the results are 100px longer. You could also check in the expected result. I don't feel strongly about the 2 options (which are equivalent). Filing a bug or commenting on the box-sizing: padding-box change is important in both cases.
Arpita Bahuguna
Comment 17 2012-11-08 22:12:14 PST
Updating bug title.
Arpita Bahuguna
Comment 18 2012-11-09 00:30:44 PST
WebKit Review Bot
Comment 19 2012-11-12 11:21:00 PST
Comment on attachment 173225 [details] Patch Clearing flags on attachment: 173225 Committed r134265: <http://trac.webkit.org/changeset/134265>
WebKit Review Bot
Comment 20 2012-11-12 11:21:05 PST
All reviewed patches have been landed. Closing bug.
Nir Eitan
Comment 21 2013-09-29 02:42:13 PDT
Hi, I still encounter the exact same issue. Using Safari 6.0.5 (8536.30.1). Maybe something broke this behavior again?
Note You need to log in before you can comment on or make changes to this bug.