https://bugs.webkit.org/show_bug.cgi?id=89819
Patch by Kulanthaivel Palanichamy <kulanthaivel@codeaurora.org> on 2012-06-26
Reviewed by Julien Chaffraix.
Source/WebCore:
This change handles box-sizing: border-box property for CSS tables properly.
Test: fast/box-sizing/css-table-with-box-sizing.html
* rendering/RenderTable.cpp:
(WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth):
(WebCore::RenderTable::layout):
LayoutTests:
* fast/box-sizing/css-table-with-box-sizing-expected.txt: Added.
* fast/box-sizing/css-table-with-box-sizing.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121309
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2012-06-26 Kulanthaivel Palanichamy <kulanthaivel@codeaurora.org>
+
+ Unexpected element sizes when mixing inline-table with box-sizing
+ https://bugs.webkit.org/show_bug.cgi?id=89819
+
+ Reviewed by Julien Chaffraix.
+
+ * fast/box-sizing/css-table-with-box-sizing-expected.txt: Added.
+ * fast/box-sizing/css-table-with-box-sizing.html: Added.
+
2012-06-26 Filip Pizlo <fpizlo@apple.com>
DFG PutByValAlias is too aggressive
--- /dev/null
+Test case for bug 89819. This tests CSS 'table' and 'inline-table' with box-sizing.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementById("t1").offsetWidth is 120
+PASS document.getElementById("t1").offsetHeight is 120
+PASS document.getElementById("t2").offsetWidth is 120
+PASS document.getElementById("t2").offsetHeight is 120
+PASS document.getElementById("t3").offsetWidth is 140
+PASS document.getElementById("t3").offsetHeight is 140
+PASS document.getElementById("t4").offsetWidth is 140
+PASS document.getElementById("t4").offsetHeight is 140
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
--- /dev/null
+<html>
+<head>
+ <style>
+ .test {
+ width:120px;
+ height:120px;
+ border:10px solid black;
+ }
+
+ .border-box {
+ box-sizing:border-box;
+ -moz-box-sizing:border-box;
+ }
+
+ .content-box {
+ box-sizing:content-box;
+ -moz-box-sizing:content-box;
+ }
+
+ .css-inline-table {
+ display:inline-table;
+ }
+
+ .css-table {
+ display:table;
+ }
+ </style>
+</head>
+<body>
+<div id="testContent">
+ <p id="t1" class="test css-inline-table border-box">120x120<br>css-inline-table<br>border-box</p>
+ <p id="t2" class="test css-table border-box">120x120<br>css-table<br>border-box</p>
+ <p id="t3" class="test css-inline-table content-box">120x120<br>css-inline-table<br>content-box</p>
+ <p id="t4" class="test css-table content-box">120x120<br>css-table<br>content-box</p>
+</div>
+ <script src="../js/resources/js-test-pre.js"></script>
+ <script>
+ description("Test case for bug 89819. This tests CSS 'table' and 'inline-table' with box-sizing.");
+
+ shouldBe('document.getElementById("t1").offsetWidth', '120');
+ shouldBe('document.getElementById("t1").offsetHeight', '120');
+ shouldBe('document.getElementById("t2").offsetWidth', '120');
+ shouldBe('document.getElementById("t2").offsetHeight', '120');
+ shouldBe('document.getElementById("t3").offsetWidth', '140');
+ shouldBe('document.getElementById("t3").offsetHeight', '140');
+ shouldBe('document.getElementById("t4").offsetWidth', '140');
+ shouldBe('document.getElementById("t4").offsetHeight', '140');
+
+ document.getElementById("testContent").style.display = 'none';
+</script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
+2012-06-26 Kulanthaivel Palanichamy <kulanthaivel@codeaurora.org>
+
+ Unexpected element sizes when mixing inline-table with box-sizing
+ https://bugs.webkit.org/show_bug.cgi?id=89819
+
+ Reviewed by Julien Chaffraix.
+
+ This change handles box-sizing: border-box property for CSS tables properly.
+
+ Test: fast/box-sizing/css-table-with-box-sizing.html
+
+ * rendering/RenderTable.cpp:
+ (WebCore::RenderTable::convertStyleLogicalWidthToComputedWidth):
+ (WebCore::RenderTable::layout):
+
2012-06-26 Simon Fraser <simon.fraser@apple.com>
Optimize mappings of simple transforms in RenderGeometryMap
bool isCSSTable = !node() || !node()->hasTagName(tableTag);
if (isCSSTable && styleLogicalWidth.isFixed() && styleLogicalWidth.isPositive()) {
recalcBordersInRowDirection();
- borders = borderStart() + borderEnd() + (collapseBorders() ? ZERO_LAYOUT_UNIT : paddingStart() + paddingEnd());
+ if (style()->boxSizing() == CONTENT_BOX)
+ borders = borderStart() + borderEnd() + (collapseBorders() ? ZERO_LAYOUT_UNIT : paddingStart() + paddingEnd());
}
return minimumValueForLength(styleLogicalWidth, availableWidth, view()) + borders;
}
LayoutUnit computedLogicalHeight = 0;
if (logicalHeightLength.isFixed()) {
// HTML tables size as though CSS height includes border/padding, CSS tables do not.
- LayoutUnit borders = node() && node()->hasTagName(tableTag) ? (borderAndPaddingBefore + borderAndPaddingAfter) : ZERO_LAYOUT_UNIT;
+ LayoutUnit borders = ZERO_LAYOUT_UNIT;
+ // FIXME: We cannot apply box-sizing: content-box on <table> which other browsers allow.
+ if ((node() && node()->hasTagName(tableTag)) || style()->boxSizing() == BORDER_BOX)
+ borders = borderAndPaddingBefore + borderAndPaddingAfter;
computedLogicalHeight = logicalHeightLength.value() - borders;
} else if (logicalHeightLength.isPercent())
computedLogicalHeight = computePercentageLogicalHeight(logicalHeightLength);