Title: [107971] trunk
Revision
107971
Author
[email protected]
Date
2012-02-16 12:50:08 -0800 (Thu, 16 Feb 2012)

Log Message

thead in table without tbody causes table height doubling
https://bugs.webkit.org/show_bug.cgi?id=37244

Reviewed by Ojan Vafai.

Source/WebCore: 

Tests: fast/table/double-height-table-no-tbody-expected.html
       fast/table/double-height-table-no-tbody.html

The bug is caused by the layout code would wrongly assuming that a
table without a <tbody> is an empty table. We would set the logical
height to the style's logical height wrongly before inflating the
logical height to account for the section(s). This would cause us
to increase past our needed size thus the bug.

* rendering/RenderTable.cpp:
(WebCore::RenderTable::layout):
A table is empty if it does not have any top section, not just a <tbody>.
The test uncovered an issue with height distribution in layoutRows where we
would distribute the extra height to the first <tbody> not section.

LayoutTests: 

* fast/table/double-height-table-no-tbody-expected.html: Added.
* fast/table/double-height-table-no-tbody.html: Added.
Test that we properly lay out tables with only a <thead> or <tfoot>
exactly like a table with only a <tbody>.

* platform/chromium-linux/tables/mozilla/bugs/bug27038-1-expected.png:
* platform/chromium-linux/tables/mozilla/bugs/bug27038-2-expected.png:
* platform/chromium-win/tables/mozilla/bugs/bug27038-1-expected.txt:
* platform/chromium-win/tables/mozilla/bugs/bug27038-2-expected.txt:
This is neither a progression nor a regression. We are not doing the right
thing as we don't distribute the extra logical height evenly over our sections.
Now we give the extra height to the <thead> (first section) instead of the <tbody>.

* platform/chromium/test_expectations.txt:
* platform/efl/test_expectations.txt:
* platform/gtk/test_expectations.txt:
* platform/mac/test_expectations.txt:
* platform/qt/test_expectations.txt:
* platform/win/test_expectations.txt:
Marked the previous tests as needing a new baseline.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (107970 => 107971)


--- trunk/LayoutTests/ChangeLog	2012-02-16 20:40:20 UTC (rev 107970)
+++ trunk/LayoutTests/ChangeLog	2012-02-16 20:50:08 UTC (rev 107971)
@@ -1,3 +1,31 @@
+2012-02-16  Julien Chaffraix  <[email protected]>
+
+        thead in table without tbody causes table height doubling
+        https://bugs.webkit.org/show_bug.cgi?id=37244
+
+        Reviewed by Ojan Vafai.
+
+        * fast/table/double-height-table-no-tbody-expected.html: Added.
+        * fast/table/double-height-table-no-tbody.html: Added.
+        Test that we properly lay out tables with only a <thead> or <tfoot>
+        exactly like a table with only a <tbody>.
+
+        * platform/chromium-linux/tables/mozilla/bugs/bug27038-1-expected.png:
+        * platform/chromium-linux/tables/mozilla/bugs/bug27038-2-expected.png:
+        * platform/chromium-win/tables/mozilla/bugs/bug27038-1-expected.txt:
+        * platform/chromium-win/tables/mozilla/bugs/bug27038-2-expected.txt:
+        This is neither a progression nor a regression. We are not doing the right
+        thing as we don't distribute the extra logical height evenly over our sections.
+        Now we give the extra height to the <thead> (first section) instead of the <tbody>.
+
+        * platform/chromium/test_expectations.txt:
+        * platform/efl/test_expectations.txt:
+        * platform/gtk/test_expectations.txt:
+        * platform/mac/test_expectations.txt:
+        * platform/qt/test_expectations.txt:
+        * platform/win/test_expectations.txt:
+        Marked the previous tests as needing a new baseline.
+
 2012-02-07  Robert Hogan  <[email protected]>
 
         CSS 2.1 failure: fixed-table-layout-013 and fixed-table-layout-015 fail

Added: trunk/LayoutTests/fast/table/double-height-table-no-tbody-expected.html (0 => 107971)


