Diff
Modified: trunk/LayoutTests/ChangeLog (118818 => 118819)
--- trunk/LayoutTests/ChangeLog 2012-05-29 19:28:04 UTC (rev 118818)
+++ trunk/LayoutTests/ChangeLog 2012-05-29 19:30:43 UTC (rev 118819)
@@ -1,3 +1,23 @@
+2012-05-29 Julien Chaffraix <[email protected]>
+
+ REGRESSION(r111742): box-sizing: border-box doesn't work on fixed table layout
+ https://bugs.webkit.org/show_bug.cgi?id=87536
+
+ Reviewed by Tony Chang.
+
+ * fast/table/fixed-table-layout/cell-box-sizing-fixed-table-layout-expected.html: Added.
+ * fast/table/fixed-table-layout/cell-box-sizing-fixed-table-layout.html: Added.
+ This test covers the regression.
+
+ * fast/table/fixed-table-layout/column-box-sizing-fixed-table-layout-expected.html: Added.
+ * fast/table/fixed-table-layout/column-box-sizing-fixed-table-layout.html: Added.
+ * fast/table/fixed-table-layout/column-group-box-sizing-fixed-table-layout-expected.html: Added.
+ * fast/table/fixed-table-layout/column-group-box-sizing-fixed-table-layout.html: Added.
+ * fast/table/fixed-table-layout/column-in-column-group-box-sizing-fixed-table-layout-expected.html: Added.
+ * fast/table/fixed-table-layout/column-in-column-group-box-sizing-fixed-table-layout.html: Added.
+ Those test ensured I didn't regress and document our current behavior ie that column and column group fixed
+ width apply to the cell's border-box.
+
2012-05-25 Ojan Vafai <[email protected]>
Absolute positioned elements in a relative positioned CSS3 Flexbox fail to display properly
Added: trunk/LayoutTests/fast/table/fixed-table-layout/cell-box-sizing-fixed-table-layout-expected.html (0 => 118819)
--- trunk/LayoutTests/fast/table/fixed-table-layout/cell-box-sizing-fixed-table-layout-expected.html (rev 0)
+++ trunk/LayoutTests/fast/table/fixed-table-layout/cell-box-sizing-fixed-table-layout-expected.html 2012-05-29 19:30:43 UTC (rev 118819)
@@ -0,0 +1,32 @@
+<!DOCTYPE html>
+<style>
+ table, .table {
+ border-spacing: 0px;
+ table-layout: fixed;
+ width: 0px;
+ }
+ .table {
+ display: table;
+ }
+
+ .td {
+ display: table-cell;
+ }
+
+ td, .td {
+ height: 80px;
+ width: 80px;
+ border: 10px solid green;
+ padding: 0px;
+ }
+</style>
+<p>Bug <a href="" REGRESSION(r111742): box-sizing: border-box doesn't work on fixed table layout</p>
+<p>You should see 4 100px * 100px cells with green borders.</p>
+<table>
+ <td></td>
+ <td></td>
+</table>
+<div class="table">
+ <div class="td"></div>
+ <div class="td"></div>
+</div>
Added: trunk/LayoutTests/fast/table/fixed-table-layout/cell-box-sizing-fixed-table-layout.html (0 => 118819)
--- trunk/LayoutTests/fast/table/fixed-table-layout/cell-box-sizing-fixed-table-layout.html (rev 0)
+++ trunk/LayoutTests/fast/table/fixed-table-layout/cell-box-sizing-fixed-table-layout.html 2012-05-29 19:30:43 UTC (rev 118819)
@@ -0,0 +1,35 @@
+<!DOCTYPE html>
+<style>
+ table, .table {
+ border-spacing: 0px;
+ table-layout: fixed;
+ width: 0px;
+ }
+ .table {
+ display: table;
+ }
+
+ .td {
+ display: table-cell;
+ }
+
+ td, .td {
+ height: 100px;
+ width: 100px;
+ border: 10px solid green;
+ padding: 0px;
+ -moz-box-sizing: border-box;
+ -webkit-box-sizing: border-box;
+ box-sizing: border-box;
+ }
+</style>
+<p>Bug <a href="" REGRESSION(r111742): box-sizing: border-box doesn't work on fixed table layout</p>
+<p>You should see 4 100px * 100px cells with green borders.</p>
+<table>
+ <td></td>
+ <td></td>
+</table>
+<div class="table">
+ <div class="td"></div>
+ <div class="td"></div>
+</div>
Added: trunk/LayoutTests/fast/table/fixed-table-layout/column-box-sizing-fixed-table-layout-expected.html (0 => 118819)
--- trunk/LayoutTests/fast/table/fixed-table-layout/column-box-sizing-fixed-table-layout-expected.html (rev 0)
+++ trunk/LayoutTests/fast/table/fixed-table-layout/column-box-sizing-fixed-table-layout-expected.html 2012-05-29 19:30:43 UTC (rev 118819)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<style>
+ table, .table {
+ border-spacing: 0px;
+ table-layout: fixed;
+ width: 0px;
+ }
+
+ .table {
+ display: table;
+ }
+
+ .td {
+ display: table-cell;
+ }
+
+ .col {
+ display: table-column;
+ }
+
+ td, .td {
+ width: 80px;
+ padding: 0px;
+ height: 100px;
+ border: 10px solid green;
+ }
+</style>
+<p>Bug <a href="" REGRESSION(r111742): box-sizing: border-box doesn't work on fixed table layout</p>
+<p>Testing that a fixed width on a column should apply to the cell's border box.</p>
+<p>You should see 4 100px * 100px cells with green borders.</p>
+<table>
+ <col></col>
+ <col></col>
+ <tbody>
+ <td></td>
+ <td></td>
+ </tbody>
+</table>
+<div class="table">
+ <div class="col"></div>
+ <div class="col"></div>
+ <div class="td"></div>
+ <div class="td"></div>
+</div>
Added: trunk/LayoutTests/fast/table/fixed-table-layout/column-box-sizing-fixed-table-layout.html (0 => 118819)
--- trunk/LayoutTests/fast/table/fixed-table-layout/column-box-sizing-fixed-table-layout.html (rev 0)
+++ trunk/LayoutTests/fast/table/fixed-table-layout/column-box-sizing-fixed-table-layout.html 2012-05-29 19:30:43 UTC (rev 118819)
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<style>
+ table, .table {
+ border-spacing: 0px;
+ table-layout: fixed;
+ width: 0px;
+ }
+
+ .table {
+ display: table;
+ }
+
+ .td {
+ display: table-cell;
+ }
+
+ .col {
+ display: table-column;
+ }
+
+ td, .td {
+ padding: 0px;
+ height: 120px;
+ border: 10px solid green;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ }
+
+ col, .col {
+ width: 100px;
+ }
+</style>
+<p>Bug <a href="" REGRESSION(r111742): box-sizing: border-box doesn't work on fixed table layout</p>
+<p>Testing that a fixed width on a column should apply to the cell's border box.</p>
+<p>You should see 4 100px * 100px cells with green borders.</p>
+<table>
+ <col></col>
+ <col></col>
+ <tbody>
+ <td></td>
+ <td></td>
+ </tbody>
+</table>
+<div class="table">
+ <div class="col"></div>
+ <div class="col"></div>
+ <div class="td"></div>
+ <div class="td"></div>
+</div>
Added: trunk/LayoutTests/fast/table/fixed-table-layout/column-group-box-sizing-fixed-table-layout-expected.html (0 => 118819)
--- trunk/LayoutTests/fast/table/fixed-table-layout/column-group-box-sizing-fixed-table-layout-expected.html (rev 0)
+++ trunk/LayoutTests/fast/table/fixed-table-layout/column-group-box-sizing-fixed-table-layout-expected.html 2012-05-29 19:30:43 UTC (rev 118819)
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<style>
+ table, .table {
+ border-spacing: 0px;
+ table-layout: fixed;
+ width: 0px;
+ }
+
+ .table {
+ display: table;
+ }
+
+ .td {
+ display: table-cell;
+ }
+
+ .colgroup {
+ display: table-column-group;
+ }
+
+ td, .td {
+ width: 80px;
+ padding: 0px;
+ height: 100px;
+ border: 10px solid green;
+ }
+</style>
+<p>Bug <a href="" REGRESSION(r111742): box-sizing: border-box doesn't work on fixed table layout</p>
+<p>Testing that a column group's fixed width should apply to the cell's border-box and not impacted by the cell's box-sizing.</p>
+<p>You should see 4 100px * 100px cells with green borders.</p>
+<table>
+ <colgroup></colgroup>
+ <colgroup></colgroup>
+ <tbody>
+ <td></td>
+ <td></td>
+ </tbody>
+</table>
+<div class="table">
+ <div class="colgroup"></div>
+ <div class="colgroup"></div>
+ <div class="td"></div>
+ <div class="td"></div>
+</div>
Added: trunk/LayoutTests/fast/table/fixed-table-layout/column-group-box-sizing-fixed-table-layout.html (0 => 118819)
--- trunk/LayoutTests/fast/table/fixed-table-layout/column-group-box-sizing-fixed-table-layout.html (rev 0)
+++ trunk/LayoutTests/fast/table/fixed-table-layout/column-group-box-sizing-fixed-table-layout.html 2012-05-29 19:30:43 UTC (rev 118819)
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<style>
+ table, .table {
+ border-spacing: 0px;
+ table-layout: fixed;
+ width: 0px;
+ }
+
+ .table {
+ display: table;
+ }
+
+ .td {
+ display: table-cell;
+ }
+
+ .colgroup {
+ display: table-column-group;
+ }
+
+ td, .td {
+ padding: 0px;
+ height: 120px;
+ border: 10px solid green;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ }
+
+ colgroup, .colgroup {
+ width: 100px;
+ }
+</style>
+<p>Bug <a href="" REGRESSION(r111742): box-sizing: border-box doesn't work on fixed table layout</p>
+<p>Testing that a column group's fixed width should apply to the cell's border-box and not impacted by the cell's box-sizing.</p>
+<p>You should see 4 100px * 100px cells with green borders.</p>
+<table>
+ <colgroup></colgroup>
+ <colgroup></colgroup>
+ <tbody>
+ <td></td>
+ <td></td>
+ </tbody>
+</table>
+<div class="table">
+ <div class="colgroup"></div>
+ <div class="colgroup"></div>
+ <div class="td"></div>
+ <div class="td"></div>
+</div>
Added: trunk/LayoutTests/fast/table/fixed-table-layout/column-in-column-group-box-sizing-fixed-table-layout-expected.html (0 => 118819)
--- trunk/LayoutTests/fast/table/fixed-table-layout/column-in-column-group-box-sizing-fixed-table-layout-expected.html (rev 0)
+++ trunk/LayoutTests/fast/table/fixed-table-layout/column-in-column-group-box-sizing-fixed-table-layout-expected.html 2012-05-29 19:30:43 UTC (rev 118819)
@@ -0,0 +1,56 @@
+<!DOCTYPE html>
+<style>
+ table, .table {
+ border-spacing: 0px;
+ table-layout: fixed;
+ width: 0px;
+ }
+
+ .table {
+ display: table;
+ }
+
+ .td {
+ display: table-cell;
+ }
+
+ .colgroup {
+ display: table-column-group;
+ }
+
+ .col {
+ display: table-column;
+ }
+
+ td, .td {
+ width: 80px;
+ padding: 0px;
+ height: 100px;
+ border: 10px solid green;
+ }
+</style>
+<p>Bug <a href="" REGRESSION(r111742): box-sizing: border-box doesn't work on fixed table layout</p>
+<p>Testing that a column fixed width should apply to the cell's border-box and is not impacted by the cell's box-sizing.</p>
+<p>You should see 4 100px * 100px cells with green borders.</p>
+<table>
+ <colgroup>
+ <col></col>
+ </colgroup>
+ <colgroup>
+ <col></col>
+ </colgroup>
+ <tbody>
+ <td></td>
+ <td></td>
+ </tbody>
+</table>
+<div class="table">
+ <div class="colgroup">
+ <div class="col"></div>
+ </div>
+ <div class="colgroup">
+ <div class="col"></div>
+ </div>
+ <div class="td"></div>
+ <div class="td"></div>
+</div>
Added: trunk/LayoutTests/fast/table/fixed-table-layout/column-in-column-group-box-sizing-fixed-table-layout.html (0 => 118819)
--- trunk/LayoutTests/fast/table/fixed-table-layout/column-in-column-group-box-sizing-fixed-table-layout.html (rev 0)
+++ trunk/LayoutTests/fast/table/fixed-table-layout/column-in-column-group-box-sizing-fixed-table-layout.html 2012-05-29 19:30:43 UTC (rev 118819)
@@ -0,0 +1,62 @@
+<!DOCTYPE html>
+<style>
+ table, .table {
+ border-spacing: 0px;
+ table-layout: fixed;
+ width: 0px;
+ }
+
+ .table {
+ display: table;
+ }
+
+ .td {
+ display: table-cell;
+ }
+
+ .colgroup {
+ display: table-column-group;
+ }
+
+ .col {
+ display: table-column;
+ }
+
+ td, .td {
+ padding: 0px;
+ height: 120px;
+ border: 10px solid green;
+ -webkit-box-sizing: border-box;
+ -moz-box-sizing: border-box;
+ box-sizing: border-box;
+ }
+
+ col, .col {
+ width: 100px;
+ }
+</style>
+<p>Bug <a href="" REGRESSION(r111742): box-sizing: border-box doesn't work on fixed table layout</p>
+<p>Testing that a column fixed width should apply to the cell's border-box and is not impacted by the cell's box-sizing.</p>
+<p>You should see 4 100px * 100px cells with green borders.</p>
+<table>
+ <colgroup>
+ <col></col>
+ </colgroup>
+ <colgroup>
+ <col></col>
+ </colgroup>
+ <tbody>
+ <td></td>
+ <td></td>
+ </tbody>
+</table>
+<div class="table">
+ <div class="colgroup">
+ <div class="col"></div>
+ </div>
+ <div class="colgroup">
+ <div class="col"></div>
+ </div>
+ <div class="td"></div>
+ <div class="td"></div>
+</div>
Modified: trunk/Source/WebCore/ChangeLog (118818 => 118819)
--- trunk/Source/WebCore/ChangeLog 2012-05-29 19:28:04 UTC (rev 118818)
+++ trunk/Source/WebCore/ChangeLog 2012-05-29 19:30:43 UTC (rev 118819)
@@ -1,3 +1,25 @@
+2012-05-29 Julien Chaffraix <[email protected]>
+
+ REGRESSION(r111742): box-sizing: border-box doesn't work on fixed table layout
+ https://bugs.webkit.org/show_bug.cgi?id=87536
+
+ Reviewed by Tony Chang.
+
+ Tests: fast/table/fixed-table-layout/cell-box-sizing-fixed-table-layout.html
+ fast/table/fixed-table-layout/column-box-sizing-fixed-table-layout.html
+ fast/table/fixed-table-layout/column-group-box-sizing-fixed-table-layout.html
+ fast/table/fixed-table-layout/column-in-column-group-box-sizing-fixed-table-layout.html
+
+ The change in r111742 completely ignored border-sizing (following the table's code lead unfortunately).
+ The issue is that we would count the borders and paddings twice for the border-box case which would lead
+ to the content-box including them too. From a web-author, this behavior is equivalent to ignoring box-sizing.
+
+ * rendering/FixedTableLayout.cpp:
+ (WebCore::FixedTableLayout::calcWidthArray):
+ Reworked the function to properly use computeBorderBoxLogicalWidth() for correctness. This matches
+ what RenderBox and the rendering code does generally. Also refactored the code to avoid the need
+ for local variables and make it more readable.
+
2012-05-25 Ojan Vafai <[email protected]>
Absolute positioned elements in a relative positioned CSS3 Flexbox fail to display properly
Modified: trunk/Source/WebCore/rendering/FixedTableLayout.cpp (118818 => 118819)
--- trunk/Source/WebCore/rendering/FixedTableLayout.cpp 2012-05-29 19:28:04 UTC (rev 118818)
+++ trunk/Source/WebCore/rendering/FixedTableLayout.cpp 2012-05-29 19:30:43 UTC (rev 118819)
@@ -127,40 +127,39 @@
// Iterate over the first row in case some are unspecified.
RenderTableSection* section = m_table->topNonEmptySection();
- if (section) {
- unsigned cCol = 0;
- RenderObject* firstRow = section->firstChild();
- RenderObject* child = firstRow->firstChild();
- while (child) {
- if (child->isTableCell()) {
- RenderTableCell* cell = toRenderTableCell(child);
- if (cell->preferredLogicalWidthsDirty())
- cell->computePreferredLogicalWidths();
+ if (!section)
+ return usedWidth;
- Length w = cell->styleOrColLogicalWidth();
- unsigned span = cell->colSpan();
- int effectiveColWidth = 0;
- if (w.isFixed() && w.isPositive()) {
- w.setValue(w.value() + cell->borderAndPaddingLogicalWidth());
- effectiveColWidth = w.value();
- }
-
- unsigned usedSpan = 0;
- unsigned i = 0;
- while (usedSpan < span && cCol + i < nEffCols) {
- float eSpan = m_table->spanOfEffCol(cCol + i);
- // Only set if no col element has already set it.
- if (m_width[cCol + i].isAuto() && w.type() != Auto) {
- m_width[cCol + i] = w;
- m_width[cCol + i] *= eSpan / span;
- usedWidth += effectiveColWidth * eSpan / span;
- }
- usedSpan += eSpan;
- i++;
- }
- cCol += i;
+ unsigned currentColumn = 0;
+
+ RenderObject* firstRow = section->firstChild();
+ for (RenderObject* child = firstRow->firstChild(); child; child = child->nextSibling()) {
+ if (!child->isTableCell())
+ continue;
+
+ RenderTableCell* cell = toRenderTableCell(child);
+ if (cell->preferredLogicalWidthsDirty())
+ cell->computePreferredLogicalWidths();
+
+ Length logicalWidth = cell->styleOrColLogicalWidth();
+ unsigned span = cell->colSpan();
+ int fixedBorderBoxLogicalWidth = 0;
+ if (logicalWidth.isFixed() && logicalWidth.isPositive()) {
+ fixedBorderBoxLogicalWidth = cell->computeBorderBoxLogicalWidth(logicalWidth.value());
+ logicalWidth.setValue(fixedBorderBoxLogicalWidth);
+ }
+
+ unsigned usedSpan = 0;
+ while (usedSpan < span && currentColumn < nEffCols) {
+ float eSpan = m_table->spanOfEffCol(currentColumn);
+ // Only set if no col element has already set it.
+ if (m_width[currentColumn].isAuto() && logicalWidth.type() != Auto) {
+ m_width[currentColumn] = logicalWidth;
+ m_width[currentColumn] *= eSpan / span;
+ usedWidth += fixedBorderBoxLogicalWidth * eSpan / span;
}
- child = child->nextSibling();
+ usedSpan += eSpan;
+ ++currentColumn;
}
}