haikuwebkit/LayoutTests/fast/layoutformattingcontext/table-fixed-width-with-max-...

31 lines
1.7 KiB
Plaintext
Raw Permalink Normal View History

[LFC][TFC] Add support for cases when the balancing is not based on the initial width https://bugs.webkit.org/show_bug.cgi?id=211878 Reviewed by Antti Koivisto. Source/WebCore: This patch adds support for the cases when the table stretches all the way to the maximum content size, and we still choose the minimum width as the initial width and the maximum width as the base for balancing the extra space. Consider the following 2 tables: <table> <tr><td style="width: 20px"></td><td>some long long long content</td></tr> <tr><td style="width: 20px"></td><td>22px width content</td></tr> </table> <table> <tr><td style="width: 20px"></td><td>some long long long content</td></tr> <tr><td style="width: 20px"></td><td id=fixed_width style="width: 22px;">22px width content</td></tr> </table> These tables have the same maximum widths and they both stretch to that size. However the second table will end up with a wider first and narrower second column because of the width property on the [fixed_width] cell. While the first table applies the maximum width for each columns, the second table uses the minimum width as the initial width and balances the extra space using the maximum width (as the distribution ratio). This produces a very different layout where the first table has no line wrapping, while the second table wraps the "some long long long content" text (even though the used max widths are the same for each cells). Test: fast/layoutformattingcontext/table-fixed-width-with-max-distribution.html * layout/tableformatting/TableFormattingContext.cpp: (WebCore::Layout::ColumnSpan::spacing): (WebCore::Layout::RowSpan::spacing): (WebCore::Layout::distributeAvailableSpace): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraHorizontalSpace): (WebCore::Layout::TableFormattingContext::computeAndDistributeExtraVerticalSpace): LayoutTests: * fast/layoutformattingcontext/table-fixed-width-with-max-distribution-expected.txt: Added. * fast/layoutformattingcontext/table-fixed-width-with-max-distribution.html: Added. Canonical link: https://commits.webkit.org/224773@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@261676 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-05-14 05:03:14 +00:00
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x263
RenderBlock {HTML} at (0,0) size 800x263
RenderBody {BODY} at (8,8) size 784x247
RenderTable {TABLE} at (0,0) size 153x130 [border: (10px solid #008000)]
RenderTableSection {TBODY} at (40,40) size 73x50
RenderTableRow {TR} at (0,0) size 73x28
RenderTableCell {TD} at (0,13) size 33x2 [r=0 c=0 rs=1 cs=1]
RenderTableCell {TD} at (32,0) size 41x28 [r=0 c=1 rs=1 cs=1]
RenderText {#text} at (1,1) size 23x26
text run at (1,1) width 23: "iiiiiiii"
text run at (1,14) width 23: "iiiiiiii"
RenderTableRow {TR} at (0,28) size 73x22
RenderTableCell {TD} at (0,38) size 33x2 [r=1 c=0 rs=1 cs=1]
RenderTableCell {TD} at (32,31) size 41x16 [r=1 c=1 rs=1 cs=1]
RenderText {#text} at (1,1) size 23x14
text run at (1,2) width 23: "iiiiiiii"
RenderTable {TABLE} at (0,130) size 153x117 [border: (10px solid #008000)]
RenderTableSection {TBODY} at (40,40) size 73x37
RenderTableRow {TR} at (0,0) size 73x15
RenderTableCell {TD} at (0,6) size 24x3 [r=0 c=0 rs=1 cs=1]
RenderTableCell {TD} at (24,0) size 49x15 [r=0 c=1 rs=1 cs=1]
RenderText {#text} at (1,1) size 47x13
text run at (1,1) width 47: "iiiiiiii iiiiiiii"
RenderTableRow {TR} at (0,15) size 73x22
RenderTableCell {TD} at (0,25) size 24x2 [r=1 c=0 rs=1 cs=1]
RenderTableCell {TD} at (24,18) size 49x16 [r=1 c=1 rs=1 cs=1]
RenderText {#text} at (1,1) size 23x14
text run at (1,2) width 23: "iiiiiiii"