Changeset 290512 in webkit


Ignore:
Timestamp:
Feb 25, 2022 8:44:23 AM (5 months ago)
Author:
Alan Bujtas
Message:

[Tables] Incorrect table sizing when colgroup comes after tbody
https://bugs.webkit.org/show_bug.cgi?id=237205
<rdar://86582214>

Reviewed by Antti Koivisto.

Source/WebCore:

Let's use the colgroup for table sizing even when it comes after any thead, tbody, tfoot, and tr elements.
This makes WebKit match other rendering engines (see https://src.chromium.org/viewvc/blink?revision=159442&view=revision)

Test: fast/table/table-sizing-fails-when-colgroup-comes-after-content.html

  • rendering/RenderTable.cpp:

(WebCore::RenderTable::firstColumn const):

  • rendering/RenderTableCol.cpp:

(WebCore::RenderTableCol::nextColumn const):

LayoutTests:

  • fast/table/table-sizing-fails-when-colgroup-comes-after-content-expected.html: Added.
  • fast/table/table-sizing-fails-when-colgroup-comes-after-content.html: Added.
  • platform/mac/tables/mozilla_expected_failures/dom/appendCol1-expected.txt: Progression.
  • platform/mac/tables/mozilla_expected_failures/dom/appendColGroup1-expected.txt: Progression.
Location:
trunk
Files:
2 added
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r290507 r290512  
     12022-02-25  Alan Bujtas  <zalan@apple.com>
     2
     3        [Tables] Incorrect table sizing when colgroup comes after tbody
     4        https://bugs.webkit.org/show_bug.cgi?id=237205
     5        <rdar://86582214>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        * fast/table/table-sizing-fails-when-colgroup-comes-after-content-expected.html: Added.
     10        * fast/table/table-sizing-fails-when-colgroup-comes-after-content.html: Added.
     11        * platform/mac/tables/mozilla_expected_failures/dom/appendCol1-expected.txt: Progression.
     12        * platform/mac/tables/mozilla_expected_failures/dom/appendColGroup1-expected.txt: Progression.
     13
    1142022-02-25  Youenn Fablet  <youenn@apple.com>
    215
  • trunk/LayoutTests/platform/ios/tables/mozilla_expected_failures/dom/appendCol1-expected.txt

    r259296 r290512  
    77        RenderText {#text} at (0,0) size 218x19
    88          text run at (0,0) width 218: "The 2 tables should look the same"
    9       RenderTable {TABLE} at (0,20) size 62x30 [bgcolor=#FFA500] [border: (1px outset #808080)]
     9      RenderTable {TABLE} at (0,20) size 235x30 [bgcolor=#FFA500] [border: (1px outset #808080)]
    1010        RenderTableCol {COLGROUP} at (0,0) size 0x0
    1111          RenderTableCol {COL} at (0,0) size 0x0
    12         RenderTableSection {TBODY} at (1,1) size 60x28
    13           RenderTableRow {TR} at (0,2) size 60x24
     12        RenderTableSection {TBODY} at (1,1) size 233x28
     13          RenderTableRow {TR} at (0,2) size 233x24
    1414            RenderTableCell {TD} at (2,2) size 27x24 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
    1515              RenderText {#text} at (2,2) size 23x19
    1616                text run at (2,2) width 23: "c11"
    17             RenderTableCell {TD} at (30,2) size 28x24 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
     17            RenderTableCell {TD} at (30,2) size 201x24 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
    1818              RenderText {#text} at (2,2) size 24x19
    1919                text run at (2,2) width 24: "c12"
  • trunk/LayoutTests/platform/ios/tables/mozilla_expected_failures/dom/appendColGroup1-expected.txt

    r195740 r290512  
    77        RenderText {#text} at (0,0) size 218x19
    88          text run at (0,0) width 218: "The 2 tables should look the same"
    9       RenderTable {TABLE} at (0,20) size 207x30 [bgcolor=#FFA500] [border: (1px outset #808080)]
     9      RenderTable {TABLE} at (0,20) size 510x30 [bgcolor=#FFA500] [border: (1px outset #808080)]
    1010        RenderTableCol {COLGROUP} at (0,0) size 0x0
    1111          RenderTableCol {COL} at (0,0) size 0x0
    12         RenderTableSection {TBODY} at (1,1) size 205x28
    13           RenderTableRow {TR} at (0,2) size 205x24
     12        RenderTableSection {TBODY} at (1,1) size 508x28
     13          RenderTableRow {TR} at (0,2) size 508x24
    1414            RenderTableCell {TD} at (2,2) size 100x24 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
    1515              RenderText {#text} at (2,2) size 49x19
    1616                text run at (2,2) width 49: "col-100"
    17             RenderTableCell {TD} at (104,2) size 49x24 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
     17            RenderTableCell {TD} at (104,2) size 200x24 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
    1818              RenderText {#text} at (2,2) size 45x19
    1919                text run at (2,2) width 45: "cg-200"
    20             RenderTableCell {TD} at (154,2) size 49x24 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
     20            RenderTableCell {TD} at (306,2) size 200x24 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
    2121              RenderText {#text} at (2,2) size 45x19
    2222                text run at (2,2) width 45: "cg-200"
  • trunk/LayoutTests/platform/mac/tables/mozilla_expected_failures/dom/appendCol1-expected.txt

    r259296 r290512  
    77        RenderText {#text} at (0,0) size 218x18
    88          text run at (0,0) width 218: "The 2 tables should look the same"
    9       RenderTable {TABLE} at (0,18) size 62x28 [bgcolor=#FFA500] [border: (1px outset #808080)]
     9      RenderTable {TABLE} at (0,18) size 235x28 [bgcolor=#FFA500] [border: (1px outset #808080)]
    1010        RenderTableCol {COLGROUP} at (0,0) size 0x0
    1111          RenderTableCol {COL} at (0,0) size 0x0
    12         RenderTableSection {TBODY} at (1,1) size 60x26
    13           RenderTableRow {TR} at (0,2) size 60x22
     12        RenderTableSection {TBODY} at (1,1) size 233x26
     13          RenderTableRow {TR} at (0,2) size 233x22
    1414            RenderTableCell {TD} at (2,2) size 27x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
    1515              RenderText {#text} at (2,2) size 23x18
    1616                text run at (2,2) width 23: "c11"
    17             RenderTableCell {TD} at (30,2) size 28x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
     17            RenderTableCell {TD} at (30,2) size 201x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
    1818              RenderText {#text} at (2,2) size 24x18
    1919                text run at (2,2) width 24: "c12"
  • trunk/LayoutTests/platform/mac/tables/mozilla_expected_failures/dom/appendColGroup1-expected.txt

    r195740 r290512  
    77        RenderText {#text} at (0,0) size 218x18
    88          text run at (0,0) width 218: "The 2 tables should look the same"
    9       RenderTable {TABLE} at (0,18) size 207x28 [bgcolor=#FFA500] [border: (1px outset #808080)]
     9      RenderTable {TABLE} at (0,18) size 510x28 [bgcolor=#FFA500] [border: (1px outset #808080)]
    1010        RenderTableCol {COLGROUP} at (0,0) size 0x0
    1111          RenderTableCol {COL} at (0,0) size 0x0
    12         RenderTableSection {TBODY} at (1,1) size 205x26
    13           RenderTableRow {TR} at (0,2) size 205x22
     12        RenderTableSection {TBODY} at (1,1) size 508x26
     13          RenderTableRow {TR} at (0,2) size 508x22
    1414            RenderTableCell {TD} at (2,2) size 100x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
    1515              RenderText {#text} at (2,2) size 49x18
    1616                text run at (2,2) width 49: "col-100"
    17             RenderTableCell {TD} at (104,2) size 49x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
     17            RenderTableCell {TD} at (104,2) size 200x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
    1818              RenderText {#text} at (2,2) size 45x18
    1919                text run at (2,2) width 45: "cg-200"
    20             RenderTableCell {TD} at (154,2) size 49x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
     20            RenderTableCell {TD} at (306,2) size 200x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
    2121              RenderText {#text} at (2,2) size 45x18
    2222                text run at (2,2) width 45: "cg-200"
  • trunk/Source/WebCore/ChangeLog

    r290507 r290512  
     12022-02-25  Alan Bujtas  <zalan@apple.com>
     2
     3        [Tables] Incorrect table sizing when colgroup comes after tbody
     4        https://bugs.webkit.org/show_bug.cgi?id=237205
     5        <rdar://86582214>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        Let's use the colgroup for table sizing even when it comes after any thead, tbody, tfoot, and tr elements.
     10        This makes WebKit match other rendering engines (see https://src.chromium.org/viewvc/blink?revision=159442&view=revision)
     11
     12        Test: fast/table/table-sizing-fails-when-colgroup-comes-after-content.html
     13
     14        * rendering/RenderTable.cpp:
     15        (WebCore::RenderTable::firstColumn const):
     16        * rendering/RenderTableCol.cpp:
     17        (WebCore::RenderTableCol::nextColumn const):
     18
    1192022-02-25  Youenn Fablet  <youenn@apple.com>
    220
  • trunk/Source/WebCore/rendering/RenderTable.cpp

    r290225 r290512  
    927927        if (is<RenderTableCol>(child))
    928928            return &const_cast<RenderTableCol&>(downcast<RenderTableCol>(child));
    929 
    930         // We allow only table-captions before columns or column-groups.
    931         if (!is<RenderTableCaption>(child))
    932             return nullptr;
    933     }
    934 
     929    }
    935930    return nullptr;
    936931}
  • trunk/Source/WebCore/rendering/RenderTableCol.cpp

    r288069 r290512  
    183183        next = parent()->nextSibling();
    184184
    185     for (; next && !is<RenderTableCol>(*next); next = next->nextSibling()) {
    186         // We allow captions mixed with columns and column-groups.
    187         if (is<RenderTableCaption>(*next))
    188             continue;
    189 
    190         return nullptr;
    191     }
     185    for (; next && !is<RenderTableCol>(*next); next = next->nextSibling()) { }
    192186
    193187    return downcast<RenderTableCol>(next);
Note: See TracChangeset for help on using the changeset viewer.