Title: [290512] trunk
Revision
290512
Author
[email protected]
Date
2022-02-25 08:44:23 -0800 (Fri, 25 Feb 2022)

Log 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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (290511 => 290512)


--- trunk/LayoutTests/ChangeLog	2022-02-25 16:43:57 UTC (rev 290511)
+++ trunk/LayoutTests/ChangeLog	2022-02-25 16:44:23 UTC (rev 290512)
@@ -1,3 +1,16 @@
+2022-02-25  Alan Bujtas  <[email protected]>
+
+        [Tables] Incorrect table sizing when colgroup comes after tbody
+        https://bugs.webkit.org/show_bug.cgi?id=237205
+        <rdar://86582214>
+
+        Reviewed by Antti Koivisto.
+
+        * 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.
+
 2022-02-25  Youenn Fablet  <[email protected]>
 
         Non-simple CORS preflight fails due to cache-control header

Added: trunk/LayoutTests/fast/table/table-sizing-fails-when-colgroup-comes-after-content-expected.html (0 => 290512)


--- trunk/LayoutTests/fast/table/table-sizing-fails-when-colgroup-comes-after-content-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/table-sizing-fails-when-colgroup-comes-after-content-expected.html	2022-02-25 16:44:23 UTC (rev 290512)
@@ -0,0 +1,25 @@
+<style>
+table {
+  width: 0px;
+  table-layout: fixed;
+  border: solid;
+}
+
+td {
+  width: 50%;
+  overflow: auto;
+}
+</style>
+PASS if the table below is not blank.
+<table>
+<colgroup>
+  <col style="width: 200px;">
+  <col style="width: 200px;">
+</colgroup>
+<tbody>
+  <tr>
+    <td>this text</td>
+    <td>should show</td>
+  </tr>
+</tbody>
+</table>

Added: trunk/LayoutTests/fast/table/table-sizing-fails-when-colgroup-comes-after-content.html (0 => 290512)


--- trunk/LayoutTests/fast/table/table-sizing-fails-when-colgroup-comes-after-content.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/table-sizing-fails-when-colgroup-comes-after-content.html	2022-02-25 16:44:23 UTC (rev 290512)
@@ -0,0 +1,25 @@
+<style>
+table {
+  width: 0px;
+  table-layout: fixed;
+  border: solid;
+}
+
+td {
+  width: 50%;
+  overflow: auto;
+}
+</style>
+PASS if the table below is not blank.
+<table>
+<tbody>
+  <tr>
+    <td>this text</td>
+    <td>should show</td>
+  </tr>
+</tbody>
+<colgroup>
+  <col style="width: 200px;">
+  <col style="width: 200px;">
+</colgroup>
+</table>

Modified: trunk/LayoutTests/platform/ios/tables/mozilla_expected_failures/dom/appendCol1-expected.txt (290511 => 290512)


