Title: [114574] trunk
- Revision
- 114574
- Author
- [email protected]
- Date
- 2012-04-18 16:07:51 -0700 (Wed, 18 Apr 2012)
Log Message
REGRESSION(102040): Auto-table layout with percent width doesn't shrink-to-fit content a cell with colspan
https://bugs.webkit.org/show_bug.cgi?id=84260
Reviewed by Ojan Vafai.
Source/WebCore:
Tests: fast/table/td-width-fifty-percent-regression-expected.html
fast/table/td-width-fifty-percent-regression.html
* rendering/AutoTableLayout.cpp:
(WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
As we are spreading the cell's min / max logical width, we should be updating them.
This prevents the following logic getting confused and allocating more than needed.
LayoutTests:
* fast/table/td-width-fifty-percent-regression-expected.html: Added.
* fast/table/td-width-fifty-percent-regression.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (114573 => 114574)
--- trunk/LayoutTests/ChangeLog 2012-04-18 22:59:32 UTC (rev 114573)
+++ trunk/LayoutTests/ChangeLog 2012-04-18 23:07:51 UTC (rev 114574)
@@ -1,3 +1,13 @@
+2012-04-18 Julien Chaffraix <[email protected]>
+
+ REGRESSION(102040): Auto-table layout with percent width doesn't shrink-to-fit content a cell with colspan
+ https://bugs.webkit.org/show_bug.cgi?id=84260
+
+ Reviewed by Ojan Vafai.
+
+ * fast/table/td-width-fifty-percent-regression-expected.html: Added.
+ * fast/table/td-width-fifty-percent-regression.html: Added.
+
2012-04-18 Philippe Normand <[email protected]>
Unreviewed, GTK test_expectations update.
Added: trunk/LayoutTests/fast/table/td-width-fifty-percent-regression-expected.html (0 => 114574)
--- trunk/LayoutTests/fast/table/td-width-fifty-percent-regression-expected.html (rev 0)
+++ trunk/LayoutTests/fast/table/td-width-fifty-percent-regression-expected.html 2012-04-18 23:07:51 UTC (rev 114574)
@@ -0,0 +1,23 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ table
+ {
+ border:solid black 1px;
+ }
+</style>
+</head>
+<body>
+<p>Test for bug <a href="" REGRESSION(102040): Auto-table layout with percent width doesn't shrink-to-fit content a cell with colspan</p>
+<p>For this test to pass, the table below should fit its content.</p>
+<table>
+ <tr>
+ <td></td><td></td>
+ </tr>
+ <tr>
+ <td colspan="2">Lorem</td>
+ </tr>
+</table>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/table/td-width-fifty-percent-regression-expected.html
___________________________________________________________________
Added: svn:executable
Added: trunk/LayoutTests/fast/table/td-width-fifty-percent-regression.html (0 => 114574)
--- trunk/LayoutTests/fast/table/td-width-fifty-percent-regression.html (rev 0)
+++ trunk/LayoutTests/fast/table/td-width-fifty-percent-regression.html 2012-04-18 23:07:51 UTC (rev 114574)
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+ table
+ {
+ border:solid black 1px;
+ }
+ td.fiftyPercent
+ {
+ width: 50%;
+ }
+</style>
+</head>
+<body>
+<p>Test for bug <a href="" REGRESSION(102040): Auto-table layout with percent width doesn't shrink-to-fit content a cell with colspan</p>
+<p>For this test to pass, the table below should fit its content.</p>
+<table>
+ <tr>
+ <td class="fiftyPercent"></td><td class="fiftyPercent"></td>
+ </tr>
+ <tr>
+ <td colspan="2">Lorem</td>
+ </tr>
+</table>
+</body>
+</html>
Property changes on: trunk/LayoutTests/fast/table/td-width-fifty-percent-regression.html
___________________________________________________________________
Added: svn:executable
Modified: trunk/Source/WebCore/ChangeLog (114573 => 114574)
--- trunk/Source/WebCore/ChangeLog 2012-04-18 22:59:32 UTC (rev 114573)
+++ trunk/Source/WebCore/ChangeLog 2012-04-18 23:07:51 UTC (rev 114574)
@@ -1,3 +1,18 @@
+2012-04-18 Julien Chaffraix <[email protected]>
+
+ REGRESSION(102040): Auto-table layout with percent width doesn't shrink-to-fit content a cell with colspan
+ https://bugs.webkit.org/show_bug.cgi?id=84260
+
+ Reviewed by Ojan Vafai.
+
+ Tests: fast/table/td-width-fifty-percent-regression-expected.html
+ fast/table/td-width-fifty-percent-regression.html
+
+ * rendering/AutoTableLayout.cpp:
+ (WebCore::AutoTableLayout::calcEffectiveLogicalWidth):
+ As we are spreading the cell's min / max logical width, we should be updating them.
+ This prevents the following logic getting confused and allocating more than needed.
+
2012-04-18 Justin Schuh <[email protected]>
Win8 builds usually fail due to cygwin rebasing
Modified: trunk/Source/WebCore/rendering/AutoTableLayout.cpp (114573 => 114574)
--- trunk/Source/WebCore/rendering/AutoTableLayout.cpp 2012-04-18 22:59:32 UTC (rev 114573)
+++ trunk/Source/WebCore/rendering/AutoTableLayout.cpp 2012-04-18 23:07:51 UTC (rev 114574)
@@ -402,13 +402,23 @@
}
} else if (allColsArePercent) {
// In this case, we just split the colspan's min amd max widths following the percentage.
+ int allocatedMinLogicalWidth = 0;
+ float allocatedMaxLogicalWidth = 0;
for (unsigned pos = effCol; pos < lastCol; ++pos) {
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 = max(m_layoutStruct[pos].effectiveMinLogicalWidth, static_cast<int>(percent * cellMinLogicalWidth / totalPercent));
- m_layoutStruct[pos].effectiveMaxLogicalWidth = percent * cellMaxLogicalWidth / totalPercent;
+ int columnMinLogicalWidth = static_cast<int>(percent * cellMinLogicalWidth / totalPercent);
+ float columnMaxLogicalWidth = percent * cellMaxLogicalWidth / totalPercent;
+ m_layoutStruct[pos].effectiveMinLogicalWidth = max(m_layoutStruct[pos].effectiveMinLogicalWidth, columnMinLogicalWidth);
+ m_layoutStruct[pos].effectiveMaxLogicalWidth = columnMaxLogicalWidth;
+ allocatedMinLogicalWidth += columnMinLogicalWidth;
+ allocatedMaxLogicalWidth += columnMaxLogicalWidth;
}
+ ASSERT(allocatedMinLogicalWidth <= cellMinLogicalWidth);
+ ASSERT(allocatedMaxLogicalWidth <= cellMaxLogicalWidth);
+ cellMinLogicalWidth -= allocatedMinLogicalWidth;
+ cellMaxLogicalWidth -= allocatedMaxLogicalWidth;
} else {
float remainingMaxLogicalWidth = spanMaxLogicalWidth;
int remainingMinLogicalWidth = spanMinLogicalWidth;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes