REGRESSION (r102040): Wrong column widths when row has colspan and unwrappable text
authorrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Jan 2012 20:32:37 +0000 (20:32 +0000)
committerrobert@webkit.org <robert@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 24 Jan 2012 20:32:37 +0000 (20:32 +0000)
https://bugs.webkit.org/show_bug.cgi?id=74874

Reviewed by Julien Chaffraix.

Source/WebCore:

Tests: fast/css/min-width-with-spanned-cell-fixed.html
       fast/css/min-width-with-spanned-cell.html

A cell with unwrappable text must be as wide as the text is long. If it is a colspan in a table whose
columns are all percent and the width of the span cell is wider than the cells it spans in any other
row then it will squeeze those cells beyond the width required to display their contents.

To fix this ensure that the squeezing of cells within a span respects the minimum width determined by
their contents. The squeezing remains for fixed layout tables as per FF and Opera.

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

LayoutTests:

* fast/css/min-width-with-spanned-cell-expected.png: Added.
* fast/css/min-width-with-spanned-cell-expected.txt: Added.
* fast/css/min-width-with-spanned-cell-fixed-expected.png: Added.
* fast/css/min-width-with-spanned-cell-fixed-expected.txt: Added.
* fast/css/min-width-with-spanned-cell-fixed.html: Added.
* fast/css/min-width-with-spanned-cell.html: Added.
* platform/chromium-linux/fast/table/027-expected.png:
   1 px difference - benign
* platform/chromium-linux/fast/table/027-vertical-expected.png:
   This is a progression - previously the image in the last cell was
   extruding from the table in a 800x600 view.
* platform/chromium-win/fast/table/027-expected.txt:
* platform/chromium-win/fast/table/027-vertical-expected.txt:
* platform/mac/test_expectations.txt: Suppress 027* tests for rebaseline.
* platform/win/test_expectations.txt: ditto
   The 2 tests are skipped on gtk and qt.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@105775 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
LayoutTests/ChangeLog
LayoutTests/fast/css/min-width-with-spanned-cell-expected.png [new file with mode: 0644]
LayoutTests/fast/css/min-width-with-spanned-cell-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/min-width-with-spanned-cell-fixed-expected.png [new file with mode: 0644]
LayoutTests/fast/css/min-width-with-spanned-cell-fixed-expected.txt [new file with mode: 0644]
LayoutTests/fast/css/min-width-with-spanned-cell-fixed.html [new file with mode: 0644]
LayoutTests/fast/css/min-width-with-spanned-cell.html [new file with mode: 0644]
LayoutTests/platform/chromium-linux/fast/table/027-expected.png
LayoutTests/platform/chromium-linux/fast/table/027-vertical-expected.png
LayoutTests/platform/chromium-win/fast/table/027-expected.txt
LayoutTests/platform/chromium-win/fast/table/027-vertical-expected.txt
LayoutTests/platform/mac/test_expectations.txt
LayoutTests/platform/win/test_expectations.txt
Source/WebCore/ChangeLog
Source/WebCore/rendering/AutoTableLayout.cpp

index 5b92fe4..64eedf9 100644 (file)
@@ -1,3 +1,27 @@
+2012-01-16  Robert Hogan  <robert@webkit.org>
+
+        REGRESSION (r102040): Wrong column widths when row has colspan and unwrappable text
+        https://bugs.webkit.org/show_bug.cgi?id=74874
+
+        Reviewed by Julien Chaffraix.
+
+        * fast/css/min-width-with-spanned-cell-expected.png: Added.
+        * fast/css/min-width-with-spanned-cell-expected.txt: Added.
+        * fast/css/min-width-with-spanned-cell-fixed-expected.png: Added.
+        * fast/css/min-width-with-spanned-cell-fixed-expected.txt: Added.
+        * fast/css/min-width-with-spanned-cell-fixed.html: Added.
+        * fast/css/min-width-with-spanned-cell.html: Added.
+        * platform/chromium-linux/fast/table/027-expected.png:
+           1 px difference - benign
+        * platform/chromium-linux/fast/table/027-vertical-expected.png:
+           This is a progression - previously the image in the last cell was
+           extruding from the table in a 800x600 view.
+        * platform/chromium-win/fast/table/027-expected.txt:
+        * platform/chromium-win/fast/table/027-vertical-expected.txt:
+        * platform/mac/test_expectations.txt: Suppress 027* tests for rebaseline.
+        * platform/win/test_expectations.txt: ditto
+           The 2 tests are skipped on gtk and qt.
+
 2012-01-24  Parag Radke  <nrqv63@motorola.com>
 
         REGRESSION (r73385): Marquee with behavior="alternate" is not working
