Bug 77028 - Specified width CSS tables should not include border and padding as part of that width.
Summary: Specified width CSS tables should not include border and padding as part of t...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Tables (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Arpita Bahuguna
URL:
Keywords: WebExposed
Depends on:
Blocks:
 
Reported: 2012-01-25 10:52 PST by Max Vujovic
Modified: 2013-09-29 02:42 PDT (History)
9 users (show)

See Also:


Attachments
Reproduction (328 bytes, text/html)
2012-01-25 10:52 PST, Max Vujovic
no flags Details
Screenshot (71.22 KB, image/png)
2012-01-25 10:53 PST, Max Vujovic
no flags Details
Patch (20.88 KB, text/plain)
2012-10-29 03:35 PDT, Arpita Bahuguna
no flags Details
Patch (22.63 KB, patch)
2012-10-30 00:38 PDT, Arpita Bahuguna
no flags Details | Formatted Diff | Diff
Patch (24.48 KB, patch)
2012-11-03 05:27 PDT, Arpita Bahuguna
no flags Details | Formatted Diff | Diff
Patch (26.00 KB, text/plain)
2012-11-06 03:09 PST, Arpita Bahuguna
no flags Details
Patch (26.07 KB, patch)
2012-11-06 03:42 PST, Arpita Bahuguna
no flags Details | Formatted Diff | Diff
Patch (25.39 KB, patch)
2012-11-07 02:50 PST, Arpita Bahuguna
no flags Details | Formatted Diff | Diff
Patch (24.09 KB, patch)
2012-11-08 06:07 PST, Arpita Bahuguna
no flags Details | Formatted Diff | Diff
Patch (24.88 KB, patch)
2012-11-09 00:30 PST, Arpita Bahuguna
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Max Vujovic 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.
Comment 1 Max Vujovic 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.
Comment 2 Arpita Bahuguna 2012-10-29 03:35:57 PDT
Created attachment 171193 [details]
Patch
Comment 3 Arpita Bahuguna 2012-10-30 00:38:44 PDT
Created attachment 171381 [details]
Patch
Comment 4 Julien Chaffraix 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).
Comment 5 Arpita Bahuguna 2012-11-03 05:27:26 PDT
Created attachment 172220 [details]
Patch
Comment 6 Arpita Bahuguna 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.
Comment 7 Arpita Bahuguna 2012-11-06 03:09:16 PST
Created attachment 172538 [details]
Patch
Comment 8 Arpita Bahuguna 2012-11-06 03:26:57 PST
Patch with modified layout test for verifying viewport relative widths as well.
Comment 9 Arpita Bahuguna 2012-11-06 03:42:31 PST
Created attachment 172544 [details]
Patch
Comment 10 WebKit Review Bot 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
Comment 11 Build Bot 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
Comment 12 Arpita Bahuguna 2012-11-07 02:50:20 PST
Created attachment 172747 [details]
Patch
Comment 13 Arpita Bahuguna 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.
Comment 14 Arpita Bahuguna 2012-11-08 06:07:04 PST
Created attachment 173029 [details]
Patch
Comment 15 Arpita Bahuguna 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.
Comment 16 Julien Chaffraix 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.
Comment 17 Arpita Bahuguna 2012-11-08 22:12:14 PST
Updating bug title.
Comment 18 Arpita Bahuguna 2012-11-09 00:30:44 PST
Created attachment 173225 [details]
Patch
Comment 19 WebKit Review Bot 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>
Comment 20 WebKit Review Bot 2012-11-12 11:21:05 PST
All reviewed patches have been landed.  Closing bug.
Comment 21 Nir Eitan 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?