Source/WebCore: Add support for fixed and percent min-width on the table element...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Feb 2012 19:38:23 +0000 (19:38 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 1 Feb 2012 19:38:23 +0000 (19:38 +0000)
commit3027d5e57048e33df31f14a3078628f3f61488b8
tree36b9137c8edfd5704008b6204bf03e31a7cec456
parent5fa4d5037876197c59eeef15749cd6fd8dd092ee
Source/WebCore: Add support for fixed and percent min-width on the table element for table-layout: auto to
match Firefox and Opera's behavior.

In FixedTableLayout.cpp, the computePreferredLogicalWidths method looks like it has
issues based on the comment: "FIXME: This entire calculation is incorrect for both
minwidth and maxwidth." (minwidth and maxwidth refer to the preferred widths, not the
min-width and max-width styles). I have not implemented min-width for FixedTableLayout
in this patch since it requires some more research around that comment.

min-width and max-width on the table element was discussed on the www-style list:
http://lists.w3.org/Archives/Public/www-style/2012Jan/0684.html

min-width is not implemented on <table> for table-layout: auto
https://bugs.webkit.org/show_bug.cgi?id=76553

Patch by Max Vujovic <mvujovic@adobe.com> on 2012-02-01
Reviewed by Julien Chaffraix.

Test: fast/table/min-width.html

* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::computePreferredLogicalWidths):

    If the min or max preferred logical width is less than a fixed min width style, it is
    set to the fixed min width style. Like a percent width style, a percent min-width style
    does not affect the min or max preferred logical widths computed by the table layout
    algorithm. RenderTable's computeLogicalWidth method handles percent min-width styles.

    min-width for the table-layout: fixed case has been split out into this bug:
    https://bugs.webkit.org/show_bug.cgi?id=76948

* rendering/RenderTable.cpp:
(WebCore::RenderTable::computeLogicalWidth):

    If the RenderStyle's logical min width is defined and greater than the logical width
    calculation, this method sets the logical width to the logical min width.

(WebCore::RenderTable::convertStyleWidthToComputedWidth):

    This new method generalizes and factors out logic from RenderTable::computeLogicalWidth
    that converted the width style to a computed value in the fixed and percent case.
    RenderTable::computeLogicalWidth now calls this method to determine the computed values
    for both the width style and the min-width style. In the future, it can also be used for
    the max-width style.

    Note that this method handles the special CSS table case, which requires borders and
    paddings to be included in the computed width calculation. This applies to all width
    styles, including width, min-width, and max-width. Before, this special case was handled
    in RenderTable::computeLogicalWidth.

* rendering/RenderTable.h:

LayoutTests: Add support for min-width on the table element.

min-width is not implemented on <table> for table-layout: auto
https://bugs.webkit.org/show_bug.cgi?id=76553

Patch by Max Vujovic <mvujovic@adobe.com> on 2012-02-01
Reviewed by Julien Chaffraix.

* fast/table/min-width-css-block-table.html: Added.
* fast/table/min-width-css-block-table-expected.txt: Added.
* fast/table/min-width-css-inline-table.html: Added.
* fast/table/min-width-css-inline-table-expected.txt: Added.
* fast/table/min-width-html-block-table.html: Added.
* fast/table/min-width-html-block-table-expected.txt: Added.
* fast/table/min-width-html-inline-table.html: Added.
* fast/table/min-width-html-inline-table-expected.txt: Added.
* fast/table/script-tests/min-width-css-block-table.js: Added.
(computeLogicalWidth):
* fast/table/script-tests/min-width-css-inline-table.js: Added.
(computeLogicalWidth):
* fast/table/script-tests/min-width-helpers.js: Added.
(runTests):
(createTableStyle):
(computeLogicalWidthHelper):
(createSpan):
* fast/table/script-tests/min-width-html-block-table.js: Added.
(computeLogicalWidth):
* fast/table/script-tests/min-width-html-inline-table.js: Added.
(computeLogicalWidth):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@106479 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/table/min-width-css-block-table-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/min-width-css-block-table.html [new file with mode: 0644]
LayoutTests/fast/table/min-width-css-inline-table-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/min-width-css-inline-table.html [new file with mode: 0644]
LayoutTests/fast/table/min-width-html-block-table-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/min-width-html-block-table.html [new file with mode: 0644]
LayoutTests/fast/table/min-width-html-inline-table-expected.txt [new file with mode: 0644]
LayoutTests/fast/table/min-width-html-inline-table.html [new file with mode: 0644]
LayoutTests/fast/table/resources/min-width.css [new file with mode: 0644]
LayoutTests/fast/table/script-tests/min-width-css-block-table.js [new file with mode: 0644]
LayoutTests/fast/table/script-tests/min-width-css-inline-table.js [new file with mode: 0644]
LayoutTests/fast/table/script-tests/min-width-helpers.js [new file with mode: 0644]
LayoutTests/fast/table/script-tests/min-width-html-block-table.js [new file with mode: 0644]
LayoutTests/fast/table/script-tests/min-width-html-inline-table.js [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/rendering/AutoTableLayout.cpp
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTable.h