diff --git a/LayoutTests/fast/css/min-width-with-spanned-cell-expected.png b/LayoutTests/fast/css/min-width-with-spanned-cell-expected.png
new file mode 100644 (file)
index 0000000..b295c08
Binary files /dev/null and b/LayoutTests/fast/css/min-width-with-spanned-cell-expected.png differ
diff --git a/LayoutTests/fast/css/min-width-with-spanned-cell-expected.txt b/LayoutTests/fast/css/min-width-with-spanned-cell-expected.txt
new file mode 100644 (file)
index 0000000..0a551bf
--- /dev/null
@@ -0,0 +1,19 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x50
+  RenderBlock {HTML} at (0,0) size 800x50
+    RenderBody {BODY} at (8,8) size 784x34
+      RenderTable {TABLE} at (0,0) size 784x34
+        RenderTableSection {TBODY} at (0,0) size 784x34
+          RenderTableRow {TR} at (0,2) size 784x14
+            RenderTableCell {TD} at (2,2) size 146x14 [color=#333333] [bgcolor=#EEEEEE] [r=0 c=0 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 144x12
+                text run at (1,1) width 144: "texttesttest"
+            RenderTableCell {TD} at (150,2) size 146x14 [color=#333333] [bgcolor=#EEEEEE] [r=0 c=1 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 144x12
+                text run at (1,1) width 144: "texttesttest"
+            RenderTableCell {TD} at (298,8) size 484x2 [color=#333333] [bgcolor=#EEEEEE] [r=0 c=2 rs=1 cs=1]
+          RenderTableRow {TR} at (0,18) size 784x14
+            RenderTableCell {TD} at (2,18) size 780x14 [color=#333333] [bgcolor=#EEEEEE] [r=1 c=0 rs=1 cs=3]
+              RenderText {#text} at (1,1) size 312x12
+                text run at (1,1) width 312: "texttesttexttesttesttextte"
diff --git a/LayoutTests/fast/css/min-width-with-spanned-cell-fixed-expected.png b/LayoutTests/fast/css/min-width-with-spanned-cell-fixed-expected.png
new file mode 100644 (file)
index 0000000..1021cf4
Binary files /dev/null and b/LayoutTests/fast/css/min-width-with-spanned-cell-fixed-expected.png differ
diff --git a/LayoutTests/fast/css/min-width-with-spanned-cell-fixed-expected.txt b/LayoutTests/fast/css/min-width-with-spanned-cell-fixed-expected.txt
new file mode 100644 (file)
index 0000000..ab1608f
--- /dev/null
@@ -0,0 +1,19 @@
+layer at (0,0) size 800x600
+  RenderView at (0,0) size 800x600
+layer at (0,0) size 800x50
+  RenderBlock {HTML} at (0,0) size 800x50
+    RenderBody {BODY} at (8,8) size 784x34
+      RenderTable {TABLE} at (0,0) size 784x34
+        RenderTableSection {TBODY} at (0,0) size 784x34
+          RenderTableRow {TR} at (0,2) size 784x14
+            RenderTableCell {TD} at (2,2) size 8x14 [color=#333333] [bgcolor=#EEEEEE] [r=0 c=0 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 144x12
+                text run at (1,1) width 144: "texttesttest"
+            RenderTableCell {TD} at (12,2) size 8x14 [color=#333333] [bgcolor=#EEEEEE] [r=0 c=1 rs=1 cs=1]
+              RenderText {#text} at (1,1) size 144x12
+                text run at (1,1) width 144: "texttesttest"
+            RenderTableCell {TD} at (22,8) size 760x2 [color=#333333] [bgcolor=#EEEEEE] [r=0 c=2 rs=1 cs=1]
+          RenderTableRow {TR} at (0,18) size 784x14
+            RenderTableCell {TD} at (2,18) size 780x14 [color=#333333] [bgcolor=#EEEEEE] [r=1 c=0 rs=1 cs=3]
+              RenderText {#text} at (1,1) size 312x12
+                text run at (1,1) width 312: "texttesttexttesttesttextte"
diff --git a/LayoutTests/fast/css/min-width-with-spanned-cell-fixed.html b/LayoutTests/fast/css/min-width-with-spanned-cell-fixed.html
new file mode 100644 (file)
index 0000000..b4424e9
--- /dev/null
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+    td {
+        color: #333333;
+        background-color: #eee;
+    }
+    table { table-layout: fixed; }
+</style>    
+</head>
+<body>
+
+<!--When a cell spans an entire row on a table with fixed layout, allow cells containing text to be
+squeezed smaller than the width of the text. You should see the content of the first two cells in the first row overlapping.-->
+
+<table style="font: 12px Ahem;" width="100%">
+  <tr>
+    <td width="1%">
+      texttesttest
+    </td>
+    <td width="1%">
+      texttesttest
+    </td>
+    <td width='98%'>
+    </td>
+  </tr>
+  <tr>
+    <td colspan="3"> 
+      texttesttexttesttesttextte
+    </td>
+  </tr>
+</table>
+</body>
+</html>
\ No newline at end of file
diff --git a/LayoutTests/fast/css/min-width-with-spanned-cell.html b/LayoutTests/fast/css/min-width-with-spanned-cell.html
new file mode 100644 (file)
index 0000000..d95401b
--- /dev/null
@@ -0,0 +1,34 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+    td {
+        color: #333333;
+        background-color: #eee;
+    }
+</style>    
+</head>
+<body>
+
+<!--When a cell spans an entire row on a table with auto layout, ensure that cells containing text are not
+squeezed smaller than the width of the text. The text in the first two cells in the first row should not overlap.-->
+
+<table style="font: 12px Ahem;" width="100%">
+  <tr>
+    <td width="1%">
+      texttesttest
+    </td>
+    <td width="1%">
+      texttesttest
+    </td>
+    <td width='98%'>
+    </td>
+  </tr>
+  <tr>
+    <td colspan="3"> 
+      texttesttexttesttesttextte
+    </td>
+  </tr>
+</table>
+</body>
+</html>
\ No newline at end of file
index 3f59b22..6bb451c 100644 (file)
Binary files a/LayoutTests/platform/chromium-linux/fast/table/027-expected.png and b/LayoutTests/platform/chromium-linux/fast/table/027-expected.png differ
index 905f89c..e2abb86 100644 (file)
Binary files a/LayoutTests/platform/chromium-linux/fast/table/027-vertical-expected.png and b/LayoutTests/platform/chromium-linux/fast/table/027-vertical-expected.png differ
index 294bc0a..8e92c78 100644 (file)
@@ -39,14 +39,14 @@ layer at (0,0) size 800x600
                 text run at (664,4) width 78: "  Lite \x{2022} Email"
           RenderTableRow {TR} at (0,28) size 784x344
             RenderTableCell {TD} at (0,196) size 220x8 [border: (1px solid #008000)] [r=1 c=0 rs=1 cs=1]
-            RenderTableCell {TD} at (220,28) size 345x344 [border: (1px solid #008000)] [r=1 c=1 rs=1 cs=1]
-              RenderTable {TABLE} at (4,4) size 337x336
-                RenderTableSection {TBODY} at (0,0) size 337x336
-                  RenderTableRow {TR} at (0,2) size 337x332
-                    RenderTableCell {TD} at (2,2) size 333x332 [border: (1px solid #008000)] [r=0 c=0 rs=1 cs=1]
-                      RenderTable {TABLE} at (2,2) size 329x328
-                        RenderTableSection {TBODY} at (0,0) size 329x328
-                          RenderTableRow {TR} at (0,2) size 329x324
+            RenderTableCell {TD} at (220,28) size 344x344 [border: (1px solid #008000)] [r=1 c=1 rs=1 cs=1]
+              RenderTable {TABLE} at (4,4) size 336x336
+                RenderTableSection {TBODY} at (0,0) size 336x336
+                  RenderTableRow {TR} at (0,2) size 336x332
+                    RenderTableCell {TD} at (2,2) size 332x332 [border: (1px solid #008000)] [r=0 c=0 rs=1 cs=1]
+                      RenderTable {TABLE} at (2,2) size 328x328
+                        RenderTableSection {TBODY} at (0,0) size 328x328
+                          RenderTableRow {TR} at (0,2) size 328x324
                             RenderTableCell {TD} at (2,162) size 127x4 [border: (1px solid #008000)] [r=0 c=0 rs=1 cs=1]
                             RenderTableCell {TD} at (131,2) size 66x324 [border: (1px solid #008000)] [r=0 c=1 rs=1 cs=1]
                               RenderText {#text} at (2,2) size 62x319
@@ -67,7 +67,7 @@ layer at (0,0) size 800x600
                                 text run at (2,262) width 38: "what I"
                                 text run at (2,282) width 53: "think will"
                                 text run at (2,302) width 36: "work."
-                            RenderTableCell {TD} at (199,162) size 128x4 [border: (1px solid #008000)] [r=0 c=2 rs=1 cs=1]
-            RenderTableCell {TD} at (565,187) size 219x26 [border: (1px solid #008000)] [r=1 c=2 rs=1 cs=1]
+                            RenderTableCell {TD} at (199,162) size 127x4 [border: (1px solid #008000)] [r=0 c=2 rs=1 cs=1]
+            RenderTableCell {TD} at (564,187) size 220x26 [border: (1px solid #008000)] [r=1 c=2 rs=1 cs=1]
               RenderImage {IMG} at (4,4) size 212x18
               RenderText {#text} at (0,0) size 0x0
index effb309..2a35506 100644 (file)
@@ -1,12 +1,12 @@
-layer at (0,0) size 785x760
+layer at (0,0) size 785x772
   RenderView at (0,0) size 785x600
-layer at (0,0) size 785x760
-  RenderBlock {HTML} at (0,0) size 785x760
-    RenderBody {BODY} at (8,8) size 769x744
-      RenderTable {TABLE} at (0,0) size 372x744
-        RenderTableSection {TBODY} at (0,0) size 372x744
-          RenderTableRow {TR} at (0,0) size 28x744
-            RenderTableCell {TD} at (0,0) size 28x744 [border: (1px solid #008000)] [r=0 c=0 rs=1 cs=3]
+layer at (0,0) size 785x772
+  RenderBlock {HTML} at (0,0) size 785x772
+    RenderBody {BODY} at (8,8) size 769x756
+      RenderTable {TABLE} at (0,0) size 372x756
+        RenderTableSection {TBODY} at (0,0) size 372x756
+          RenderTableRow {TR} at (0,0) size 28x756
+            RenderTableCell {TD} at (0,0) size 28x756 [border: (1px solid #008000)] [r=0 c=0 rs=1 cs=3]
               RenderText {#text} at (4,4) size 19x224
                 text run at (4,4) width 137: "   Join Now   Sign In   "
                 text run at (4,141) width 87: "   Personalize: "
@@ -37,7 +37,7 @@ layer at (0,0) size 785x760
                 text run at (4,571) width 8: "  "
                 text run at (4,579) width 85: "   My Links:   "
                 text run at (4,664) width 78: "  Lite \x{2022} Email"
-          RenderTableRow {TR} at (0,28) size 344x744
+          RenderTableRow {TR} at (0,28) size 344x756
             RenderTableCell {TD} at (28,168) size 344x-128 [border: (1px solid #008000)] [r=1 c=0 rs=1 cs=1]
             RenderTableCell {TD} at (28,208) size 344x328 [border: (1px solid #008000)] [r=1 c=1 rs=1 cs=1]
               RenderTable {TABLE} at (4,4) size 336x320
@@ -68,6 +68,6 @@ layer at (0,0) size 785x760
                                 text run at (282,2) width 53: "think will"
                                 text run at (302,2) width 36: "work."
                             RenderTableCell {TD} at (2,351) size 324x-201 [border: (1px solid #008000)] [r=0 c=2 rs=1 cs=1]
-            RenderTableCell {TD} at (28,695) size 344x-110 [border: (1px solid #008000)] [r=1 c=2 rs=1 cs=1]
+            RenderTableCell {TD} at (28,695) size 344x-98 [border: (1px solid #008000)] [r=1 c=2 rs=1 cs=1]
               RenderImage {IMG} at (163,-155) size 18x212
               RenderText {#text} at (0,0) size 0x0
index fb082dc..f20d7be 100644 (file)
@@ -195,3 +195,7 @@ BUGWK74888 : fast/table/frame-and-rules.html = TEXT
 
 // New test, needs image results added.
 BUGWK75570 : http/tests/media/video-buffering-repaints-controls.html = IMAGE
+
+// Rebaseline required after bug 74874
+BUGWK74874 : fast/table/027.html = TEXT
+BUGWK74874 : fast/table/027-vertical.html = TEXT
index 50ed0c8..6dd2050 100644 (file)
@@ -128,3 +128,7 @@ BUGWK75570 : http/tests/media/video-buffering-repaints-controls.html = IMAGE
 
 // Needs baseline
 BUGWK76118 : fast/css/text-overflow-input.html = MISSING
+
+// Rebaseline required after bug 74874
+BUGWK74874 : fast/table/027.html = IMAGE+TEXT
+BUGWK74874 : fast/table/027-vertical.html = IMAGE+TEXT
index 9835182..cd238d9 100644 (file)
@@ -1,3 +1,23 @@
+2012-01-16  Robert Hogan  <robert@webkit.org>
+
+        REGRESSION (r102040): Wrong column widths when row has colspan and unwrappable text
+        https://bugs.webkit.org/show_bug.cgi?id=74874
+
+        Reviewed by Julien Chaffraix.
+
+        Tests: fast/css/min-width-with-spanned-cell-fixed.html
+               fast/css/min-width-with-spanned-cell.html
+
+        A cell with unwrappable text must be as wide as the text is long. If it is a colspan in a table whose
+        columns are all percent and the width of the span cell is wider than the cells it spans in any other 
+        row then it will squeeze those cells beyond the width required to display their contents.
+
+        To fix this ensure that the squeezing of cells within a span respects the minimum width determined by
+        their contents. The squeezing remains for fixed layout tables as per FF and Opera.
+
+        * rendering/AutoTableLayout.cpp:
+        (WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
+
 2012-01-24  Tommy Widenflycht  <tommyw@google.com>
 
         MediaStream API: Split the MediaStream track list into audio/video specific ones.
index bf33e0b..863e4c8 100644 (file)
@@ -400,7 +400,7 @@ int AutoTableLayout::calcEffectiveLogicalWidth()
                     ASSERT(m_layoutStruct[pos].logicalWidth.isPercent() || m_layoutStruct[pos].effectiveLogicalWidth.isPercent());
                     // |allColsArePercent| means that either the logicalWidth *or* the effectiveLogicalWidth are percents, handle both of them here.
                     float percent = m_layoutStruct[pos].logicalWidth.isPercent() ? m_layoutStruct[pos].logicalWidth.percent() : m_layoutStruct[pos].effectiveLogicalWidth.percent();
-                    m_layoutStruct[pos].effectiveMinLogicalWidth = percent * cellMinLogicalWidth / totalPercent;
+                    m_layoutStruct[pos].effectiveMinLogicalWidth = max(m_layoutStruct[pos].effectiveMinLogicalWidth, static_cast<int>(percent * cellMinLogicalWidth / totalPercent));
                     m_layoutStruct[pos].effectiveMaxLogicalWidth = percent * cellMaxLogicalWidth / totalPercent;
                 }
             } else {