--- trunk/LayoutTests/fast/table/double-height-table-no-tbody-expected.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/double-height-table-no-tbody-expected.html	2012-02-16 20:50:08 UTC (rev 107971)
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+    body { font-size: 13px; font-family: serif; }
+    table { border: 1px solid red; border-spacing: 0px; padding: 0px; }
+    th { border: 1px solid red; width: 125px; }
+    .height20px { height: 20px; }
+    .height19px { height: 19px; }
+    .smallerFont { font-size: 10px; }
+</style>
+</head>
+<body>
+<p>Bug <a href="" thead in table without tbody causes table height doubling</p>
+<p>There should not be any gap between the tables' border and the rows'.</p>
+<h1>height = 20px</h1>
+<table class="height20px">
+<tbody>
+<tr>
+    <th>A</th>
+    <th>B</th>
+    <th>C</th>
+    <th>D</th>
+</tr>
+</tbody>
+</table>
+<br>
+<table class="height20px">
+<tbody>
+<tr>
+    <th>A</th>
+    <th>B</th>
+    <th>C</th>
+    <th>D</th>
+</tr>
+</tbody>
+</table>
+
+<h1>height = 19px, font-size = 10px</h1>
+<table class="height19px smallerFont">
+<tbody>
+<tr>
+    <th>A</th>
+    <th>B</th>
+    <th>C</th>
+    <th>D</th>
+</tr>
+</tbody>
+</table>
+<br>
+<table class="height19px smallerFont">
+<tbody>
+<tr>
+    <th>A</th>
+    <th>B</th>
+    <th>C</th>
+    <th>D</th>
+</tr>
+</tbody>
+</table>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/table/double-height-table-no-tbody-expected.html
___________________________________________________________________

Added: svn:eol-style

Added: trunk/LayoutTests/fast/table/double-height-table-no-tbody.html (0 => 107971)


--- trunk/LayoutTests/fast/table/double-height-table-no-tbody.html	                        (rev 0)
+++ trunk/LayoutTests/fast/table/double-height-table-no-tbody.html	2012-02-16 20:50:08 UTC (rev 107971)
@@ -0,0 +1,63 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+    body { font-size: 13px; font-family: serif; }
+    table { border: 1px solid red; border-spacing: 0px; padding: 0px; }
+    th { border: 1px solid red; width: 125px; }
+    .height20px { height: 20px; }
+    .height19px { height: 19px; }
+    .smallerFont { font-size: 10px; }
+</style>
+</head>
+<body>
+<p>Bug <a href="" thead in table without tbody causes table height doubling</p>
+<p>There should not be any gap between the tables' border and the rows'.</p>
+<h1>height = 20px</h1>
+<table class="height20px">
+<thead>
+<tr>
+    <th>A</th>
+    <th>B</th>
+    <th>C</th>
+    <th>D</th>
+</tr>
+</thead>
+</table>
+<br>
+<table class="height20px">
+<tfoot>
+<tr>
+    <th>A</th>
+    <th>B</th>
+    <th>C</th>
+    <th>D</th>
+</tr>
+</tfoot>
+</table>
+
+<h1>height = 19px, font-size = 10px</h1>
+<table class="height19px smallerFont">
+<thead>
+<tr>
+    <th>A</th>
+    <th>B</th>
+    <th>C</th>
+    <th>D</th>
+</tr>
+</thead>
+</table>
+<br>
+<table class="height19px smallerFont">
+<tfoot>
+<tr>
+    <th>A</th>
+    <th>B</th>
+    <th>C</th>
+    <th>D</th>
+</tr>
+</tfoot>
+</table>
+
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/table/double-height-table-no-tbody.html
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/LayoutTests/platform/chromium/test_expectations.txt (107970 => 107971)