--- trunk/LayoutTests/platform/ios/tables/mozilla_expected_failures/dom/appendCol1-expected.txt	2022-02-25 16:43:57 UTC (rev 290511)
+++ trunk/LayoutTests/platform/ios/tables/mozilla_expected_failures/dom/appendCol1-expected.txt	2022-02-25 16:44:23 UTC (rev 290512)
@@ -6,15 +6,15 @@
       RenderBlock (anonymous) at (0,0) size 784x20
         RenderText {#text} at (0,0) size 218x19
           text run at (0,0) width 218: "The 2 tables should look the same"
-      RenderTable {TABLE} at (0,20) size 62x30 [bgcolor=#FFA500] [border: (1px outset #808080)]
+      RenderTable {TABLE} at (0,20) size 235x30 [bgcolor=#FFA500] [border: (1px outset #808080)]
         RenderTableCol {COLGROUP} at (0,0) size 0x0
           RenderTableCol {COL} at (0,0) size 0x0
-        RenderTableSection {TBODY} at (1,1) size 60x28
-          RenderTableRow {TR} at (0,2) size 60x24
+        RenderTableSection {TBODY} at (1,1) size 233x28
+          RenderTableRow {TR} at (0,2) size 233x24
             RenderTableCell {TD} at (2,2) size 27x24 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
               RenderText {#text} at (2,2) size 23x19
                 text run at (2,2) width 23: "c11"
-            RenderTableCell {TD} at (30,2) size 28x24 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (30,2) size 201x24 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
               RenderText {#text} at (2,2) size 24x19
                 text run at (2,2) width 24: "c12"
         RenderTableCol at (0,0) size 0x0

Modified: trunk/LayoutTests/platform/ios/tables/mozilla_expected_failures/dom/appendColGroup1-expected.txt (290511 => 290512)


--- trunk/LayoutTests/platform/ios/tables/mozilla_expected_failures/dom/appendColGroup1-expected.txt	2022-02-25 16:43:57 UTC (rev 290511)
+++ trunk/LayoutTests/platform/ios/tables/mozilla_expected_failures/dom/appendColGroup1-expected.txt	2022-02-25 16:44:23 UTC (rev 290512)
@@ -6,18 +6,18 @@
       RenderBlock (anonymous) at (0,0) size 784x20
         RenderText {#text} at (0,0) size 218x19
           text run at (0,0) width 218: "The 2 tables should look the same"
-      RenderTable {TABLE} at (0,20) size 207x30 [bgcolor=#FFA500] [border: (1px outset #808080)]
+      RenderTable {TABLE} at (0,20) size 510x30 [bgcolor=#FFA500] [border: (1px outset #808080)]
         RenderTableCol {COLGROUP} at (0,0) size 0x0
           RenderTableCol {COL} at (0,0) size 0x0
-        RenderTableSection {TBODY} at (1,1) size 205x28
-          RenderTableRow {TR} at (0,2) size 205x24
+        RenderTableSection {TBODY} at (1,1) size 508x28
+          RenderTableRow {TR} at (0,2) size 508x24
             RenderTableCell {TD} at (2,2) size 100x24 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
               RenderText {#text} at (2,2) size 49x19
                 text run at (2,2) width 49: "col-100"
-            RenderTableCell {TD} at (104,2) size 49x24 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (104,2) size 200x24 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
               RenderText {#text} at (2,2) size 45x19
                 text run at (2,2) width 45: "cg-200"
-            RenderTableCell {TD} at (154,2) size 49x24 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
+            RenderTableCell {TD} at (306,2) size 200x24 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
               RenderText {#text} at (2,2) size 45x19
                 text run at (2,2) width 45: "cg-200"
         RenderTableCol {COLGROUP} at (0,0) size 0x0

Modified: trunk/LayoutTests/platform/mac/tables/mozilla_expected_failures/dom/appendCol1-expected.txt (290511 => 290512)


--- trunk/LayoutTests/platform/mac/tables/mozilla_expected_failures/dom/appendCol1-expected.txt	2022-02-25 16:43:57 UTC (rev 290511)
+++ trunk/LayoutTests/platform/mac/tables/mozilla_expected_failures/dom/appendCol1-expected.txt	2022-02-25 16:44:23 UTC (rev 290512)
@@ -6,15 +6,15 @@
       RenderBlock (anonymous) at (0,0) size 784x18
         RenderText {#text} at (0,0) size 218x18
           text run at (0,0) width 218: "The 2 tables should look the same"
-      RenderTable {TABLE} at (0,18) size 62x28 [bgcolor=#FFA500] [border: (1px outset #808080)]
+      RenderTable {TABLE} at (0,18) size 235x28 [bgcolor=#FFA500] [border: (1px outset #808080)]
         RenderTableCol {COLGROUP} at (0,0) size 0x0
           RenderTableCol {COL} at (0,0) size 0x0
-        RenderTableSection {TBODY} at (1,1) size 60x26
-          RenderTableRow {TR} at (0,2) size 60x22
+        RenderTableSection {TBODY} at (1,1) size 233x26
+          RenderTableRow {TR} at (0,2) size 233x22
             RenderTableCell {TD} at (2,2) size 27x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
               RenderText {#text} at (2,2) size 23x18
                 text run at (2,2) width 23: "c11"
-            RenderTableCell {TD} at (30,2) size 28x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (30,2) size 201x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
               RenderText {#text} at (2,2) size 24x18
                 text run at (2,2) width 24: "c12"
         RenderTableCol at (0,0) size 0x0

Modified: trunk/LayoutTests/platform/mac/tables/mozilla_expected_failures/dom/appendColGroup1-expected.txt (290511 => 290512)


--- trunk/LayoutTests/platform/mac/tables/mozilla_expected_failures/dom/appendColGroup1-expected.txt	2022-02-25 16:43:57 UTC (rev 290511)
+++ trunk/LayoutTests/platform/mac/tables/mozilla_expected_failures/dom/appendColGroup1-expected.txt	2022-02-25 16:44:23 UTC (rev 290512)
@@ -6,18 +6,18 @@
       RenderBlock (anonymous) at (0,0) size 784x18
         RenderText {#text} at (0,0) size 218x18
           text run at (0,0) width 218: "The 2 tables should look the same"
-      RenderTable {TABLE} at (0,18) size 207x28 [bgcolor=#FFA500] [border: (1px outset #808080)]
+      RenderTable {TABLE} at (0,18) size 510x28 [bgcolor=#FFA500] [border: (1px outset #808080)]
         RenderTableCol {COLGROUP} at (0,0) size 0x0
           RenderTableCol {COL} at (0,0) size 0x0
-        RenderTableSection {TBODY} at (1,1) size 205x26
-          RenderTableRow {TR} at (0,2) size 205x22
+        RenderTableSection {TBODY} at (1,1) size 508x26
+          RenderTableRow {TR} at (0,2) size 508x22
             RenderTableCell {TD} at (2,2) size 100x22 [border: (1px inset #808080)] [r=0 c=0 rs=1 cs=1]
               RenderText {#text} at (2,2) size 49x18
                 text run at (2,2) width 49: "col-100"
-            RenderTableCell {TD} at (104,2) size 49x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
+            RenderTableCell {TD} at (104,2) size 200x22 [border: (1px inset #808080)] [r=0 c=1 rs=1 cs=1]
               RenderText {#text} at (2,2) size 45x18
                 text run at (2,2) width 45: "cg-200"
-            RenderTableCell {TD} at (154,2) size 49x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
+            RenderTableCell {TD} at (306,2) size 200x22 [border: (1px inset #808080)] [r=0 c=2 rs=1 cs=1]
               RenderText {#text} at (2,2) size 45x18
                 text run at (2,2) width 45: "cg-200"
         RenderTableCol {COLGROUP} at (0,0) size 0x0

Modified: trunk/Source/WebCore/ChangeLog (290511 => 290512)


--- trunk/Source/WebCore/ChangeLog	2022-02-25 16:43:57 UTC (rev 290511)
+++ trunk/Source/WebCore/ChangeLog	2022-02-25 16:44:23 UTC (rev 290512)
@@ -1,3 +1,21 @@
+2022-02-25  Alan Bujtas  <[email protected]>
+
+        [Tables] Incorrect table sizing when colgroup comes after tbody
+        https://bugs.webkit.org/show_bug.cgi?id=237205
+        <rdar://86582214>
+
+        Reviewed by Antti Koivisto.
+
+        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):
+
 2022-02-25  Youenn Fablet  <[email protected]>
 
         Non-simple CORS preflight fails due to cache-control header

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (290511 => 290512)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2022-02-25 16:43:57 UTC (rev 290511)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2022-02-25 16:44:23 UTC (rev 290512)
@@ -926,12 +926,7 @@
     for (auto& child : childrenOfType<RenderObject>(*this)) {
         if (is<RenderTableCol>(child))
             return &const_cast<RenderTableCol&>(downcast<RenderTableCol>(child));
-
-        // We allow only table-captions before columns or column-groups.
-        if (!is<RenderTableCaption>(child))
-            return nullptr;
     }
-
     return nullptr;
 }
 

Modified: trunk/Source/WebCore/rendering/RenderTableCol.cpp (290511 => 290512)


--- trunk/Source/WebCore/rendering/RenderTableCol.cpp	2022-02-25 16:43:57 UTC (rev 290511)
+++ trunk/Source/WebCore/rendering/RenderTableCol.cpp	2022-02-25 16:44:23 UTC (rev 290512)
@@ -182,14 +182,8 @@
     if (!next && is<RenderTableCol>(*parent()))
         next = parent()->nextSibling();
 
-    for (; next && !is<RenderTableCol>(*next); next = next->nextSibling()) {
-        // We allow captions mixed with columns and column-groups.
-        if (is<RenderTableCaption>(*next))
-            continue;
+    for (; next && !is<RenderTableCol>(*next); next = next->nextSibling()) { }
 
-        return nullptr;
-    }
-
     return downcast<RenderTableCol>(next);
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to