Diff
Modified: branches/chromium/963/LayoutTests/ChangeLog (105207 => 105208)
--- branches/chromium/963/LayoutTests/ChangeLog 2012-01-18 00:12:40 UTC (rev 105207)
+++ branches/chromium/963/LayoutTests/ChangeLog 2012-01-18 00:13:13 UTC (rev 105208)
@@ -1,5 +1,22 @@
-2012-01-10 Tony Chang <[email protected]>
+2012-01-05 Max Vujovic <[email protected]>
+ WebKit adds vertical paddings and borders to the fixed width of CSS tables
+ https://bugs.webkit.org/show_bug.cgi?id=74955
+
+ Reviewed by Julien Chaffraix.
+
+ Added tests to check that the fixed width style is applied correctly to
+ CSS tables with respect to table paddings and borders.
+
+ * fast/table/css-table-width-expected.txt: Added.
+ * fast/table/css-table-width.html: Added.
+ * fast/table/script-tests/css-table-width.js: Added.
+ (computeCSSTableOffsetWidth):
+ (computeCSSTableOffsetHeight):
+ (computeCSSTableProperty):
+
+2012-01-05 Csaba Osztrogonác <[email protected]>
+
Need to handle absolutely positioned elements inside flexboxes
https://bugs.webkit.org/show_bug.cgi?id=70793
Copied: branches/chromium/963/LayoutTests/fast/table/css-table-width-expected.txt (from rev 104140, trunk/LayoutTests/fast/table/css-table-width-expected.txt) (0 => 105208)
--- branches/chromium/963/LayoutTests/fast/table/css-table-width-expected.txt (rev 0)
+++ branches/chromium/963/LayoutTests/fast/table/css-table-width-expected.txt 2012-01-18 00:13:13 UTC (rev 105208)
@@ -0,0 +1,29 @@
+This test checks that the width style is applied correctly to CSS tables with respect to table paddings and borders.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS computeCSSTableOffsetWidth('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px;') is 220
+PASS computeCSSTableOffsetWidth('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; direction: rtl;') is 220
+PASS computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl;') is 310
+PASS computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl; -webkit-text-orientation: upright; text-orientation: upright;') is 310
+PASS computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl; direction: rtl;') is 310
+PASS computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl; direction: rtl; -webkit-text-orientation: upright; text-orientation: upright;') is 310
+PASS computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; -webkit-writing-mode: vertical-lr; writing-mode: vertical-lr;') is 310
+PASS computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; -webkit-writing-mode: vertical-lr; writing-mode: vertical-lr; -webkit-text-orientation: upright; text-orientation: upright;') is 310
+PASS computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; -webkit-writing-mode: vertical-lr; writing-mode: vertical-lr; direction: rtl;') is 310
+PASS computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; -webkit-writing-mode: vertical-lr; writing-mode: vertical-lr; direction: rtl; -webkit-text-orientation: upright; text-orientation: upright;') is 310
+PASS computeCSSTableOffsetWidth('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse;') is 203
+PASS computeCSSTableOffsetWidth('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; direction: rtl;') is 203
+PASS computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl;') is 170
+PASS computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl; -webkit-text-orientation: upright; text-orientation: upright;') is 170
+PASS computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl; direction: rtl;') is 170
+PASS computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl; direction: rtl; -webkit-text-orientation: upright; text-orientation: upright;') is 170
+PASS computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; -webkit-writing-mode: vertical-lr; writing-mode: vertical-lr;') is 170
+PASS computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; -webkit-writing-mode: vertical-lr; writing-mode: vertical-lr; -webkit-text-orientation: upright; text-orientation: upright;') is 170
+PASS computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; -webkit-writing-mode: vertical-lr; writing-mode: vertical-lr; direction: rtl;') is 170
+PASS computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; -webkit-writing-mode: vertical-lr; writing-mode: vertical-lr; direction: rtl; -webkit-text-orientation: upright; text-orientation: upright;') is 170
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Copied: branches/chromium/963/LayoutTests/fast/table/css-table-width.html (from rev 104140, trunk/LayoutTests/fast/table/css-table-width.html) (0 => 105208)
--- branches/chromium/963/LayoutTests/fast/table/css-table-width.html (rev 0)
+++ branches/chromium/963/LayoutTests/fast/table/css-table-width.html 2012-01-18 00:13:13 UTC (rev 105208)
@@ -0,0 +1,10 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+<head>
+<script src=""
+</head>
+<body>
+<script src=""
+<script src=""
+</body>
+</html>
Copied: branches/chromium/963/LayoutTests/fast/table/script-tests/css-table-width.js (from rev 104140, trunk/LayoutTests/fast/table/script-tests/css-table-width.js) (0 => 105208)
--- branches/chromium/963/LayoutTests/fast/table/script-tests/css-table-width.js (rev 0)
+++ branches/chromium/963/LayoutTests/fast/table/script-tests/css-table-width.js 2012-01-18 00:13:13 UTC (rev 105208)
@@ -0,0 +1,71 @@
+description("This test checks that the width style is applied correctly to CSS tables with respect to table paddings and borders.");
+
+function computeCSSTableOffsetWidth(extraTableStyle)
+{
+ return computeCSSTableProperty('offsetWidth', extraTableStyle)
+}
+
+function computeCSSTableOffsetHeight(extraTableStyle)
+{
+ return computeCSSTableProperty('offsetHeight', extraTableStyle)
+}
+
+function computeCSSTableProperty(propertyName, extraTableStyle)
+{
+ var table = document.createElement("div");
+ table.setAttribute("style", "display: table; " + extraTableStyle);
+
+ var rowGroup = document.createElement("div");
+ rowGroup.setAttribute("style", "display: table-row-group;");
+
+ var row = document.createElement("div");
+ row.setAttribute("style", "display: table-row;");
+
+ var cell = document.createElement("div");
+ cell.setAttribute("style", "display: table-cell;");
+
+ var cellContent = document.createElement("div");
+ cellContent.setAttribute("style", "width: 100px; height: 50px; background-color: #090;");
+
+ document.body.appendChild(table);
+ table.appendChild(rowGroup);
+ rowGroup.appendChild(row);
+ row.appendChild(cell);
+ cell.appendChild(cellContent);
+
+ var propertyValue = table[propertyName];
+
+ document.body.removeChild(table);
+
+ return propertyValue;
+}
+
+// separated borders
+
+shouldEvaluateTo("computeCSSTableOffsetWidth('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px;')", 200+2+4+6+8);
+shouldEvaluateTo("computeCSSTableOffsetWidth('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; direction: rtl;')", 200+2+4+6+8);
+
+shouldEvaluateTo("computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl;')", 150+10+30+50+70);
+shouldEvaluateTo("computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl; -webkit-text-orientation: upright; text-orientation: upright;')", 150+10+30+50+70);
+shouldEvaluateTo("computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl; direction: rtl;')", 150+10+30+50+70);
+shouldEvaluateTo("computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl; direction: rtl; -webkit-text-orientation: upright; text-orientation: upright;')", 150+10+30+50+70);
+
+shouldEvaluateTo("computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; -webkit-writing-mode: vertical-lr; writing-mode: vertical-lr;')", 150+10+30+50+70);
+shouldEvaluateTo("computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; -webkit-writing-mode: vertical-lr; writing-mode: vertical-lr; -webkit-text-orientation: upright; text-orientation: upright;')", 150+10+30+50+70);
+shouldEvaluateTo("computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; -webkit-writing-mode: vertical-lr; writing-mode: vertical-lr; direction: rtl;')", 150+10+30+50+70);
+shouldEvaluateTo("computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; -webkit-writing-mode: vertical-lr; writing-mode: vertical-lr; direction: rtl; -webkit-text-orientation: upright; text-orientation: upright;')", 150+10+30+50+70);
+
+// collapsed borders
+
+shouldEvaluateTo("computeCSSTableOffsetWidth('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse;')", 200+(2+4)/2);
+shouldEvaluateTo("computeCSSTableOffsetWidth('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; direction: rtl;')", 200+(2+4)/2);
+
+shouldEvaluateTo("computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl;')", 150+(10+30)/2);
+shouldEvaluateTo("computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl; -webkit-text-orientation: upright; text-orientation: upright;')", 150+(10+30)/2);
+shouldEvaluateTo("computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl; direction: rtl;')", 150+(10+30)/2);
+shouldEvaluateTo("computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; -webkit-writing-mode: vertical-rl; writing-mode: vertical-rl; direction: rtl; -webkit-text-orientation: upright; text-orientation: upright;')", 150+(10+30)/2);
+
+shouldEvaluateTo("computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; -webkit-writing-mode: vertical-lr; writing-mode: vertical-lr;')", 150+(10+30)/2);
+shouldEvaluateTo("computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; -webkit-writing-mode: vertical-lr; writing-mode: vertical-lr; -webkit-text-orientation: upright; text-orientation: upright;')", 150+(10+30)/2);
+shouldEvaluateTo("computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; -webkit-writing-mode: vertical-lr; writing-mode: vertical-lr; direction: rtl;')", 150+(10+30)/2);
+shouldEvaluateTo("computeCSSTableOffsetHeight('width: 200px; height: 150px; border-style: solid; border-width: 10px 2px 30px 4px; padding: 50px 6px 70px 8px; border-collapse: collapse; -webkit-writing-mode: vertical-lr; writing-mode: vertical-lr; direction: rtl; -webkit-text-orientation: upright; text-orientation: upright;')", 150+(10+30)/2);
Modified: branches/chromium/963/Source/WebCore/ChangeLog (105207 => 105208)
--- branches/chromium/963/Source/WebCore/ChangeLog 2012-01-18 00:12:40 UTC (rev 105207)
+++ branches/chromium/963/Source/WebCore/ChangeLog 2012-01-18 00:13:13 UTC (rev 105208)
@@ -1,5 +1,20 @@
-2012-01-10 Tony Chang <[email protected]>
+2012-01-05 Max Vujovic <[email protected]>
+ WebKit adds vertical paddings and borders to the fixed width of CSS tables
+ https://bugs.webkit.org/show_bug.cgi?id=74955
+
+ Reviewed by Julien Chaffraix.
+
+ Test: fast/table/css-table-width.html
+
+ * rendering/RenderTable.cpp:
+ (WebCore::RenderTable::computeLogicalWidth):
+
+ Changed the width calculation for CSS tables to take into account horizontal
+ paddings and borders instead of vertical paddings and borders.
+
+2012-01-05 Peter Beverloo <[email protected]>
+
Need to handle absolutely positioned elements inside flexboxes
https://bugs.webkit.org/show_bug.cgi?id=70793
Modified: branches/chromium/963/Source/WebCore/rendering/RenderTable.cpp (105207 => 105208)
--- branches/chromium/963/Source/WebCore/rendering/RenderTable.cpp 2012-01-18 00:12:40 UTC (rev 105207)
+++ branches/chromium/963/Source/WebCore/rendering/RenderTable.cpp 2012-01-18 00:13:13 UTC (rev 105208)
@@ -232,11 +232,9 @@
// HTML tables size as though CSS width includes border/padding, CSS tables do not.
LayoutUnit borders = 0;
if (logicalWidthType != Percent && (!node() || !node()->hasTagName(tableTag))) {
- bool collapsing = collapseBorders();
- LayoutUnit borderAndPaddingBefore = borderBefore() + (collapsing ? 0 : paddingBefore());
- LayoutUnit borderAndPaddingAfter = borderAfter() + (collapsing ? 0 : paddingAfter());
- borders = borderAndPaddingBefore + borderAndPaddingAfter;
- }
+ recalcBordersInRowDirection();
+ borders = borderStart() + borderEnd() + (collapseBorders() ? 0 : paddingStart() + paddingEnd());
+ }
setLogicalWidth(style()->logicalWidth().calcMinValue(containerWidthInInlineDirection) + borders);
setLogicalWidth(max(minPreferredLogicalWidth(), logicalWidth()));
} else {