--- trunk/LayoutTests/platform/chromium/test_expectations.txt	2012-02-16 20:40:20 UTC (rev 107970)
+++ trunk/LayoutTests/platform/chromium/test_expectations.txt	2012-02-16 20:50:08 UTC (rev 107971)
@@ -4239,3 +4239,7 @@
 
 // Started failing http://trac.webkit.org/log/?verbose=on&rev=107837&stop_rev=107836
 BUGWK78755 : compositing/culling/scrolled-within-boxshadow.html = IMAGE
+
+// Need rebaselining.
+BUGWK37244 WIN MAC : tables/mozilla/bugs/bug27038-1.html = IMAGE+TEXT
+BUGWK37244 WIN MAC : tables/mozilla/bugs/bug27038-2.html = IMAGE+TEXT

Modified: trunk/LayoutTests/platform/chromium-linux/tables/mozilla/bugs/bug27038-1-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-linux/tables/mozilla/bugs/bug27038-2-expected.png


(Binary files differ)

Modified: trunk/LayoutTests/platform/chromium-win/tables/mozilla/bugs/bug27038-1-expected.txt (107970 => 107971)


--- trunk/LayoutTests/platform/chromium-win/tables/mozilla/bugs/bug27038-1-expected.txt	2012-02-16 20:40:20 UTC (rev 107970)
+++ trunk/LayoutTests/platform/chromium-win/tables/mozilla/bugs/bug27038-1-expected.txt	2012-02-16 20:50:08 UTC (rev 107971)
@@ -4,9 +4,9 @@
   RenderBlock {HTML} at (0,0) size 800x600
     RenderBody {BODY} at (8,8) size 784x584
       RenderTable {TABLE} at (0,0) size 61x584
-        RenderTableSection {THEAD} at (0,0) size 61x26
-          RenderTableRow {TR} at (0,2) size 61x22
-            RenderTableCell {TD} at (2,2) size 57x22 [r=0 c=0 rs=1 cs=1]
+        RenderTableSection {THEAD} at (0,0) size 61x532
+          RenderTableRow {TR} at (0,2) size 61x528
+            RenderTableCell {TD} at (2,255) size 57x22 [r=0 c=0 rs=1 cs=1]
               RenderText {#text} at (1,1) size 55x19
                 text run at (1,1) width 55: "THEAD"
         RenderTableSection {TFOOT} at (0,558) size 61x26
@@ -14,8 +14,8 @@
             RenderTableCell {TD} at (2,2) size 57x22 [r=0 c=0 rs=1 cs=1]
               RenderText {#text} at (1,1) size 53x19
                 text run at (1,1) width 53: "TFOOT"
-        RenderTableSection {TBODY} at (0,26) size 61x532
-          RenderTableRow {TR} at (0,2) size 61x528
-            RenderTableCell {TD} at (2,255) size 57x22 [r=0 c=0 rs=1 cs=1]
+        RenderTableSection {TBODY} at (0,532) size 61x26
+          RenderTableRow {TR} at (0,2) size 61x22
+            RenderTableCell {TD} at (2,2) size 57x22 [r=0 c=0 rs=1 cs=1]
               RenderText {#text} at (1,1) size 53x19
                 text run at (1,1) width 53: "TBODY"

Modified: trunk/LayoutTests/platform/chromium-win/tables/mozilla/bugs/bug27038-2-expected.txt (107970 => 107971)


--- trunk/LayoutTests/platform/chromium-win/tables/mozilla/bugs/bug27038-2-expected.txt	2012-02-16 20:40:20 UTC (rev 107970)
+++ trunk/LayoutTests/platform/chromium-win/tables/mozilla/bugs/bug27038-2-expected.txt	2012-02-16 20:50:08 UTC (rev 107971)
@@ -27,9 +27,9 @@
         RenderText {#text} at (0,0) size 246x19
           text run at (0,0) width 246: "TABLE 2 - with 'height' style on TABLE"
       RenderTable {TABLE} at (0,182) size 65x584 [border: (3px solid #000000)]
-        RenderTableSection {THEAD} at (3,3) size 59x26
-          RenderTableRow {TR} at (0,2) size 59x22
-            RenderTableCell {TD} at (2,2) size 55x22 [r=0 c=0 rs=1 cs=1]
+        RenderTableSection {THEAD} at (3,3) size 59x526
+          RenderTableRow {TR} at (0,2) size 59x522
+            RenderTableCell {TD} at (2,252) size 55x22 [r=0 c=0 rs=1 cs=1]
               RenderText {#text} at (1,1) size 51x19
                 text run at (1,1) width 51: "THEAD"
         RenderTableSection {TFOOT} at (3,555) size 59x26
@@ -37,8 +37,8 @@
             RenderTableCell {TD} at (2,2) size 55x22 [r=0 c=0 rs=1 cs=1]
               RenderText {#text} at (1,1) size 51x19
                 text run at (1,1) width 51: "TFOOT"
-        RenderTableSection {TBODY} at (3,29) size 59x526
-          RenderTableRow {TR} at (0,2) size 59x522
-            RenderTableCell {TD} at (2,252) size 55x22 [r=0 c=0 rs=1 cs=1]
+        RenderTableSection {TBODY} at (3,529) size 59x26
+          RenderTableRow {TR} at (0,2) size 59x22
+            RenderTableCell {TD} at (2,2) size 55x22 [r=0 c=0 rs=1 cs=1]
               RenderText {#text} at (1,1) size 53x19
                 text run at (1,1) width 53: "TBODY"

Modified: trunk/LayoutTests/platform/efl/test_expectations.txt (107970 => 107971)


--- trunk/LayoutTests/platform/efl/test_expectations.txt	2012-02-16 20:40:20 UTC (rev 107970)
+++ trunk/LayoutTests/platform/efl/test_expectations.txt	2012-02-16 20:50:08 UTC (rev 107971)
@@ -5,3 +5,7 @@
 // Needs ENABLE_SHADOW_DOM
 BUGWK76439 DEBUG : fast/dom/shadow/content-element-api.html = TEXT
 BUGWK76439 DEBUG : fast/dom/shadow/content-element-outside-shadow.html = TEXT
+
+// Need rebaselining.
+BUGWK37244: tables/mozilla/bugs/bug27038-1.html = IMAGE+TEXT
+BUGWK37244: tables/mozilla/bugs/bug27038-2.html = IMAGE+TEXT

Modified: trunk/LayoutTests/platform/gtk/test_expectations.txt (107970 => 107971)


--- trunk/LayoutTests/platform/gtk/test_expectations.txt	2012-02-16 20:40:20 UTC (rev 107970)
+++ trunk/LayoutTests/platform/gtk/test_expectations.txt	2012-02-16 20:50:08 UTC (rev 107971)
@@ -100,3 +100,7 @@
 BUGWK74270 : fast/forms/basic-selects.html = FAIL
 
 BUGWK76639 : fast/table/multiple-captions-crash3.html = IMAGE FAIL
+
+// Need rebaselining.
+BUGWK37244: tables/mozilla/bugs/bug27038-1.html = IMAGE+TEXT
+BUGWK37244: tables/mozilla/bugs/bug27038-2.html = IMAGE+TEXT

Modified: trunk/LayoutTests/platform/mac/test_expectations.txt (107970 => 107971)


--- trunk/LayoutTests/platform/mac/test_expectations.txt	2012-02-16 20:40:20 UTC (rev 107970)
+++ trunk/LayoutTests/platform/mac/test_expectations.txt	2012-02-16 20:50:08 UTC (rev 107971)
@@ -203,3 +203,7 @@
 // Rebaseline required after bug 74874
 BUGWK74874 : fast/table/027.html = TEXT
 BUGWK74874 : fast/table/027-vertical.html = TEXT
+
+// Need rebaselining.
+BUGWK37244: tables/mozilla/bugs/bug27038-1.html = IMAGE+TEXT
+BUGWK37244: tables/mozilla/bugs/bug27038-2.html = IMAGE+TEXT

Modified: trunk/LayoutTests/platform/qt/test_expectations.txt (107970 => 107971)


--- trunk/LayoutTests/platform/qt/test_expectations.txt	2012-02-16 20:40:20 UTC (rev 107970)
+++ trunk/LayoutTests/platform/qt/test_expectations.txt	2012-02-16 20:50:08 UTC (rev 107971)
@@ -28,3 +28,7 @@
 
 // Needs baseline
 BUGWK76118 : fast/css/text-overflow-input.html = MISSING
+
+// Need rebaselining.
+BUGWK37244: tables/mozilla/bugs/bug27038-1.html = IMAGE+TEXT
+BUGWK37244: tables/mozilla/bugs/bug27038-2.html = IMAGE+TEXT

Modified: trunk/LayoutTests/platform/win/Skipped (107970 => 107971)


--- trunk/LayoutTests/platform/win/Skipped	2012-02-16 20:40:20 UTC (rev 107970)
+++ trunk/LayoutTests/platform/win/Skipped	2012-02-16 20:50:08 UTC (rev 107971)
@@ -1637,3 +1637,7 @@
 fast/dom/HTMLTableElement/colSpan.html
 fast/dom/HTMLTableElement/createCaption.html
 fast/repaint/table-section-repaint.html
+
+// Need rebaselining after bug 37244.
+tables/mozilla/bugs/bug27038-1.html
+tables/mozilla/bugs/bug27038-2.html

Modified: trunk/Source/WebCore/ChangeLog (107970 => 107971)


--- trunk/Source/WebCore/ChangeLog	2012-02-16 20:40:20 UTC (rev 107970)
+++ trunk/Source/WebCore/ChangeLog	2012-02-16 20:50:08 UTC (rev 107971)
@@ -1,3 +1,25 @@
+2012-02-16  Julien Chaffraix  <[email protected]>
+
+        thead in table without tbody causes table height doubling
+        https://bugs.webkit.org/show_bug.cgi?id=37244
+
+        Reviewed by Ojan Vafai.
+
+        Tests: fast/table/double-height-table-no-tbody-expected.html
+               fast/table/double-height-table-no-tbody.html
+
+        The bug is caused by the layout code would wrongly assuming that a
+        table without a <tbody> is an empty table. We would set the logical
+        height to the style's logical height wrongly before inflating the
+        logical height to account for the section(s). This would cause us
+        to increase past our needed size thus the bug.
+
+        * rendering/RenderTable.cpp:
+        (WebCore::RenderTable::layout):
+        A table is empty if it does not have any top section, not just a <tbody>.
+        The test uncovered an issue with height distribution in layoutRows where we
+        would distribute the extra height to the first <tbody> not section.
+
 2012-02-07  Robert Hogan  <[email protected]>
 
         CSS 2.1 failure: fixed-table-layout-013 and fixed-table-layout-015 fail

Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (107970 => 107971)


--- trunk/Source/WebCore/rendering/RenderTable.cpp	2012-02-16 20:40:20 UTC (rev 107970)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp	2012-02-16 20:50:08 UTC (rev 107971)
@@ -390,11 +390,11 @@
 
     for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
         if (child->isTableSection())
-            // FIXME: Distribute extra height between all table body sections instead of giving it all to the first one.
-            toRenderTableSection(child)->layoutRows(child == m_firstBody ? max<LayoutUnit>(0, computedLogicalHeight - totalSectionLogicalHeight) : 0);
+            // FIXME: Distribute the extra logical height between all table sections instead of giving it all to the first one.
+            toRenderTableSection(child)->layoutRows(child == topSection() ? max<LayoutUnit>(0, computedLogicalHeight - totalSectionLogicalHeight) : 0);
     }
 
-    if (!m_firstBody && computedLogicalHeight > totalSectionLogicalHeight && !document()->inQuirksMode()) {
+    if (!topSection() && computedLogicalHeight > totalSectionLogicalHeight && !document()->inQuirksMode()) {
         // Completely empty tables (with no sections or anything) should at least honor specified height
         // in strict mode.
         setLogicalHeight(logicalHeight() + computedLogicalHeight);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to